From 85ec17cb74c7378a82a8cd063ebbc097d510a419 Mon Sep 17 00:00:00 2001 From: Lucian Turiac Date: Mon, 17 Oct 2022 12:08:24 +0300 Subject: [PATCH 1/2] BP-1977 - Wechatpay Refactor --- Gateway/Request/LocaleDataBuilder.php | 31 +++++++ etc/config.xml | 4 +- etc/di.xml | 119 +++++++++++++++++++++++++- 3 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 Gateway/Request/LocaleDataBuilder.php diff --git a/Gateway/Request/LocaleDataBuilder.php b/Gateway/Request/LocaleDataBuilder.php new file mode 100644 index 000000000..b3df6e46b --- /dev/null +++ b/Gateway/Request/LocaleDataBuilder.php @@ -0,0 +1,31 @@ + $this->getLocaleCode()]; + } + + private function getLocaleCode(): string + { + $country = $this->getOrder()->getBillingAddress()->getCountryId(); + + if ($country == 'CN') { + $localeCode = 'zh-CN'; + } elseif ($country == 'TW') { + $localeCode = 'zh-TW'; + } else { + $localeCode = 'en-US'; + } + return $localeCode; + } +} diff --git a/etc/config.xml b/etc/config.xml index 2a278215b..9c9d66c3f 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -768,7 +768,7 @@ 0 - Buckaroo\Magento2\Model\Method\Wechatpay + WechatpayFacade pending Buckaroo WeChatPay 0 @@ -903,7 +903,7 @@ 1 1 - + 0 CreditClickFacade diff --git a/etc/di.xml b/etc/di.xml index 24ae37c02..9828b17ee 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -617,7 +617,7 @@ BuckarooOrderRequest Buckaroo\Magento2\Gateway\Http\SDKTransferFactory - Buckaroo\Magento2\Gateway\Http\Client\TransactionPay + Buckaroo\Magento2\Gateway\Http\Client\TransactionPayRemainder OrderResponseHandler Buckaroo\Magento2\Gateway\Validator\ResponseCodeSDKValidator Buckaroo\Magento2\Gateway\ErrorMapper\VirtualErrorMessageMapper @@ -2757,4 +2757,121 @@ + + + + + + + Buckaroo\Magento2\Model\ConfigProvider\Method\Wechatpay::CODE + Magento\Payment\Block\Form + Buckaroo\Magento2\Block\Info + WechatpayValueHandlerPool + WechatpayValidatorPool + WechatpayGatewayCommandPool + true + + + + + + + + WechatpayConfigValueHandler + + + + + + + Buckaroo\Magento2\Model\ConfigProvider\Method\Wechatpay + + + + + + + + + WechatpayCountryValidator + + + + + + Buckaroo\Magento2\Model\ConfigProvider\Method\Wechatpay + + + + + + + + + WechatpayOrderCommand + BuckarooRefundCommand + + + + + + + + WechatpayOrderRequest + Buckaroo\Magento2\Gateway\Http\SDKTransferFactory + Buckaroo\Magento2\Gateway\Http\Client\TransactionPay + OrderResponseHandler + Buckaroo\Magento2\Gateway\Validator\ResponseCodeSDKValidator + Buckaroo\Magento2\Gateway\ErrorMapper\VirtualErrorMessageMapper + + + + + + + + BuckarooOrderRequest + Buckaroo\Magento2\Gateway\Request\LocaleDataBuilder + + + + + + + WechatpayBillingDataBuilder + WechatpayShippingDataBuilder + + + + + + + + Buckaroo\Magento2\Gateway\Request\Recipient\WechatpayDataBuilder + Buckaroo\Magento2\Gateway\Request\BillingAddressDataBuilder + Buckaroo\Magento2\Gateway\Request\PhoneDataBuilder + Buckaroo\Magento2\Gateway\Request\EmailAddressDataBuilder + + + + + + + + WechatpayShippingRecipientDataBuilder + Buckaroo\Magento2\Gateway\Request\ShippingAddressDataBuilder + PhoneShippingDataBuilder + EmailAddressShippingDataBuilder + + + + + + + shipping + + + + + From 096ccd02520cddbea378e7db24025fb4f24cd051 Mon Sep 17 00:00:00 2001 From: Lucian Turiac Date: Wed, 26 Oct 2022 11:54:49 +0300 Subject: [PATCH 2/2] Remove duplicate voucher item --- etc/di.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/etc/di.xml b/etc/di.xml index 0d4c858c3..38cc1327f 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -378,10 +378,6 @@ voucher Buckaroo\Magento2\Model\ConfigProvider\Method\Voucher - - voucher - Buckaroo\Magento2\Model\ConfigProvider\Method\Voucher -