本文整理匯總了PHP中Merchant::getCurrency方法的典型用法代碼示例。如果您正苦於以下問題:PHP Merchant::getCurrency方法的具體用法?PHP Merchant::getCurrency怎麽用?PHP Merchant::getCurrency使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Merchant
的用法示例。
在下文中一共展示了Merchant::getCurrency方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: capture
/**
* @param \Ilis\Bundle\PaymentBundle\Entity\Transaction\CreditCard $transaction
*/
public function capture(CreditCardTransaction $transaction)
{
if (!is_numeric($transaction->getAmount()) || $transaction->getAmount() <= 0) {
throw new Exception("Invalid amount");
}
// TODO: Check if the transaction has set the proper payment method
$request = new WsRequest();
$request->setOrder($transaction->getId());
$amount = (double) number_format($transaction->getAmount(), 2, '.', '') * 100;
$request->setAmount($amount);
$request->setOrder($transaction->getIdentifier());
$request->setMerchantCode($this->merchant->getCode());
$request->setTerminal($this->merchant->getTerminal());
$request->setCurrency($this->merchant->getCurrency());
$request->setPan($transaction->creditCard);
$request->setCvv2($transaction->cvv);
$request->setExpiryDate(sprintf("%s%s", $transaction->expiryDateYear, $transaction->expiryDateMonth));
$request->setTransactionType(WsTransaction::TYPE_AUTH);
$this->merchant->signRequest($request);
$response = $this->client->makeRequest($request);
$operation = $response->getOperation();
$authCode = $operation ? trim((string) $operation->Ds_AuthorisationCode) : null;
if ($response->isValid() && !empty($authCode)) {
$transaction->setStatus(Transaction::STATUS_SUCCESS);
$transaction->setAuthCode((string) $response->getOperation()->Ds_AuthorisationCode);
} else {
$transaction->setStatus(Transaction::STATUS_ERROR);
$transaction->setStatusCode((string) $response->getCode());
}
$transaction->setRawData($response->asXml());
}