Skip to content

Commit

Permalink
Issue #6 - Pass expDate in Onsite::createPayment.
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoliver committed Nov 7, 2016
1 parent cd4ef62 commit 39fc78b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Plugin/Commerce/PaymentGateway/Onsite.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ public function createPayment(PaymentInterface $payment, $capture = TRUE) {
],
'token' => [
'litleToken' => $payment_method->getRemoteId(),
'expDate' => Helper::getVantivCreditCardExpDate($payment_method)
],
];
$request_method = $capture ? 'saleRequest' : 'authorizationRequest';
Expand Down Expand Up @@ -515,9 +516,9 @@ private function ensureSuccessTransaction(array $response_array, $txn_type = 'Tr
$error = '@type failed with code @code (@message) (@id).';
$message = $this->t($error, [
'@type' => $txn_type,
'@code' => $response_array['response'],
'@message' => $response_array['message'],
'@id' => $response_array['litleTxnId']
'@code' => isset($response_array['response']) ? $response_array['response'] : '',
'@message' => isset($response_array['message']) ? $response_array['message'] : '',
'@id' => isset($response_array['litleTxnId']) ? $response_array['litleTxnId'] : ''
]);
\Drupal::logger('commerce_vantiv')->log(RfcLogLevel::ERROR, $message);
throw new SoftDeclineException($message);
Expand Down
3 changes: 3 additions & 0 deletions src/VantivApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ public static function getResponseArray($response_document, $payload_attribute)
$new_array['attributes'] = $attributes;
return $new_array;
}
elseif (!empty($json_dec['@attributes'])) {
return $json_dec['@attributes'];
}
else {
return FALSE;
}
Expand Down

0 comments on commit 39fc78b

Please sign in to comment.