Skip to content

Commit

Permalink
PLUG-3911 - Reserve order Id
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinverschoor committed Nov 1, 2024
1 parent a5efffc commit 12dc031
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 10 deletions.
8 changes: 7 additions & 1 deletion Controller/Checkout/FastCheckoutStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,19 @@ public function execute()
throw new \Exception('empty amount', FastCheckoutStart::FC_EMPTY_BASKET);
}

if (!empty($store->getConfig('payment/paynl_payment_ideal/fast_checkout_reserveOrderId')) && $store->getConfig('payment/paynl_payment_ideal/fast_checkout_reserveOrderId') == 1) { // phpcs:ignore
$quote->reserveOrderId();
$quote->save();
}

$payTransaction = (new PayPaymentCreateFastCheckout(
$methodInstance,
$fcAmount * 100,
$arrProducts,
$this->storeManager->getStore()->getBaseUrl(),
$this->cart->getQuote()->getId(),
$this->storeManager->getStore()->getCurrentCurrencyCode()
$this->storeManager->getStore()->getCurrentCurrencyCode(),
$quote->getReservedOrderId() ?? null
))->create();

$this->getResponse()->setNoCacheHeaders();
Expand Down
10 changes: 8 additions & 2 deletions Model/PayPaymentCreateFastCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class PayPaymentCreateFastCheckout extends PayPaymentCreate
*/
private $reference = '';

/**
* @var string
*/
private $reservedOrderId = '';

/**
* @param \Paynl\Payment\Model\Paymentmethod\Paymentmethod $methodInstance
* @param string $amount Amount to start fastCheckout with
Expand All @@ -31,7 +36,7 @@ class PayPaymentCreateFastCheckout extends PayPaymentCreate
* @throws \Exception
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
*/
public function __construct($methodInstance, $amount, $products, $baseUrl, $quoteId, $currency)
public function __construct($methodInstance, $amount, $products, $baseUrl, $quoteId, $currency, $reservedOrderId)
{
$fastCheckout = parent::__construct(null, $methodInstance);

Expand All @@ -44,6 +49,7 @@ public function __construct($methodInstance, $amount, $products, $baseUrl, $quot
$fastCheckout->setExchangeURL($exchangeUrl);
$fastCheckout->setProducts($products);
$fastCheckout->reference = 'fastcheckout' . $quoteId;
$fastCheckout->reservedOrderId = $reservedOrderId;
}

/**
Expand Down Expand Up @@ -96,7 +102,7 @@ public function getData()
$this->_add($stats, 'info', '');
$this->_add($stats, 'tool', '');
$this->_add($stats, 'object', $this->methodInstance->getVersion() . ' | fc');
$this->_add($stats, 'extra1', '');
$this->_add($stats, 'extra1', $this->reservedOrderId);
$this->_add($stats, 'extra2', '');
$this->_add($stats, 'extra3', $this->reference);
$this->_add($parameters, 'stats', $stats);
Expand Down
7 changes: 7 additions & 0 deletions etc/adminhtml/paymentmethods/ideal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ Using the intermediate screen will allow users to select their own shipping meth
This setting does not effect the product page. If fast checkout is enabled for the product page, the fast checkout button will always be shown.</tooltip>
<comment>Show the fast checkout button on the cart page, only for guest customers.</comment>
</field>
<field id="fast_checkout_reserveOrderId" translate="label" type="select" sortOrder="184" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Reserve order Id</label>
<frontend_model>Paynl\Payment\Block\Adminhtml\Render\Checkbox</frontend_model>
<config_path>payment/paynl_payment_ideal/fast_checkout_reserveOrderId</config_path>
<tooltip>When enabled, the fast checkout order id will be reserved on start and send to Pay.</tooltip>
<comment>Reserve the order id on fast checkout start.</comment>
</field>
</group>
<group id="advanced" translate="label" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Advanced</label>
Expand Down
5 changes: 4 additions & 1 deletion i18n/de_AT.csv
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,7 @@ Diese Einstellung wirkt sich nicht auf die Produktseite aus. Wenn der schnelle C
"On - as Required","Ein - nach Bedarf"
"Show notice and abort fast checkout","Hinweis anzeigen und Schnellkasse abbrechen"
"Show intermediate screen to select shipping method","Zwischenbildschirm zur Auswahl der Versandart anzeigen"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Reserve order Id","Reservieren Sie Bestellnummer"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","Wenn aktiviert, wird die fastcheckout Bestellnummer beim Start reserviert und an Pay. gesendet."
"Reserve the order id on fast checkout start.","Reservieren Sie die Bestellnummer beim Start des fastcheckout."
5 changes: 4 additions & 1 deletion i18n/de_CH.csv
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,7 @@ Diese Einstellung wirkt sich nicht auf die Produktseite aus. Wenn der schnelle C
"On - as Required","Ein - nach Bedarf"
"Show notice and abort fast checkout","Hinweis anzeigen und Schnellkasse abbrechen"
"Show intermediate screen to select shipping method","Zwischenbildschirm zur Auswahl der Versandart anzeigen"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Reserve order Id","Reservieren Sie Bestellnummer"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","Wenn aktiviert, wird die fastcheckout Bestellnummer beim Start reserviert und an Pay. gesendet."
"Reserve the order id on fast checkout start.","Reservieren Sie die Bestellnummer beim Start des fastcheckout."
5 changes: 4 additions & 1 deletion i18n/de_DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,7 @@ Diese Einstellung wirkt sich nicht auf die Produktseite aus. Wenn der schnelle C
"On - as Required","Ein - nach Bedarf"
"Show notice and abort fast checkout","Hinweis anzeigen und Schnellkasse abbrechen"
"Show intermediate screen to select shipping method","Zwischenbildschirm zur Auswahl der Versandart anzeigen"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Reserve order Id","Reservieren Sie Bestellnummer"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","Wenn aktiviert, wird die fastcheckout Bestellnummer beim Start reserviert und an Pay. gesendet."
"Reserve the order id on fast checkout start.","Reservieren Sie die Bestellnummer beim Start des fastcheckout."
5 changes: 4 additions & 1 deletion i18n/de_LU.csv
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,7 @@ Diese Einstellung wirkt sich nicht auf die Produktseite aus. Wenn der schnelle C
"On - as Required","Ein - nach Bedarf"
"Show notice and abort fast checkout","Hinweis anzeigen und Schnellkasse abbrechen"
"Show intermediate screen to select shipping method","Zwischenbildschirm zur Auswahl der Versandart anzeigen"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Vielen Dank für Ihren Kauf, sobald die Zahlung abgeschlossen ist, erhalten Sie eine E-Mail."
"Reserve order Id","Reservieren Sie Bestellnummer"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","Wenn aktiviert, wird die fastcheckout Bestellnummer beim Start reserviert und an Pay. gesendet."
"Reserve the order id on fast checkout start.","Reservieren Sie die Bestellnummer beim Start des fastcheckout."
3 changes: 3 additions & 0 deletions i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,6 @@ This setting does not effect the product page. If fast checkout is enabled for t
"Show notice and abort fast checkout","Show notice and abort fast checkout"
"Show intermediate screen to select shipping method","Show intermediate screen to select shipping method"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Thank you for your purchase, as soon as the payment is completed you will receive an email."
"Reserve order Id","Reserve order Id"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","When enabled, the fast checkout order id will be reserved on start and send to Pay."
"Reserve the order id on fast checkout start.","Reserve the order id on fast checkout start."
5 changes: 4 additions & 1 deletion i18n/fr_BE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,7 @@ Ce paramètre n'affecte pas la page produit. Si le paiement rapide est activé p
"On - as Required","Activé - en requis"
"Show notice and abort fast checkout","Afficher un avis et abandonner le fastcheckout"
"Show intermediate screen to select shipping method","Afficher l'écran intermédiaire pour sélectionner la méthode d'expédition"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Nous vous remercions pour votre commande. Dès que le paiement aura été traité, vous recevrez un e-mail."
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Nous vous remercions pour votre commande. Dès que le paiement aura été traité, vous recevrez un e-mail."
"Reserve order Id","Numéro de commande de réserve"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","Lorsqu'elle est activée, l'identifiant de commande de fastcheckout sera réservé au démarrage et envoyé à Pay."
"Reserve the order id on fast checkout start.","Réservez l'identifiant de commande au démarrage du fastcheckout."
5 changes: 4 additions & 1 deletion i18n/nl_BE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,7 @@ Deze instelling heeft geen effect op de productpagina. Als snel bestellen is ing
"On - as Required","Aan - als Verplicht"
"Show notice and abort fast checkout","Toon melding en annuleer snel bestellen"
"Show intermediate screen to select shipping method","Toon tussenscherm om verzendmethode te selecteren"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Bedankt voor uw bestelling, zodra de betaling afgerond is ontvangt u een email."
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Bedankt voor uw bestelling, zodra de betaling afgerond is ontvangt u een email."
"Reserve order Id","Reserveer order Id"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","Als deze optie is ingeschakeld, wordt de Fast Checkout order Id bij de start gereserveerd en naar Pay verzonden."
"Reserve the order id on fast checkout start.","Reserveer de order Id bij het starten van de fast checkout."
5 changes: 4 additions & 1 deletion i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,7 @@ Deze instelling heeft geen effect op de productpagina. Als snel bestellen is ing
"On - as Required","Aan - als Verplicht"
"Show notice and abort fast checkout","Toon melding en annuleer snel bestellen"
"Show intermediate screen to select shipping method","Toon tussenscherm om verzendmethode te selecteren"
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Bedankt voor uw bestelling, zodra de betaling afgerond is ontvangt u een email."
"Thank you for your purchase, as soon as the payment is completed you will receive an email.","Bedankt voor uw bestelling, zodra de betaling afgerond is ontvangt u een email."
"Reserve order Id","Reserveer order Id"
"When enabled, the fast checkout order id will be reserved on start and send to Pay.","Als deze optie is ingeschakeld, wordt de Fast Checkout order Id bij de start gereserveerd en naar Pay verzonden."
"Reserve the order id on fast checkout start.","Reserveer de order Id bij het starten van de fast checkout."

0 comments on commit 12dc031

Please sign in to comment.