@@ -1659,6 +1659,58 @@ void init_garanti_pay_pos_apm_payment() {
1659
1659
assertEquals (AdditionalAction .REDIRECT_TO_URL , response .getAdditionalAction ());
1660
1660
}
1661
1661
1662
+ @ Test
1663
+ void init_setcard_apm_payment () {
1664
+ List <PaymentItem > items = new ArrayList <>();
1665
+
1666
+ items .add (PaymentItem .builder ()
1667
+ .name ("item 1" )
1668
+ .externalId (UUID .randomUUID ().toString ())
1669
+ .price (BigDecimal .valueOf (0.6 ))
1670
+ .build ());
1671
+
1672
+ items .add (PaymentItem .builder ()
1673
+ .name ("item 2" )
1674
+ .externalId (UUID .randomUUID ().toString ())
1675
+ .price (BigDecimal .valueOf (0.4 ))
1676
+ .build ());
1677
+
1678
+ Map <String , String > additionalParams = new HashMap <>();
1679
+ additionalParams .put ("cardNumber" , "7599640961180814" );
1680
+
1681
+ InitApmPaymentRequest request = InitApmPaymentRequest .builder ()
1682
+ .apmType (ApmType .SETCARD )
1683
+ .price (BigDecimal .ONE )
1684
+ .paidPrice (BigDecimal .ONE )
1685
+ .currency (Currency .TRY )
1686
+ .callbackUrl ("https://www.your-website.com/craftgate-3DSecure-callback" )
1687
+ .paymentGroup (PaymentGroup .LISTING_OR_SUBSCRIPTION )
1688
+ .conversationId ("conversationId" )
1689
+ .externalId ("externalId" )
1690
+ .additionalParams (additionalParams )
1691
+ .items (items )
1692
+ .build ();
1693
+
1694
+ ApmPaymentInitResponse response = craftgate .payment ().initApmPayment (request );
1695
+ assertNotNull (response .getPaymentId ());
1696
+ assertEquals (PaymentStatus .WAITING , response .getPaymentStatus ());
1697
+ assertEquals (ApmAdditionalAction .OTP_REQUIRED , response .getAdditionalAction ());
1698
+ }
1699
+
1700
+ @ Test
1701
+ void complete_setcard_pos_apm_payment () {
1702
+ CompleteApmPaymentRequest request = CompleteApmPaymentRequest .builder ()
1703
+ .paymentId (1L )
1704
+ .additionalParams (new HashMap <String , String >() {{
1705
+ put ("otpCode" , "123456" );
1706
+ }})
1707
+ .build ();
1708
+
1709
+ ApmPaymentCompleteResponse response = craftgate .payment ().completeApmPayment (request );
1710
+ assertNotNull (response .getPaymentId ());
1711
+ assertEquals (PaymentStatus .SUCCESS , response .getPaymentStatus ());
1712
+ }
1713
+
1662
1714
@ Test
1663
1715
void complete_pos_apm_payment () {
1664
1716
CompletePosApmPaymentRequest request = CompletePosApmPaymentRequest .builder ()
0 commit comments