Closed ChameleonDevil closed 2 years ago
@ChameleonDevil thank you, this request has been added to the backlog for review.
This will be included in the next release @ChameleonDevil
This will be included in the next release @ChameleonDevil
Thank you very much!
Since I have now been waiting for the next release mentioned here which is not available, and since I am forced to use v2.4.8
at the moment, I investigated $paymentTypes
further.
I do not see $paymentTypes
being used anywhere.
Inside PayWeb/Model/PayGate.php
function prepareFields()
does this:
if ($paymentType !== '0' && $this->getConfigData('paygate_pay_method_active') != '0') {
$fields['PAY_METHOD'] = $this->getPaymentType($paymentType); $fields['PAY_METHOD_DETAIL'] = $this->getPaymentTypeDetail($paymentType); }
getPaymentType():
public function getPaymentType($pt)
{
switch ($pt) {
case self::BANK_TRANSFER:
return self::BANK_TRANSFER;
break;
case self::ZAPPER_METHOD:
return 'EW';
break;
case self::SNAPSCAN_METHOD:
return 'EW';
break;
case self::MOBICRED_METHOD:
return 'EW';
break;
case self::MOMOPAY_METHOD:
return 'EW';
break;
case self::MASTERPASS_METHOD:
return 'EW';
break;
case self::PAYPAL_METHOD:
return 'EW';
break;
default:
return 'CC';
break;
}
}
getPaymentDetail():
public function getPaymentTypeDetail($ptd)
{
switch ($ptd) {
case self::BANK_TRANSFER:
return self::BANK_TRANSFER_METHOD_DETAIL;
break;
case self::ZAPPER_METHOD:
return self::ZAPPER_DESCRIPTION;
break;
case self::SNAPSCAN_METHOD:
return self::SNAPSCAN_DESCRIPTION;
break;
case self::MOBICRED_METHOD:
return self::MOBICRED_DESCRIPTION;
break;
case self::MOMOPAY_METHOD:
return self::MOMOPAY_METHOD_DETAIL;
break;
case self::MASTERPASS_METHOD:
return self::MASTERPASS_DESCRIPTION;
break;
case self::PAYPAL_METHOD:
return self::PAYPAL_DESCRIPTION;
break;
default:
return self::CREDIT_CARD_DESCRIPTION;
break;
}
}
At first when I opened this ticket I assumed it is that $paymentTypes inside /PayGate.php used, however I now realise this is not the case:
/view/frontend/web/template/payment/paygate.html
<!-- ko foreach: { data: JSON.parse(getPaymentTypesList()), as: 'option' }
This is referenced inside view/frontend/web/js/view/payment/method-renderer/paygate-method.js
:
getPaymentTypesList: function () {
var paymentTypes = window.checkoutConfig.payment.paygate.paymentTypeList
return paymentTypes
},
paymentTypeList
is defined in /PayWeb/Model/PaygateConfigProvider.php
:
'paymentTypeList' => $this->getPaymentTypes()
Relevant part inside PaygateConfigProvider->getPaymentTypes()
:
$allTypes = array(
'CC' => array(
'value' => 'CC',
'label' => "Card",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/mastercard-visa.svg'),
),
'BT' => array(
'value' => 'BT',
'label' => "SiD Secure EFT",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/sid.svg'),
),
'EW-ZAPPER' => array(
'value' => 'EW-ZAPPER',
'label' => "Zapper",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/zapper.svg'),
),
'EW-SNAPSCAN' => array(
'value' => 'EW-SNAPSCAN',
'label' => "SnapScan",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/snapscan.svg'),
),
'EW-MOBICRED' => array(
'value' => 'EW-MOBICRED',
'label' => "Mobicred",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/mobicred.svg'),
),
'EW-MOMOPAY' => array(
'value' => 'EW-MOMOPAY',
'label' => "MoMoPay",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/momopay.svg'),
),
'EW-MASTERPASS' => array(
'value' => 'EW-MASTERPASS',
'label' => "MasterPass",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/masterpass.svg'),
),
'EW-PAYPAL' => array(
'value' => 'EW-PAYPAL',
'label' => "PayPal",
'image' => $this->getViewFileUrl('PayGate_PayWeb::images/paypal.svg'),
)
In short:
Paygate->paymentTypes
is not used anywhere in v2.4.8....
but getPaymentTypeDetail()
converts paymentType
into its relevant label. This process seems to be on order creation which is not useful when trying to update frontend labels
PaygateConfigProvider->getPaymentTypes()
is using hard-coded Labels which would have been more useful if they actually referenced those constants in /Paygate.php ($paymentTypes)
.
Since I am using v2.4.8
there is no easy way to submit a Pull Request, as I will have to override both PayGate.php
and PaygateConfigProvider.php
I have a request from my company to change the text displayed for some of the payment options, and the current implementation of
PayWeb/Model/PayGate.php
uses constants for the descriptions:I would like to override the descriptions for these payment types inside
Model/PayGate.php
without changing anything else, so that any updates you do on this file in the future remains.I would like to request
static
to be used for these payment type descriptions instead ofself
:This means that I just change the values for the constants inside the overriding class, without having to completely change
protected $paymentTypes