public function chargeCard($amount, $currency, $ipAddress, $cardHolderName, $cryptogram, $params = [], $requireConfirmation = false)
{
$endpoint = $requireConfirmation ? '/payments/cards/auth' : '/payments/cards/charge';
$defaultParams = [
'Amount' => $amount,
'Currency' => $currency,
'IpAddress' => $ipAddress,
'Name' => $cardHolderName,
'CardCryptogramPacket' => $cryptogram
];
$response = $this->sendRequest($endpoint, array_merge($defaultParams, $params));
if ($response['Success']) {
return Transaction::fromArray($response['Model']);
}
if ($response['Message']) {
throw new RequestException($response);
}
if (isset($response['Model']['ReasonCode']) && $response['Model']['ReasonCode'] !== 0) {
throw new PaymentException($response);
}
return Required3DS::fromArray($response['Model']);
}