@@ -227,6 +227,41 @@ public function testCreate3DPaymentRequestData()
227
227
$ this ->assertEquals ($ expectedData , $ actual );
228
228
}
229
229
230
+ /**
231
+ * @return void
232
+ */
233
+ public function testCreate3DPaymentImeceRequestData ()
234
+ {
235
+ $ order = [
236
+ 'id ' => '2020110828BC ' ,
237
+ 'email ' => 'samp@iexample.com ' ,
238
+ 'name ' => 'john doe ' ,
239
+ 'user_id ' => '1535 ' ,
240
+ 'ip ' => '192.168.1.0 ' ,
241
+ 'amount ' => 100.01 ,
242
+ 'installment ' => '0 ' ,
243
+ 'currency ' => 'TRY ' ,
244
+ 'success_url ' => 'http://localhost/finansbank-payfor/3d/response.php ' ,
245
+ 'fail_url ' => 'http://localhost/finansbank-payfor/3d/response.php ' ,
246
+ 'is_imece_card ' => true ,
247
+ ];
248
+
249
+ $ responseData = [
250
+ 'md ' => '1 ' ,
251
+ 'xid ' => '100000005xid ' ,
252
+ 'eci ' => '100000005eci ' ,
253
+ 'cavv ' => 'cavv ' ,
254
+ ];
255
+
256
+ $ pos = $ this ->pos ;
257
+ $ pos ->prepare ($ order , AbstractGateway::TX_PAY );
258
+
259
+ $ actual = $ this ->requestDataMapper ->create3DPaymentRequestData ($ pos ->getAccount (), $ pos ->getOrder (), AbstractGateway::TX_PAY , $ responseData );
260
+
261
+ $ expectedData = $ this ->getSample3DPaymentImeceRequestData ($ pos ->getAccount (), $ responseData );
262
+ $ this ->assertEquals ($ expectedData , $ actual );
263
+ }
264
+
230
265
/**
231
266
* @return void
232
267
*/
@@ -323,6 +358,23 @@ public function testGet3DFormData()
323
358
));
324
359
}
325
360
361
+ /**
362
+ * @dataProvider threeDFormDataProvider
363
+ */
364
+ public function testGet3DFormDataImece (AbstractGateway $ pos , array $ order , string $ txType , ?AbstractCreditCard $ card , array $ expectedResponse ): void
365
+ {
366
+ $ pos ->prepare ($ order , $ txType );
367
+ $ gatewayURL = $ this ->config ['banks ' ][$ pos ->getAccount ()->getBank ()]['urls ' ]['gateway ' ]['test ' ];
368
+
369
+ $ this ->assertSame ($ expectedResponse , $ this ->requestDataMapper ->create3DFormData (
370
+ $ pos ->getAccount (),
371
+ $ pos ->getOrder (),
372
+ $ txType ,
373
+ $ gatewayURL ,
374
+ $ card
375
+ ));
376
+ }
377
+
326
378
/**
327
379
* @return void
328
380
*/
@@ -429,6 +481,108 @@ public function testCreateRefundRequestData()
429
481
$ this ->assertEquals ($ expectedData , $ actual );
430
482
}
431
483
484
+ public static function threeDFormDataProvider (): iterable
485
+ {
486
+ $ threeDAccount = AccountFactory::createEstPosAccount (
487
+ 'akbank ' ,
488
+ '700655000200 ' ,
489
+ 'ISBANKAPI ' ,
490
+ 'ISBANK07 ' ,
491
+ AbstractGateway::MODEL_3D_SECURE ,
492
+ 'TRPS0200 '
493
+ );
494
+ $ order = [
495
+ 'id ' => 'order222 ' ,
496
+ 'ip ' => '127.0.0.1 ' ,
497
+ 'name ' => 'siparis veren ' ,
498
+ 'email ' => 'test@test.com ' ,
499
+ 'amount ' => '100.25 ' ,
500
+ 'installment ' => 0 ,
501
+ 'currency ' => 'TRY ' ,
502
+ 'success_url ' => 'https://domain.com/success ' ,
503
+ 'fail_url ' => 'https://domain.com/fail_url ' ,
504
+ 'lang ' => 'tr ' ,
505
+ 'rand ' => 'rand ' ,
506
+ 'is_imece_card ' => true ,
507
+ ];
508
+ $ threeDSecurePos = PosFactory::createPosGateway ($ threeDAccount );
509
+ $ card = CreditCardFactory::create ($ threeDSecurePos , '5555444433332222 ' , '22 ' , '01 ' , '123 ' , 'ahmet ' , AbstractCreditCard::CARD_TYPE_VISA );
510
+ yield 'imece_3d_secure ' => [
511
+ $ threeDSecurePos ,
512
+ $ order ,
513
+ AbstractGateway::TX_PAY ,
514
+ $ card ,
515
+ [
516
+ 'gateway ' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate ' ,
517
+ 'method ' => 'POST ' ,
518
+ 'inputs ' => [
519
+ 'clientid ' => '700655000200 ' ,
520
+ 'storetype ' => '3d ' ,
521
+ 'amount ' => '100.25 ' ,
522
+ 'oid ' => 'order222 ' ,
523
+ 'okUrl ' => 'https://domain.com/success ' ,
524
+ 'failUrl ' => 'https://domain.com/fail_url ' ,
525
+ 'rnd ' => 'rand ' ,
526
+ 'lang ' => 'tr ' ,
527
+ 'currency ' => '949 ' ,
528
+ 'taksit ' => '' ,
529
+ 'islemtipi ' => 'Auth ' ,
530
+ 'firmaadi ' => 'siparis veren ' ,
531
+ 'Email ' => 'test@test.com ' ,
532
+ 'cardType ' => '1 ' ,
533
+ 'pan ' => '5555444433332222 ' ,
534
+ 'Ecom_Payment_Card_ExpDate_Month ' => '01 ' ,
535
+ 'Ecom_Payment_Card_ExpDate_Year ' => '22 ' ,
536
+ 'cv2 ' => '123 ' ,
537
+ 'hash ' => 'S7UxUAohxaxzl35WxHyDfuQx0sg= ' ,
538
+ ],
539
+ ],
540
+ ];
541
+
542
+ $ threeDPayAccount = AccountFactory::createEstPosAccount (
543
+ 'akbank ' ,
544
+ '700655000200 ' ,
545
+ 'ISBANKAPI ' ,
546
+ 'ISBANK07 ' ,
547
+ AbstractGateway::MODEL_3D_PAY ,
548
+ 'TRPS0200 '
549
+ );
550
+
551
+ yield 'imece_3d_pay ' => [
552
+ PosFactory::createPosGateway ($ threeDPayAccount ),
553
+ $ order ,
554
+ AbstractGateway::TX_PAY ,
555
+ $ card ,
556
+ [
557
+ 'gateway ' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate ' ,
558
+ 'method ' => 'POST ' ,
559
+ 'inputs ' => [
560
+ 'clientid ' => '700655000200 ' ,
561
+ 'storetype ' => '3d_pay ' ,
562
+ 'amount ' => '100.25 ' ,
563
+ 'oid ' => 'order222 ' ,
564
+ 'okUrl ' => 'https://domain.com/success ' ,
565
+ 'failUrl ' => 'https://domain.com/fail_url ' ,
566
+ 'rnd ' => 'rand ' ,
567
+ 'lang ' => 'tr ' ,
568
+ 'currency ' => '949 ' ,
569
+ 'taksit ' => '' ,
570
+ 'islemtipi ' => 'Auth ' ,
571
+ 'firmaadi ' => 'siparis veren ' ,
572
+ 'Email ' => 'test@test.com ' ,
573
+ 'cardType ' => '1 ' ,
574
+ 'pan ' => '5555444433332222 ' ,
575
+ 'Ecom_Payment_Card_ExpDate_Month ' => '01 ' ,
576
+ 'Ecom_Payment_Card_ExpDate_Year ' => '22 ' ,
577
+ 'cv2 ' => '123 ' ,
578
+ 'IMCKOD ' => 'İmece Ürün Bilgisi ' ,
579
+ 'FDONEM ' => 'Faizsiz Dönem Bilgisi ' ,
580
+ 'hash ' => 'S7UxUAohxaxzl35WxHyDfuQx0sg= ' ,
581
+ ],
582
+ ],
583
+ ];
584
+ }
585
+
432
586
/**
433
587
* @param AbstractPosAccount $account
434
588
* @param $order
@@ -474,6 +628,41 @@ private function getSample3DPaymentRequestData(AbstractPosAccount $account, $ord
474
628
return $ requestData ;
475
629
}
476
630
631
+ /**
632
+ * @param AbstractPosAccount $account
633
+ * @param array $responseData
634
+ *
635
+ * @return array
636
+ */
637
+ private function getSample3DPaymentImeceRequestData (AbstractPosAccount $ account , array $ responseData ): array
638
+ {
639
+ return [
640
+ 'Name ' => $ account ->getUsername (),
641
+ 'Password ' => $ account ->getPassword (),
642
+ 'ClientId ' => $ account ->getClientId (),
643
+ 'Type ' => 'Auth ' ,
644
+ 'IPAddress ' => '192.168.1.0 ' ,
645
+ 'Email ' => 'samp@iexample.com ' ,
646
+ 'OrderId ' => '2020110828BC ' ,
647
+ 'UserId ' => '1535 ' ,
648
+ 'Total ' => '100.01 ' ,
649
+ 'Currency ' => '949 ' ,
650
+ 'Taksit ' => '' ,
651
+ 'Number ' => $ responseData ['md ' ],
652
+ 'PayerTxnId ' => $ responseData ['xid ' ],
653
+ 'PayerSecurityLevel ' => $ responseData ['eci ' ],
654
+ 'PayerAuthenticationCode ' => $ responseData ['cavv ' ],
655
+ 'Mode ' => 'P ' ,
656
+ 'Extra ' => [
657
+ 'IMCKOD ' => 'İmece Ürün Bilgisi ' ,
658
+ 'FDONEM ' => 'Faizsiz Dönem Bilgisi ' ,
659
+ ],
660
+ 'BillTo ' => [
661
+ 'Name ' => 'john doe ' ,
662
+ ],
663
+ ];
664
+ }
665
+
477
666
/**
478
667
* @param AbstractPosAccount $account
479
668
* @param $order
0 commit comments