Closed ChameleonDevil closed 2 years ago
So in summary: paymentTypes
is not used at all, and several places different payment descriptions are used, some as constants, some as hard-coded information. I really hope a future version can improve on this for other users that may have similar requirements.
I had to end up throwing away a <preference />
override which was going to use paymentTypes
, instead I now made a <plugin />
to change descriptions:
\PayGate\PayWeb\Model\PaygateConfigProvider::getPaymentTypes ->
afterGetPaymentTypes() plugin
Summarized version:
I had to decode the JSON from getPaymentTypes()
and then update the payment types I needed, then re-encode JSON to return result.
NOTE: _updatePaymentTypes($paymentTypes)
(not shown here) is where all the logic is to parse the JSON and filter relevant payment types to be updated.
* @param \PayGate\PayWeb\Model\PaygateConfigProvider $subject
* @param string $json
* @return JSON JSON encoding string
*/
public function afterGetPaymentTypes(
\PayGate\PayWeb\Model\PaygateConfigProvider $subject,
string $json
) {
$paymentTypes = json_decode($json);
$this->_updatePaymentTypes($paymentTypes);
$json = json_encode($paymentTypes);
return $json;
}
@ChameleonDevil we're looking into this and will revert once we have feedback.
@ChameleonDevil just a quick update, the upcoming release will make use of these descriptions:
return array(
[
'value' => 'CC',
'label' => $this->paymentMethod->getPaymentTypeDescription('CC'),
],
[
'value' => 'BT',
'label' => $this->paymentMethod->getPaymentTypeDescription('BT'),
],
[
'value' => 'EW-ZAPPER',
'label' => $this->paymentMethod->getPaymentTypeDescription('EW-ZAPPER'),
],
[
'value' => 'EW-SNAPSCAN',
'label' => $this->paymentMethod->getPaymentTypeDescription('EW-SNAPSCAN'),
],
[
'value' => 'EW-MOBICRED',
'label' => $this->paymentMethod->getPaymentTypeDescription('EW-MOBICRED'),
],
[
'value' => 'EW-MOMOPAY',
'label' => $this->paymentMethod->getPaymentTypeDescription('EW-MOMOPAY'),
],
[
'value' => 'EW-SCANTOPAY',
'label' => $this->paymentMethod->getPaymentTypeDescription('EW-SCANTOPAY'),
],
[
'value' => 'EW-PAYPAL',
'label' => $this->paymentMethod->getPaymentTypeDescription('EW-PAYPAL'),
]
);
}`
The original topic mentioned here (which was closed) : Change paymentTypes in PayWeb/Model/PayGate.php to use static descriptions
At the time when I requested a change to use static descriptions I was still under the impression that
paymentTypes
have some use, but it turns out it is not used inv2.4.8
at all.So, since I have now been waiting for the next release mentioned which would include the above changes, this is still not available, and since I am forced to use
v2.4.8
at the moment, I investigated$paymentTypes
further and to make a solution for our use.I do not see
$paymentTypes
being used anywhere.Inside
PayWeb/Model/PayGate.php
functionprepareFields()
does this:getPaymentType():
getPaymentDetail():
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
This is referenced inside
view/frontend/web/js/view/payment/method-renderer/paygate-method.js
:paymentTypeList
is defined in/PayWeb/Model/PaygateConfigProvider.php
:Relevant part inside
PaygateConfigProvider->getPaymentTypes()
:In short:
Paygate->paymentTypes
is not used anywhere in v2.4.8....but
getPaymentTypeDetail()
convertspaymentType
into its relevant label. This process seems to be on order creation which is not useful when trying to update frontend labelsPaygateConfigProvider->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 bothPayGate.php
andPaygateConfigProvider.php