Skip to content

Commit

Permalink
Card save fix
Browse files Browse the repository at this point in the history
  • Loading branch information
krzGablo committed Jan 24, 2024
1 parent 5e24e83 commit 9c2d455
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Model/Tpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public function getConfigData($field, $storeId = null)

public function getCardSaveEnabled(): bool
{
return false;
return (bool) $this->getConfigData('cardpayment_settings/card_save_enabled');
}

public function getCheckoutCustomerId(): ?string
Expand Down
6 changes: 6 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@
<comment>Find in Merchant’s panel: Credit cards payment -> API</comment>
<depends><field id="cardpayment_api_active">1</field></depends>
</field>
<field id="card_save_enabled" translate="label" type="select" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable credit card saving</label>
<comment>Only available for logged in users</comment>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<depends><field id="cardpayment_api_active">1</field></depends>
</field>
</group>
<group id="sale_settings" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Additional settings</label>
Expand Down
29 changes: 0 additions & 29 deletions view/frontend/web/js/view/payment/method-renderer/tpay-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,6 @@ define(
return window.checkoutConfig.tpay.payment.addCSS;
},

cardFetchJavaScripts: function () {
return window.checkoutConfig.tpaycards.payment.fetchJavaScripts;
},
cardGetRSAkey: function () {
return window.checkoutConfig.tpaycards.payment.getRSAkey;
},
cardGetLogoUrl: function () {
return window.checkoutConfig.tpay.payment.tpayCardsLogoUrl;
},
cardGetTpayLoadingGif: function () {
return window.checkoutConfig.tpaycards.payment.getTpayLoadingGif;
},
cardAddCSS: function () {
return window.checkoutConfig.tpaycards.payment.addCSS;
},

cardShowSaveBox: function () {
if (window.checkoutConfig.tpaycards.payment.isCustomerLoggedIn
&& window.checkoutConfig.tpaycards.payment.isSavingEnabled) {
$('#tpay-card-save-checkbox').css('display', 'block');
}
},

getData: function () {
var savedId = 'new';
$('input[id^=cardN]').each(function () {
Expand All @@ -89,12 +66,6 @@ define(
paymentData['blik_code'] = $('#blik_code').val();
paymentData['accept_tos'] = $('input[name="accept_tos"]').is(':checked');

paymentData['card_data'] = $('input[name="card_data"]').val();
paymentData['card_save'] = $('input[name="card_save"]').is(":checked");
paymentData['card_id'] = savedId;
paymentData['card_vendor'] = $('input[name="card_vendor"]').val();
paymentData['short_code'] = $('input[name="card_short_code"]').val();

return $.extend(true, parent, {'additional_data': paymentData});
},

Expand Down

0 comments on commit 9c2d455

Please sign in to comment.