From 40afc869cbf6fd0b059ee4bca941129deb8806d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertu=C4=9Frul=20Berat=20ALLAHVERD=C4=B0?= Date: Mon, 30 Sep 2024 11:57:51 +0300 Subject: [PATCH] Add chippin as a new apm --- src/main/java/io/craftgate/model/ApmType.java | 3 +- .../io/craftgate/sample/PaymentSample.java | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/craftgate/model/ApmType.java b/src/main/java/io/craftgate/model/ApmType.java index 968dd7c8..7e7e7c5c 100644 --- a/src/main/java/io/craftgate/model/ApmType.java +++ b/src/main/java/io/craftgate/model/ApmType.java @@ -23,5 +23,6 @@ public enum ApmType { METROPOL, MULTINET, MULTINET_GIFT, - ISPAY + ISPAY, + CHIPPIN } diff --git a/src/test/java/io/craftgate/sample/PaymentSample.java b/src/test/java/io/craftgate/sample/PaymentSample.java index d861af4d..1e70c6f9 100644 --- a/src/test/java/io/craftgate/sample/PaymentSample.java +++ b/src/test/java/io/craftgate/sample/PaymentSample.java @@ -1279,6 +1279,41 @@ void init_tompay_apm_payment() { assertEquals(ApmAdditionalAction.WAIT_FOR_WEBHOOK, response.getAdditionalAction()); } + @Test + void init_chippin_apm_payment() { + List items = new ArrayList<>(); + + items.add(PaymentItem.builder() + .name("item 1") + .externalId(UUID.randomUUID().toString()) + .price(BigDecimal.valueOf(0.6)) + .build()); + + items.add(PaymentItem.builder() + .name("item 2") + .externalId(UUID.randomUUID().toString()) + .price(BigDecimal.valueOf(0.4)) + .build()); + + InitApmPaymentRequest request = InitApmPaymentRequest.builder() + .apmType(ApmType.CHIPPIN) + .apmUserIdentity("1000000") // Chippin Kullanıcı numarası + .price(BigDecimal.ONE) + .paidPrice(BigDecimal.ONE) + .currency(Currency.TRY) + .paymentGroup(PaymentGroup.LISTING_OR_SUBSCRIPTION) + .conversationId("conversationId") + .externalId("externalId") + .callbackUrl("https://www.your-website.com/craftgate-apm-callback") + .items(items) + .build(); + + ApmPaymentInitResponse response = craftgate.payment().initApmPayment(request); + assertNotNull(response.getPaymentId()); + assertEquals(PaymentStatus.WAITING, response.getPaymentStatus()); + assertEquals(ApmAdditionalAction.WAIT_FOR_WEBHOOK, response.getAdditionalAction()); + } + @Test void init_ykb_world_pay_pos_apm_payment() { List items = new ArrayList<>();