Skip to content

Commit

Permalink
Add chippin as a new apm (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
beratallahverdi authored Sep 30, 2024
1 parent f814ac3 commit de8cb65
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/io/craftgate/model/ApmType.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ public enum ApmType {
METROPOL,
MULTINET,
MULTINET_GIFT,
ISPAY
ISPAY,
CHIPPIN
}
35 changes: 35 additions & 0 deletions src/test/java/io/craftgate/sample/PaymentSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,41 @@ void init_tompay_apm_payment() {
assertEquals(ApmAdditionalAction.WAIT_FOR_WEBHOOK, response.getAdditionalAction());
}

@Test
void init_chippin_apm_payment() {
List<PaymentItem> 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<PaymentItem> items = new ArrayList<>();
Expand Down

0 comments on commit de8cb65

Please sign in to comment.