Skip to content

Commit

Permalink
Update sagepay_server.php
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCartpenter authored Dec 31, 2023
1 parent e6775d6 commit 5a6839e
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions upload/catalog/controller/extension/payment/sagepay_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ public function callback(): void {

// Check if order we have saved in database maches with callback sagepay does
if (!isset($transaction_info['order_id']) || $transaction_info['order_id'] != $order_id) {
echo "Status=INVALID" . $end_ln;
echo "StatusDetail= Order IDs could not be matched. Order might be tampered with." . $end_ln;
echo "RedirectURL=" . $error_page . $end_ln;
echo 'Status=INVALID' . $end_ln;
echo 'StatusDetail=Order IDs could not be matched. Order might be tampered with.' . $end_ln;
echo 'RedirectURL=' . $error_page . $end_ln;

$this->model_extension_payment_sagepay_server->logger('StatusDetail', 'Order IDs could not be matched. Order might be tampered with');
exit;
Expand All @@ -369,9 +369,9 @@ public function callback(): void {
if ($str_my_signature != $str_vps_signature) {
$this->model_extension_payment_sagepay_server->deleteOrder($order_id);

echo "Status=INVALID" . $end_ln;
echo "StatusDetail= Cannot match the MD5 Hash. Order might be tampered with." . $end_ln;
echo "RedirectURL=" . $error_page . $end_ln;
echo 'Status=INVALID' . $end_ln;
echo 'StatusDetail=Cannot match the MD5 Hash. Order might be tampered with.' . $end_ln;
echo 'RedirectURL=' . $error_page . $end_ln;

$this->model_extension_payment_sagepay_server->logger('StatusDetail', 'Cannot match the MD5 Hash. Order might be tampered with');
exit;
Expand Down Expand Up @@ -408,13 +408,15 @@ public function callback(): void {
$this->model_extension_payment_sagepay_server->addTransaction($transaction_info['sagepay_server_order_id'], $this->config->get('payment_sagepay_server_transaction'), $order_info);

if ($str_token) {
$data['customer_id'] = $order_info['customer_id'];
$data['ExpiryDate'] = substr($str_expiry_date, -4, 2) . '/' . substr($str_expiry_date, 2);
$data['Token'] = $str_token;
$data['CardType'] = $str_card_type;
$data['Last4Digits'] = $str_last_4_digits;

$this->model_extension_payment_sagepay_server->addCard($data);
$post_data = [];

$post_data['customer_id'] = $order_info['customer_id'];
$post_data['ExpiryDate'] = substr($str_expiry_date, -4, 2) . '/' . substr($str_expiry_date, 2);
$post_data['Token'] = $str_token;
$post_data['CardType'] = $str_card_type;
$post_data['Last4Digits'] = $str_last_4_digits;

$this->model_extension_payment_sagepay_server->addCard($post_data);
}

echo 'Status=OK' . $end_ln;
Expand Down

0 comments on commit 5a6839e

Please sign in to comment.