本文整理汇总了PHP中Merchant::getTerminal方法的典型用法代码示例。如果您正苦于以下问题:PHP Merchant::getTerminal方法的具体用法?PHP Merchant::getTerminal怎么用?PHP Merchant::getTerminal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Merchant
的用法示例。
在下文中一共展示了Merchant::getTerminal方法的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());
}