2323use Omise \Payment \Model \Config \Truemoney ;
2424use Omise \Payment \Model \Config \Alipayplus ;
2525use Omise \Payment \Model \Config \DuitnowOBW ;
26- use Omise \Payment \Model \Config \Pointsciti ;
2726use Omise \Payment \Model \Config \Installment ;
2827use Omise \Payment \Model \Config \Mobilebanking ;
2928use Omise \Payment \Model \Config \Rabbitlinepay ;
3029use Omise \Payment \Model \Config \PayPay ;
30+ use Omise \Payment \Model \Config \WeChatPay ;
3131
3232use Omise \Payment \Helper \OmiseMoney ;
33- use Omise \Payment \Helper \OmiseHelper as Helper ;
3433use Omise \Payment \Model \Config \Internetbanking ;
3534use Omise \Payment \Model \Config \Conveniencestore ;
3635use Magento \Payment \Gateway \Helper \SubjectReader ;
4342use Omise \Payment \Observer \MobilebankingDataAssignObserver ;
4443use Omise \Payment \Observer \InternetbankingDataAssignObserver ;
4544use Omise \Payment \Observer \ConveniencestoreDataAssignObserver ;
45+ use Omise \Payment \Helper \RequestHelper ;
4646
4747class APMBuilder implements BuilderInterface
4848{
@@ -107,14 +107,14 @@ class APMBuilder implements BuilderInterface
107107 const SOURCE_SHIPPING = 'shipping ' ;
108108
109109 /**
110- * @var \Omise\Payment\Helper\ReturnUrlHelper
110+ * @var string
111111 */
112- protected $ returnUrl ;
112+ const SOURCE_IP = ' ip ' ;
113113
114114 /**
115- * @var Helper
115+ * @var \Omise\Payment\ Helper\ReturnUrlHelper
116116 */
117- protected $ helper ;
117+ protected $ returnUrl ;
118118
119119 /**
120120 * @var OmiseMoney
@@ -131,22 +131,27 @@ class APMBuilder implements BuilderInterface
131131 */
132132 protected $ config ;
133133
134+ /**
135+ * @var \Omise\Payment\Helper\RequestHelper
136+ */
137+ private $ requestHelper ;
138+
134139 /**
135140 * @param $helper \Omise\Payment\Helper\OmiseHelper
136141 * @param $returnUrl \Omise\Payment\Helper\ReturnUrl
137142 */
138143 public function __construct (
139- Helper $ helper ,
140144 ReturnUrlHelper $ returnUrl ,
141145 Config $ config ,
142146 Capabilities $ capabilities ,
143- OmiseMoney $ money
147+ OmiseMoney $ money ,
148+ RequestHelper $ requestHelper
144149 ) {
145- $ this ->helper = $ helper ;
146150 $ this ->returnUrl = $ returnUrl ;
147151 $ this ->config = $ config ;
148152 $ this ->capabilities = $ capabilities ;
149153 $ this ->money = $ money ;
154+ $ this ->requestHelper = $ requestHelper ;
150155 }
151156
152157 /**
@@ -218,11 +223,6 @@ public function build(array $buildSubject)
218223 self ::SOURCE_TYPE => 'promptpay '
219224 ];
220225 break ;
221- case Pointsciti::CODE :
222- $ paymentInfo [self ::SOURCE ] = [
223- self ::SOURCE_TYPE => 'points_citi '
224- ];
225- break ;
226226 case Fpx::CODE :
227227 $ paymentInfo [self ::SOURCE ] = [
228228 self ::SOURCE_TYPE => 'fpx ' ,
@@ -234,43 +234,43 @@ public function build(array $buildSubject)
234234 case Alipayplus::ALIPAY_CODE :
235235 $ paymentInfo [self ::SOURCE ] = [
236236 self ::SOURCE_TYPE => 'alipay_cn ' ,
237- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
237+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
238238 ];
239239 break ;
240240 case Alipayplus::ALIPAYHK_CODE :
241241 $ paymentInfo [self ::SOURCE ] = [
242242 self ::SOURCE_TYPE => 'alipay_hk ' ,
243- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
243+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
244244 ];
245245 break ;
246246 case Alipayplus::DANA_CODE :
247247 $ paymentInfo [self ::SOURCE ] = [
248248 self ::SOURCE_TYPE => 'dana ' ,
249- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
249+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
250250 ];
251251 break ;
252252 case Alipayplus::GCASH_CODE :
253253 $ paymentInfo [self ::SOURCE ] = [
254254 self ::SOURCE_TYPE => 'gcash ' ,
255- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
255+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
256256 ];
257257 break ;
258258 case Alipayplus::KAKAOPAY_CODE :
259259 $ paymentInfo [self ::SOURCE ] = [
260260 self ::SOURCE_TYPE => 'kakaopay ' ,
261- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
261+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
262262 ];
263263 break ;
264264 case Touchngo::CODE :
265265 $ paymentInfo [self ::SOURCE ] = [
266266 self ::SOURCE_TYPE => 'touch_n_go ' ,
267- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
267+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
268268 ];
269269 break ;
270270 case Mobilebanking::CODE :
271271 $ paymentInfo [self ::SOURCE ] = [
272272 self ::SOURCE_TYPE => $ method ->getAdditionalInformation (MobilebankingDataAssignObserver::OFFSITE ),
273- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType ()
273+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType ()
274274 ];
275275 break ;
276276 case Rabbitlinepay::CODE :
@@ -281,19 +281,19 @@ public function build(array $buildSubject)
281281 case Ocbcpao::CODE :
282282 $ paymentInfo [self ::SOURCE ] = [
283283 self ::SOURCE_TYPE => 'mobile_banking_ocbc_pao ' ,
284- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
284+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
285285 ];
286286 break ;
287287 case OcbcDigital::CODE :
288288 $ paymentInfo [self ::SOURCE ] = [
289289 self ::SOURCE_TYPE => OcbcDigital::ID ,
290- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
290+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
291291 ];
292292 break ;
293293 case Grabpay::CODE :
294294 $ paymentInfo [self ::SOURCE ] = [
295295 self ::SOURCE_TYPE => 'grabpay ' ,
296- self ::PLATFORM_TYPE => $ this ->helper ->getPlatformType (),
296+ self ::PLATFORM_TYPE => $ this ->requestHelper ->getPlatformType (),
297297 ];
298298 break ;
299299 case Boost::CODE :
@@ -339,6 +339,12 @@ public function build(array $buildSubject)
339339 self ::SOURCE_TYPE => PayPay::ID ,
340340 ];
341341 break ;
342+ case WeChatPay::CODE :
343+ $ paymentInfo [self ::SOURCE ] = [
344+ self ::SOURCE_TYPE => WeChatPay::ID ,
345+ self ::SOURCE_IP => $ this ->requestHelper ->getClientIp ()
346+ ];
347+ break ;
342348 }
343349
344350 return $ paymentInfo ;
@@ -350,7 +356,7 @@ private function getShopeepaySource()
350356 $ isShopeepayEnabled = $ this ->capabilities ->isBackendEnabled (Shopeepay::ID );
351357
352358 // If user is in mobile and jump app is enabled then return shopeepay_jumpapp as source
353- if ($ this ->helper ->isMobilePlatform () && $ isShopeepayJumpAppEnabled ) {
359+ if ($ this ->requestHelper ->isMobilePlatform () && $ isShopeepayJumpAppEnabled ) {
354360 return Shopeepay::JUMPAPP_ID ;
355361 }
356362
0 commit comments