diff --git a/src/main/java/io/craftgate/model/ApmType.java b/src/main/java/io/craftgate/model/ApmType.java index 7e7e7c5c..f0c2ddc6 100644 --- a/src/main/java/io/craftgate/model/ApmType.java +++ b/src/main/java/io/craftgate/model/ApmType.java @@ -13,16 +13,17 @@ public enum ApmType { INSTANT_TRANSFER, STRIPE, TOMPAY, + TOM_FINANCE, MASLAK, ALFABANK, - TOM_FINANCE, PAYCELL, HASO, - FUND_TRANSFER, - CASH_ON_DELIVERY, METROPOL, MULTINET, MULTINET_GIFT, ISPAY, - CHIPPIN + CHIPPIN, + PAYMOB, + FUND_TRANSFER, + CASH_ON_DELIVERY } diff --git a/src/main/java/io/craftgate/model/Currency.java b/src/main/java/io/craftgate/model/Currency.java index b2393b80..eda314b1 100644 --- a/src/main/java/io/craftgate/model/Currency.java +++ b/src/main/java/io/craftgate/model/Currency.java @@ -17,5 +17,6 @@ public enum Currency { SAR, BHD, RUB, - JPY + JPY, + EGP } diff --git a/src/main/java/io/craftgate/model/PaymentProvider.java b/src/main/java/io/craftgate/model/PaymentProvider.java index 6148342c..43bff5bd 100644 --- a/src/main/java/io/craftgate/model/PaymentProvider.java +++ b/src/main/java/io/craftgate/model/PaymentProvider.java @@ -30,5 +30,7 @@ public enum PaymentProvider { METROPOL, MULTINET, ISPAY, + CHIPPIN, + PAYMOB, OFFLINE, } diff --git a/src/test/java/io/craftgate/sample/PaymentSample.java b/src/test/java/io/craftgate/sample/PaymentSample.java index 90d817b2..e63561ed 100644 --- a/src/test/java/io/craftgate/sample/PaymentSample.java +++ b/src/test/java/io/craftgate/sample/PaymentSample.java @@ -1315,6 +1315,38 @@ void init_chippin_apm_payment() { assertEquals(ApmAdditionalAction.WAIT_FOR_WEBHOOK, response.getAdditionalAction()); } + + @Test + void init_paymob_apm_payment() { + List items = new ArrayList<>(); + + items.add(PaymentItem.builder() + .name("item 1") + .externalId(UUID.randomUUID().toString()) + .price(BigDecimal.TEN) + .build()); + + InitApmPaymentRequest request = InitApmPaymentRequest.builder() + .apmType(ApmType.PAYMOB) + .price(BigDecimal.TEN) + .paidPrice(BigDecimal.TEN) + .currency(Currency.EGP) + .paymentGroup(PaymentGroup.LISTING_OR_SUBSCRIPTION) + .conversationId("conversationId") + .externalId("externalId") + .callbackUrl("https://www.your-website.com/craftgate-apm-callback") + .items(items) + .additionalParams(new HashMap() {{ + put("integrationId", "11223344"); + }}) + .build(); + + ApmPaymentInitResponse response = craftgate.payment().initApmPayment(request); + assertNotNull(response.getPaymentId()); + assertEquals(PaymentStatus.WAITING, response.getPaymentStatus()); + assertEquals(ApmAdditionalAction.REDIRECT_TO_URL, response.getAdditionalAction()); + } + @Test void init_ykb_world_pay_pos_apm_payment() { List items = new ArrayList<>();