Skip to content

Commit 9540f48

Browse files
committed
ci: add tests for mandates in cypress
1 parent b82bee6 commit 9540f48

File tree

1 file changed

+65
-57
lines changed
  • cypress-tests/cypress/e2e/configs/Payment

1 file changed

+65
-57
lines changed

cypress-tests/cypress/e2e/configs/Payment/Payload.js

Lines changed: 65 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
import {
22
customerAcceptance,
3-
singleUseMandateData,
4-
multiUseMandateData,
3+
connectorDetails as commonConnectorDetails,
54
} from "./Commons";
5+
import { getCustomExchange } from "./Modifiers";
6+
7+
const DUPLICATION_TIMEOUT = 30000; // 30 seconds
8+
9+
const singleUseMandateData = {
10+
customer_acceptance: customerAcceptance,
11+
mandate_type: {
12+
single_use: {
13+
amount: 8000,
14+
currency: "USD",
15+
},
16+
},
17+
};
18+
19+
const multiUseMandateData = {
20+
customer_acceptance: customerAcceptance,
21+
mandate_type: {
22+
multi_use: {
23+
amount: 8000,
24+
currency: "USD",
25+
},
26+
},
27+
};
628

729
const successfulNo3DSCardDetails = {
830
card_number: "4242424242424242",
@@ -24,24 +46,6 @@ const failedNo3DSCardDetails = {
2446
card_cvc: "123",
2547
};
2648

27-
const payment_method_data_no3ds = {
28-
card: {
29-
last4: "4242",
30-
card_type: "CREDIT",
31-
card_network: "Visa",
32-
card_issuer: "STRIPE PAYMENTS UK LIMITED",
33-
card_issuing_country: "UNITEDKINGDOM",
34-
card_isin: "424242",
35-
card_extended_bin: null,
36-
card_exp_month: "12",
37-
card_exp_year: "25",
38-
card_holder_name: "John Doe",
39-
payment_checks: null,
40-
authentication_data: null,
41-
},
42-
billing: null,
43-
};
44-
4549
export const connectorDetails = {
4650
card_pm: {
4751
PaymentIntent: {
@@ -179,7 +183,7 @@ export const connectorDetails = {
179183
Configs: {
180184
DELAY: {
181185
STATUS: true,
182-
TIMEOUT: 15000,
186+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
183187
},
184188
},
185189
Request: {
@@ -313,7 +317,7 @@ export const connectorDetails = {
313317
Configs: {
314318
DELAY: {
315319
STATUS: true,
316-
TIMEOUT: 15000,
320+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
317321
},
318322
},
319323
Request: {
@@ -336,7 +340,7 @@ export const connectorDetails = {
336340
Configs: {
337341
DELAY: {
338342
STATUS: true,
339-
TIMEOUT: 15000,
343+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
340344
},
341345
},
342346
Request: {
@@ -359,7 +363,7 @@ export const connectorDetails = {
359363
Configs: {
360364
DELAY: {
361365
STATUS: true,
362-
TIMEOUT: 15000,
366+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
363367
},
364368
TRIGGER_SKIP: true,
365369
},
@@ -383,7 +387,7 @@ export const connectorDetails = {
383387
Configs: {
384388
DELAY: {
385389
STATUS: true,
386-
TIMEOUT: 15000,
390+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
387391
},
388392
},
389393
Request: {
@@ -430,7 +434,7 @@ export const connectorDetails = {
430434
Configs: {
431435
DELAY: {
432436
STATUS: true,
433-
TIMEOUT: 15000,
437+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
434438
},
435439
},
436440
Request: {
@@ -452,7 +456,7 @@ export const connectorDetails = {
452456
Configs: {
453457
DELAY: {
454458
STATUS: true,
455-
TIMEOUT: 15000,
459+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
456460
},
457461
},
458462
Request: {
@@ -469,7 +473,7 @@ export const connectorDetails = {
469473
Configs: {
470474
DELAY: {
471475
STATUS: true,
472-
TIMEOUT: 15000,
476+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
473477
},
474478
},
475479
Request: {
@@ -486,7 +490,7 @@ export const connectorDetails = {
486490
Configs: {
487491
DELAY: {
488492
STATUS: true,
489-
TIMEOUT: 15000,
493+
TIMEOUT: DUPLICATION_TIMEOUT / 2, // 15 seconds
490494
},
491495
},
492496
Request: {
@@ -504,9 +508,8 @@ export const connectorDetails = {
504508
Configs: {
505509
DELAY: {
506510
STATUS: true,
507-
TIMEOUT: 15000,
511+
TIMEOUT: DUPLICATION_TIMEOUT,
508512
},
509-
TRIGGER_SKIP: true,
510513
},
511514
Request: {
512515
payment_method: "card",
@@ -528,9 +531,8 @@ export const connectorDetails = {
528531
Configs: {
529532
DELAY: {
530533
STATUS: true,
531-
TIMEOUT: 15000,
534+
TIMEOUT: DUPLICATION_TIMEOUT,
532535
},
533-
TRIGGER_SKIP: true,
534536
},
535537
Request: {
536538
payment_method: "card",
@@ -544,20 +546,15 @@ export const connectorDetails = {
544546
status: 200,
545547
body: {
546548
status: "succeeded",
547-
mandate_id: null,
548-
payment_method_data: payment_method_data_no3ds,
549-
payment_method: "card",
550-
connector: "payload",
551549
},
552550
},
553551
},
554552
MandateSingleUseNo3DSManualCapture: {
555553
Configs: {
556554
DELAY: {
557555
STATUS: true,
558-
TIMEOUT: 15000,
556+
TIMEOUT: DUPLICATION_TIMEOUT,
559557
},
560-
TRIGGER_SKIP: true,
561558
},
562559
Request: {
563560
payment_method: "card",
@@ -571,20 +568,15 @@ export const connectorDetails = {
571568
status: 200,
572569
body: {
573570
status: "requires_capture",
574-
mandate_id: null,
575-
payment_method_data: payment_method_data_no3ds,
576-
payment_method: "card",
577-
connector: "payload",
578571
},
579572
},
580573
},
581574
MandateMultiUseNo3DSAutoCapture: {
582575
Configs: {
583576
DELAY: {
584577
STATUS: true,
585-
TIMEOUT: 15000,
578+
TIMEOUT: DUPLICATION_TIMEOUT,
586579
},
587-
TRIGGER_SKIP: true,
588580
},
589581
Request: {
590582
payment_method: "card",
@@ -598,19 +590,15 @@ export const connectorDetails = {
598590
status: 200,
599591
body: {
600592
status: "succeeded",
601-
payment_method_data: payment_method_data_no3ds,
602-
payment_method: "card",
603-
connector: "payload",
604593
},
605594
},
606595
},
607596
MandateMultiUseNo3DSManualCapture: {
608597
Configs: {
609598
DELAY: {
610599
STATUS: true,
611-
TIMEOUT: 15000,
600+
TIMEOUT: DUPLICATION_TIMEOUT,
612601
},
613-
TRIGGER_SKIP: true,
614602
},
615603
Request: {
616604
payment_method: "card",
@@ -624,19 +612,15 @@ export const connectorDetails = {
624612
status: 200,
625613
body: {
626614
status: "requires_capture",
627-
payment_method_data: payment_method_data_no3ds,
628-
payment_method: "card",
629-
connector: "payload",
630615
},
631616
},
632617
},
633618
ZeroAuthPaymentIntent: {
634619
Configs: {
635620
DELAY: {
636621
STATUS: true,
637-
TIMEOUT: 15000,
622+
TIMEOUT: DUPLICATION_TIMEOUT,
638623
},
639-
TRIGGER_SKIP: true,
640624
},
641625
Request: {
642626
currency: "BRL",
@@ -652,9 +636,8 @@ export const connectorDetails = {
652636
Configs: {
653637
DELAY: {
654638
STATUS: true,
655-
TIMEOUT: 15000,
639+
TIMEOUT: DUPLICATION_TIMEOUT,
656640
},
657-
TRIGGER_SKIP: true,
658641
},
659642
Request: {
660643
payment_method: "card",
@@ -673,5 +656,30 @@ export const connectorDetails = {
673656
},
674657
},
675658
},
659+
660+
MITAutoCapture: getCustomExchange({
661+
Configs: {
662+
DELAY: {
663+
STATUS: true,
664+
TIMEOUT: DUPLICATION_TIMEOUT,
665+
},
666+
},
667+
...commonConnectorDetails.card_pm.MITAutoCapture,
668+
}),
669+
MITManualCapture: {
670+
Configs: {
671+
DELAY: {
672+
STATUS: true,
673+
TIMEOUT: DUPLICATION_TIMEOUT,
674+
},
675+
},
676+
Request: {},
677+
Response: {
678+
status: 200,
679+
body: {
680+
status: "requires_capture",
681+
},
682+
},
683+
},
676684
},
677685
};

0 commit comments

Comments
 (0)