Skip to content

Commit 1c15279

Browse files
authored
Merge pull request #26 from cmdotcom-plugins/release
Release
2 parents 0e93a28 + 9dd7c01 commit 1c15279

File tree

13 files changed

+486
-0
lines changed

13 files changed

+486
-0
lines changed

Api/Config/ConfigInterface.php

+18
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ interface ConfigInterface
3636
public const XML_PATH_PAYMENT_CREDIT_CARD_MODE = 'payment/cm_payments_creditcard/mode';
3737
public const XML_PATH_PAYMENT_CREDIT_CARD_ALLOWED_TYPES = 'payment/cm_payments_creditcard/allowed_cctypes';
3838
public const XML_PATH_PAYMENT_BANCONTACT_PROFILE = 'payment/cm_payments_bancontact/profile';
39+
public const XML_PATH_PAYMENT_BELFIUS_PROFILE = 'payment/cm_payments_belfius/profile';
40+
public const XML_PATH_PAYMENT_KBC_PROFILE = 'payment/cm_payments_kbc/profile';
3941
public const XML_PATH_PAYMENT_AFTERPAY_PROFILE = 'payment/cm_payments_afterpay/profile';
4042
public const XML_PATH_PAYMENT_APPLEPAY_PROFILE = 'payment/cm_payments_applepay/profile';
4143
public const XML_PATH_PAYMENT_GIFTCARD_PROFILE = 'payment/cm_payments_giftcard/profile';
@@ -122,6 +124,22 @@ public function getCreditCardPaymentProfile(): ?string;
122124
*/
123125
public function getBanContactPaymentProfile(): ?string;
124126

127+
/**
128+
* Get Payment Profile for Belfius Method
129+
*
130+
* @return ?string
131+
* @throws NoSuchEntityException
132+
*/
133+
public function getBelfiusPaymentProfile(): ?string;
134+
135+
/**
136+
* Get Payment Profile for KBC Method
137+
*
138+
* @return ?string
139+
* @throws NoSuchEntityException
140+
*/
141+
public function getKbcPaymentProfile(): ?string;
142+
125143
/**
126144
* Get Payment Profile for AfterPay Method
127145
*

Api/Service/MethodServiceInterface.php

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ interface MethodServiceInterface
2828
ConfigProvider::CODE_IDEAL,
2929
ConfigProvider::CODE_PAYPAL,
3030
ConfigProvider::CODE_BANCONTACT,
31+
ConfigProvider::CODE_BELFIUS,
32+
ConfigProvider::CODE_KBC,
3133
ConfigProvider::CODE_ELV,
3234
ConfigProvider::CODE_KLARNA,
3335
ConfigProvider::CODE_AFTERPAY,
@@ -46,6 +48,8 @@ interface MethodServiceInterface
4648
MethodServiceInterface::CM_METHOD_IDEAL => ConfigProvider::CODE_IDEAL,
4749
'PAYPAL_EXPRESS_CHECKOUT' => ConfigProvider::CODE_PAYPAL,
4850
'BANCONTACT' => ConfigProvider::CODE_BANCONTACT,
51+
'BELFIUS' => ConfigProvider::CODE_BELFIUS,
52+
'KBC' => ConfigProvider::CODE_KBC,
4953
'ELV' => ConfigProvider::CODE_ELV,
5054
'KLARNA' => ConfigProvider::CODE_KLARNA,
5155
'AFTERPAY_OPEN_INVOICE' => ConfigProvider::CODE_AFTERPAY,

Config/Config.php

+30
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ public function getPaymentProfile(string $paymentMethod = null): string
241241
case ConfigProvider::CODE_BANCONTACT:
242242
$paymentMethodProfile = $this->getBanContactPaymentProfile() ?? $defaultPaymentMethodProfile;
243243
break;
244+
case ConfigProvider::CODE_BELFIUS:
245+
$paymentMethodProfile = $this->getBelfiusPaymentProfile() ?? $defaultPaymentMethodProfile;
246+
break;
247+
case ConfigProvider::CODE_KBC:
248+
$paymentMethodProfile = $this->getKbcPaymentProfile() ?? $defaultPaymentMethodProfile;
249+
break;
244250
case ConfigProvider::CODE_AFTERPAY:
245251
$paymentMethodProfile = $this->getAfterPayPaymentProfile() ?? $defaultPaymentMethodProfile;
246252
break;
@@ -298,6 +304,30 @@ public function getBanContactPaymentProfile(): ?string
298304
);
299305
}
300306

307+
/**
308+
* @inheritDoc
309+
*/
310+
public function getBelfiusPaymentProfile(): ?string
311+
{
312+
return $this->getConfig(
313+
self::XML_PATH_PAYMENT_BELFIUS_PROFILE,
314+
ScopeInterface::SCOPE_STORES,
315+
(string)$this->storeManager->getStore()->getId()
316+
);
317+
}
318+
319+
/**
320+
* @inheritDoc
321+
*/
322+
public function getKbcPaymentProfile(): ?string
323+
{
324+
return $this->getConfig(
325+
self::XML_PATH_PAYMENT_KBC_PROFILE,
326+
ScopeInterface::SCOPE_STORES,
327+
(string)$this->storeManager->getStore()->getId()
328+
);
329+
}
330+
301331
/**
302332
* @inheritDoc
303333
*/

Controller/Payment/Notification.php

+5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ public function __construct(
7272
*/
7373
public function execute()
7474
{
75+
$this->logger->info(
76+
'CM Order Change notification.',
77+
['Params' => \json_encode($this->request->getParams())]
78+
);
79+
7580
/** @var Json $resultPage */
7681
$resultPage = $this->resultJsonFactory->create();
7782
$orderReference = $this->request->getParam('id');

Controller/Payment/Result.php

+6
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,28 @@ public function __construct(
107107
*/
108108
public function execute()
109109
{
110+
$this->logger->info('CM Order Result.', ['Params' => \json_encode($this->request->getParams())]);
111+
110112
$referenceOrderId = $this->request->getParam('order_reference');
111113
$status = $this->request->getParam('status');
112114

113115
try {
114116
if (!$status) {
117+
$this->logger->error('CM Order Result. Error: The Status is not presented in response!');
115118
throw new LocalizedException(__('The Status is not presented in response!'));
116119
}
117120

118121
if (!$referenceOrderId) {
122+
$this->logger->error('CM Order Result. Error: The order reference is not valid');
119123
throw new LocalizedException(__('The order reference is not valid!'));
120124
}
121125

122126
if (in_array($status, [OrderCreate::STATUS_ERROR, OrderCreate::STATUS_CANCELLED])) {
123127
if ($status === OrderCreate::STATUS_ERROR) {
128+
$this->logger->error('CM Order Result. Error: Your payment was cancelled because of errors!');
124129
throw new LocalizedException(__('Your payment was cancelled because of errors!'));
125130
} else {
131+
$this->logger->error('CM Order Result. Error: Your payment was cancelled!');
126132
throw new LocalizedException(__('Your payment was cancelled!'));
127133
}
128134
}

Model/ConfigProvider.php

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class ConfigProvider implements ConfigProviderInterface
3636
public const CODE_IDEAL = 'cm_payments_ideal';
3737
public const CODE_PAYPAL = 'cm_payments_paypal';
3838
public const CODE_BANCONTACT = 'cm_payments_bancontact';
39+
public const CODE_BELFIUS = 'cm_payments_belfius';
40+
public const CODE_KBC = 'cm_payments_kbc';
3941
public const CODE_ELV = 'cm_payments_elv';
4042
public const CODE_KLARNA = 'cm_payments_klarna';
4143
public const CODE_AFTERPAY = 'cm_payments_afterpay';

etc/adminhtml/system.xml

+216
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,222 @@
903903
</field>
904904
</group>
905905

906+
<group id="cm_payments_belfius" translate="label" type="text" sortOrder="70" showInDefault="1"
907+
showInWebsite="1" showInStore="1">
908+
<label>Belfius by CM.com</label>
909+
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
910+
showInStore="1" canRestore="1">
911+
<label>Enabled</label>
912+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
913+
<config_path>payment/cm_payments_belfius/active</config_path>
914+
</field>
915+
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
916+
showInStore="1" canRestore="1">
917+
<label>Title</label>
918+
<config_path>payment/cm_payments_belfius/title</config_path>
919+
<depends>
920+
<field id="active">1</field>
921+
</depends>
922+
</field>
923+
<field id="profile" translate="label comment" type="text" sortOrder="30" showInDefault="1"
924+
showInWebsite="1" showInStore="1">
925+
<label>Profile</label>
926+
<comment><![CDATA[Configure the CM.com Payment Profile to use. This profile should contain the available
927+
payment methods you want to show to the customer.]]></comment>
928+
<config_path>payment/cm_payments_belfius/profile</config_path>
929+
<depends>
930+
<field id="active">1</field>
931+
</depends>
932+
</field>
933+
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="40" showInDefault="1"
934+
showInWebsite="1" showInStore="1" canRestore="1">
935+
<label>Payment from Applicable Countries</label>
936+
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
937+
<config_path>payment/cm_payments_belfius/allowspecific</config_path>
938+
<depends>
939+
<field id="active">1</field>
940+
</depends>
941+
</field>
942+
<field id="specificcountry" translate="label" type="multiselect" sortOrder="50" showInDefault="1"
943+
showInWebsite="1" showInStore="1">
944+
<label>Payment from Specific Countries</label>
945+
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
946+
<can_be_empty>1</can_be_empty>
947+
<config_path>payment/cm_payments_belfius/specificcountry</config_path>
948+
<depends>
949+
<field id="active">1</field>
950+
</depends>
951+
</field>
952+
<field id="allow_specific_currency" translate="label" type="select" sortOrder="51" showInDefault="1"
953+
showInWebsite="1" showInStore="1" canRestore="1">
954+
<label>Payment in Applicable Currencies</label>
955+
<source_model>CM\Payments\Model\Adminhtml\Source\AllSpecificCurrencies</source_model>
956+
<config_path>payment/cm_payments_belfius/allow_specific_currency</config_path>
957+
<depends>
958+
<field id="active">1</field>
959+
</depends>
960+
</field>
961+
<field id="specific_currency" translate="label" type="multiselect" sortOrder="52" showInDefault="1"
962+
showInWebsite="1" showInStore="1">
963+
<label>Payment from Specific Currencies</label>
964+
<source_model>CM\Payments\Model\Adminhtml\Source\Currency</source_model>
965+
<can_be_empty>1</can_be_empty>
966+
<config_path>payment/cm_payments_belfius/specific_currency</config_path>
967+
<depends>
968+
<field id="active">1</field>
969+
</depends>
970+
</field>
971+
<field id="min_order_total" translate="label" type="text" sortOrder="60" showInDefault="1"
972+
showInWebsite="1" showInStore="1">
973+
<label>Minimum Order Total</label>
974+
<config_path>payment/cm_payments_belfius/min_order_total</config_path>
975+
<depends>
976+
<field id="active">1</field>
977+
</depends>
978+
</field>
979+
<field id="max_order_total" translate="label" type="text" sortOrder="70" showInDefault="1"
980+
showInWebsite="1" showInStore="1">
981+
<label>Maximum Order Total</label>
982+
<config_path>payment/cm_payments_belfius/max_order_total</config_path>
983+
<depends>
984+
<field id="active">1</field>
985+
</depends>
986+
</field>
987+
<field id="order_expiry_unit" translate="label" type="select" sortOrder="80" showInDefault="1"
988+
showInWebsite="1" showInStore="1" canRestore="1">
989+
<label>Order Expiry Unit</label>
990+
<source_model>CM\Payments\Model\Adminhtml\Source\OrderExpiryUnit</source_model>
991+
<config_path>payment/cm_payments_belfius/order_expiry_unit</config_path>
992+
<depends>
993+
<field id="active">1</field>
994+
</depends>
995+
</field>
996+
<field id="order_expiry_duration" translate="label" type="text" sortOrder="90" showInDefault="1"
997+
showInWebsite="1" showInStore="1" canRestore="1">
998+
<label>Order Expiry Duration</label>
999+
<config_path>payment/cm_payments_belfius/order_expiry_duration</config_path>
1000+
<depends>
1001+
<field id="active">1</field>
1002+
</depends>
1003+
</field>
1004+
<field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"
1005+
showInStore="1" canRestore="1">
1006+
<label>Sort Order</label>
1007+
<config_path>payment/cm_payments_belfius/sort_order</config_path>
1008+
<depends>
1009+
<field id="active">1</field>
1010+
</depends>
1011+
</field>
1012+
</group>
1013+
1014+
<group id="cm_payments_kbc" translate="label" type="text" sortOrder="70" showInDefault="1"
1015+
showInWebsite="1" showInStore="1">
1016+
<label>KBC by CM.com</label>
1017+
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
1018+
showInStore="1" canRestore="1">
1019+
<label>Enabled</label>
1020+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1021+
<config_path>payment/cm_payments_kbc/active</config_path>
1022+
</field>
1023+
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
1024+
showInStore="1" canRestore="1">
1025+
<label>Title</label>
1026+
<config_path>payment/cm_payments_kbc/title</config_path>
1027+
<depends>
1028+
<field id="active">1</field>
1029+
</depends>
1030+
</field>
1031+
<field id="profile" translate="label comment" type="text" sortOrder="30" showInDefault="1"
1032+
showInWebsite="1" showInStore="1">
1033+
<label>Profile</label>
1034+
<comment><![CDATA[Configure the CM.com Payment Profile to use. This profile should contain the available
1035+
payment methods you want to show to the customer.]]></comment>
1036+
<config_path>payment/cm_payments_kbc/profile</config_path>
1037+
<depends>
1038+
<field id="active">1</field>
1039+
</depends>
1040+
</field>
1041+
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="40" showInDefault="1"
1042+
showInWebsite="1" showInStore="1" canRestore="1">
1043+
<label>Payment from Applicable Countries</label>
1044+
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
1045+
<config_path>payment/cm_payments_kbc/allowspecific</config_path>
1046+
<depends>
1047+
<field id="active">1</field>
1048+
</depends>
1049+
</field>
1050+
<field id="specificcountry" translate="label" type="multiselect" sortOrder="50" showInDefault="1"
1051+
showInWebsite="1" showInStore="1">
1052+
<label>Payment from Specific Countries</label>
1053+
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
1054+
<can_be_empty>1</can_be_empty>
1055+
<config_path>payment/cm_payments_kbc/specificcountry</config_path>
1056+
<depends>
1057+
<field id="active">1</field>
1058+
</depends>
1059+
</field>
1060+
<field id="allow_specific_currency" translate="label" type="select" sortOrder="51" showInDefault="1"
1061+
showInWebsite="1" showInStore="1" canRestore="1">
1062+
<label>Payment in Applicable Currencies</label>
1063+
<source_model>CM\Payments\Model\Adminhtml\Source\AllSpecificCurrencies</source_model>
1064+
<config_path>payment/cm_payments_kbc/allow_specific_currency</config_path>
1065+
<depends>
1066+
<field id="active">1</field>
1067+
</depends>
1068+
</field>
1069+
<field id="specific_currency" translate="label" type="multiselect" sortOrder="52" showInDefault="1"
1070+
showInWebsite="1" showInStore="1">
1071+
<label>Payment from Specific Currencies</label>
1072+
<source_model>CM\Payments\Model\Adminhtml\Source\Currency</source_model>
1073+
<can_be_empty>1</can_be_empty>
1074+
<config_path>payment/cm_payments_kbc/specific_currency</config_path>
1075+
<depends>
1076+
<field id="active">1</field>
1077+
</depends>
1078+
</field>
1079+
<field id="min_order_total" translate="label" type="text" sortOrder="60" showInDefault="1"
1080+
showInWebsite="1" showInStore="1">
1081+
<label>Minimum Order Total</label>
1082+
<config_path>payment/cm_payments_kbc/min_order_total</config_path>
1083+
<depends>
1084+
<field id="active">1</field>
1085+
</depends>
1086+
</field>
1087+
<field id="max_order_total" translate="label" type="text" sortOrder="70" showInDefault="1"
1088+
showInWebsite="1" showInStore="1">
1089+
<label>Maximum Order Total</label>
1090+
<config_path>payment/cm_payments_kbc/max_order_total</config_path>
1091+
<depends>
1092+
<field id="active">1</field>
1093+
</depends>
1094+
</field>
1095+
<field id="order_expiry_unit" translate="label" type="select" sortOrder="80" showInDefault="1"
1096+
showInWebsite="1" showInStore="1" canRestore="1">
1097+
<label>Order Expiry Unit</label>
1098+
<source_model>CM\Payments\Model\Adminhtml\Source\OrderExpiryUnit</source_model>
1099+
<config_path>payment/cm_payments_kbc/order_expiry_unit</config_path>
1100+
<depends>
1101+
<field id="active">1</field>
1102+
</depends>
1103+
</field>
1104+
<field id="order_expiry_duration" translate="label" type="text" sortOrder="90" showInDefault="1"
1105+
showInWebsite="1" showInStore="1" canRestore="1">
1106+
<label>Order Expiry Duration</label>
1107+
<config_path>payment/cm_payments_kbc/order_expiry_duration</config_path>
1108+
<depends>
1109+
<field id="active">1</field>
1110+
</depends>
1111+
</field>
1112+
<field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"
1113+
showInStore="1" canRestore="1">
1114+
<label>Sort Order</label>
1115+
<config_path>payment/cm_payments_kbc/sort_order</config_path>
1116+
<depends>
1117+
<field id="active">1</field>
1118+
</depends>
1119+
</field>
1120+
</group>
1121+
9061122
<group id="cm_payments_elv" translate="label" type="text" sortOrder="80" showInDefault="1"
9071123
showInWebsite="1" showInStore="1">
9081124
<label>ELV by CM.com</label>

0 commit comments

Comments
 (0)