本文整理汇总了PHP中Payment::getAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::getAmount方法的具体用法?PHP Payment::getAmount怎么用?PHP Payment::getAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::getAmount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Payment
function test_payment_amount()
{
$payment = new Payment(12.35, 'Inscripcio', '29292929');
$this->assertEqual('1235', $payment->getAmount());
$payment->setAmount(12);
$this->assertEqual('1200', $payment->getAmount());
$payment->setAmount(120);
$this->assertEqual('12000', $payment->getAmount());
$payment->setAmount(120.3);
$this->assertEqual('12030', $payment->getAmount());
$payment->setAmount(120.21);
$this->assertEqual('12021', $payment->getAmount());
$payment->setAmount('12.35');
$this->assertEqual('1235', $payment->getAmount());
$payment->setAmount('12');
$this->assertEqual('1200', $payment->getAmount());
$payment->setAmount('120');
$this->assertEqual('12000', $payment->getAmount());
$payment->setAmount('120.3');
$this->assertEqual('12030', $payment->getAmount());
$payment->setAmount('120.21');
$this->assertEqual('12021', $payment->getAmount());
}
示例2: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
include dirname(__FILE__) . '/../../testTools.php';
$t = new lime_test(2, new lime_output_color());
PropertyTable::set('currency_decimals', 3);
$p = new Payment();
$p->setAmount(2.1215);
$t->is($p->getAmount(), 2.122, 'rounds amount to 3 decimals');
PropertyTable::set('currency_decimals', 2);
$p->setAmount(2.123);
$t->is($p->getAmount(), 2.12, 'rounds amount to 2 decimals');
示例3: addPayment
/**
* Add the payment
*
* @param \Cx\Modules\Order\Model\Entity\Payment $payment
*/
public function addPayment(Payment $payment)
{
$payment->setInvoice($this);
$this->payments[] = $payment;
if ($payment->getAmount() == $this->getAmount()) {
$this->paid = true;
}
if ($payment->getAmount() > $this->getAmount()) {
throw new InvoiceException('Amount of payment must not be greater than invoice amount');
}
}
示例4: isset
include_once 'include/common.php';
include_once 'include/ServiceRequest.php';
include_once 'include/AccessRights/SuperadminAdminClient.php';
$serviceRequestId = isset($_REQUEST["id"]) ? $_REQUEST["id"] : NULL;
$mode = isset($_REQUEST["paymentmode"]) ? $_REQUEST["paymentmode"] : NULL;
$isBank = $mode == "bank";
$isPaypal = $mode == "paypal";
$currentUser = $_SESSION["user"];
$serviceRequest = new ServiceRequest();
$serviceRequestDetails = $serviceRequest->getServiceRequest(array("service_no" => "DESC"), array("service_no" => array($serviceRequestId, Equal)));
$serviceRequestDetails = $serviceRequestDetails[0];
$payment = new Payment();
$payments = $payment->getPayments(array("payment_no" => "DESC"), array("service_no" => array($serviceRequestId, Equal)));
$totalPayments = 0;
foreach ($payments as $payment) {
$totalPayments += $payment->getAmount();
}
if ($isPaypal && isset($_REQUEST["PaypalSubmit"])) {
$paypal = new Paypal($_POST);
if ($result = $paypal->DoPayment()) {
$packageAmount = $serviceRequestDetails->getPackageDetails()[0]->getPrice();
$paymenstatus = $totalPayments + $result["amount"] >= $packageAmount ? "complete" : "partial";
$payment->setOr_id($result["transactionID"]);
$payment->setMode("paypal");
$payment->setAmount($result["amount"]);
$payment->setService_no($serviceRequestId);
$payment->setStat($paymenstatus);
$payment->save();
header("Location:ViewPayments.php?id=" . $serviceRequestId);
} else {
header("Location:" . $_SERVER["PHP_SELF"] . "?message=Failed");