We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit cfd948a2 authored by Alessio Zampatti's avatar Alessio Zampatti

Add try/catch on originKeys call, add error message for card methods on frontend and backend

parent cee5877b
......@@ -1395,7 +1395,12 @@ class Data extends AbstractHelper
$client = $this->initializeAdyenClient($storeId);
$service = $this->createAdyenCheckoutUtilityService($client);
try {
$response = $service->originKeys($params);
}
catch(\Exception $e){
$this->adyenLogger->error($e->getMessage());
}
$originKey = "";
......
......@@ -33,6 +33,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
<fieldset class="admin__fieldset payment-method" id="payment_form_<?php /* @noEscape */
echo $code; ?>" style="display:none">
<span id="noApiKey" class="message message-error error" style="visibility: hidden"><?php echo $block->escapeHtml(__('Please configure an API Key in your Adyen Required Settings'));?></span>
<div class="field admin__field">
<label for="<?php /* @noEscape */
echo $code; ?>_cc_owner">
......@@ -96,6 +97,10 @@ echo $code; ?>" style="display:none">
*/
var secureFieldsInitialize = function () {
if (!"<?php echo $block->getCheckoutOriginKeys(); ?>") {
document.getElementById('noApiKey').style="visibility: visible; display:inline-block";
return;
}
var cardNode = document.getElementById("cardContainer-<?php /* @noEscape */ echo $code; ?>");
var checkout = new AdyenCheckout({
......
......@@ -71,6 +71,9 @@ define(
renderSecureFields: function () {
var self = this;
self.placeOrderAllowed(false);
if (!self.getOriginKey()) {
return;
}
installments.setInstallments(0);
......
......@@ -206,6 +206,9 @@ define(
renderSecureCVC: function () {
var self = this;
if (!self.getOriginKey()) {
return;
}
var oneClickCardNode = document.getElementById('cvcContainer-' + self.value);
var checkout = new AdyenCheckout({
......
......@@ -39,6 +39,10 @@
<div class="payment-method-content">
<!-- ko ifnot: (getOriginKey()) -->
<span class="message message-error error"><!-- ko text: $t('Please configure an API Key in your Adyen Required Settings')--><!-- /ko --></span>
<!--/ko-->
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
......
......@@ -45,6 +45,10 @@
</div>
<div class="payment-method-content">
<!-- ko ifnot: (getOriginKey()) -->
<span class="message message-error error"><!-- ko text: $t('Please configure an API Key in your Adyen Required Settings')--><!-- /ko --></span>
<!--/ko-->
<!-- ko foreach: $parent.getRegion(getMessageName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment