Skip to content

Commit

Permalink
Merge branch 'fix/CS-6471' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
filipkojic committed Jan 28, 2025
2 parents a306956 + cf076af commit 9beae01
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 65 deletions.
96 changes: 42 additions & 54 deletions src/adyenofficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,40 +519,6 @@ public function hookPaymentOptions(array $params): array
return $paymentOptions;
}

/**
* @param array $params
*
* @return false|string|null
*/
public function hookDisplayPaymentReturn(array $params)
{
if (!$this->active) {
return null;
}

$cartId = \AdyenPayment\Classes\Utility\SessionService::get('cartId');

$this->context->smarty->assign(
[
'adyenAction' => \AdyenPayment\Classes\Utility\SessionService::get('adyenAction'),
'checkoutConfigUrl' => AdyenPayment\Classes\Utility\Url::getFrontUrl(
'paymentconfig',
['cartId' => $cartId]
),
'additionalDataUrl' => AdyenPayment\Classes\Utility\Url::getFrontUrl(
'paymentredirect',
[
'adyenMerchantReference' => $cartId,
'adyenPaymentType' => \AdyenPayment\Classes\Utility\SessionService::get('adyenPaymentMethodType'),
'adyenPage' => 'thankYou'
]
),
]
);

return $this->display(__FILE__, '/views/templates/front/adyen-order-confirmation.tpl');
}

/**
* @param array $params
*
Expand Down Expand Up @@ -887,35 +853,57 @@ public function hookDisplayOrderConfirmation(array $params)
return null;
}

$cartId = \AdyenPayment\Classes\Utility\SessionService::get('cartId');
$adyenAction = \AdyenPayment\Classes\Utility\SessionService::get('adyenAction');
$adyenPaymentType = \AdyenPayment\Classes\Utility\SessionService::get('adyenPaymentMethodType');

$additionalActionConfig = [
'adyenAction' => $adyenAction,
'checkoutConfigUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl(
'paymentconfig',
['cartId' => $cartId]
),
'additionalDataUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl(
'paymentredirect',
[
'adyenMerchantReference' => $cartId,
'adyenPaymentType' => $adyenPaymentType,
'adyenPage' => 'thankYou'
]
),
];

$storeId = $params['order']->id_shop;
$adyenGivingInformation = \Adyen\Core\BusinessLogic\AdminAPI\AdminAPI::get()->adyenGivingSettings(
$storeId
)->getAdyenGivingSettings()->toArray();

$cart = new \Cart($params['order']->id_cart);
$donationConfig = [
'enabled' => $adyenGivingInformation['enableAdyenGiving'],
'donationsConfigUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl(
'adyendonationsconfig',
[
'merchantReference' => $cart->id,
'key' => $cart->secure_key,
'module' => $params['order']->module
]
),
'makeDonationsUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl(
'adyenmakedonation',
[
'merchantReference' => $cart->id,
'key' => $cart->secure_key,
'module' => $params['order']->module
]
)
];

$this->context->smarty->assign(
[
'enabled' => $adyenGivingInformation['enableAdyenGiving'],
'donationsConfigUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl(
'adyendonationsconfig',
[
'merchantReference' => $cart->id,
'key' => $cart->secure_key,
'module' => $params['order']->module
]
),
'makeDonationsUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl(
'adyenmakedonation',
[
'merchantReference' => $cart->id,
'key' => $cart->secure_key,
'module' => $params['order']->module
]
)
]
array_merge($additionalActionConfig, $donationConfig)
);

return $this->display(__FILE__, '/views/templates/front/adyen-donations.tpl');
return $this->display(__FILE__, '/views/templates/front/adyen-combined-order-confirmation.tpl');
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/classes/Utility/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class Installer
'actionValidateOrder',
'sendMailAlterTemplateVars',
'displayOrderConfirmation',
'displayPaymentReturn',
'actionObjectOrderUpdateAfter'
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@
<div id="adyen-additional-data"></div>
</div>
{/if}

{if ($enabled)}
<div class="card-block">
<div class="row" style="width: 70%; margin-left: 150px">
<div id='donation-container'
data-donationsConfigUrl="{$donationsConfigUrl}"
data-makeDonationsUrl="{$makeDonationsUrl}"
></div>
</div>
</div>
{/if}
10 changes: 0 additions & 10 deletions src/views/templates/front/adyen-donations.tpl

This file was deleted.

0 comments on commit 9beae01

Please sign in to comment.