Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds kaspi and KZT currency #138

Merged
merged 5 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/io/craftgate/model/ApmType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum ApmType {
PAYPAL,
KLARNA,
AFTERPAY,
KASPI,
STRIPE,
FUND_TRANSFER,
CASH_ON_DELIVERY
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/craftgate/model/Currency.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ public enum Currency {
CNY,
AED,
IQD,
AZN
AZN,
KZT
}
1 change: 1 addition & 0 deletions src/main/java/io/craftgate/model/PaymentMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ public enum PaymentMethod {
PAYPAL,
KLARNA,
AFTERPAY,
KASPI,
STRIPE
}
1 change: 1 addition & 0 deletions src/main/java/io/craftgate/model/PaymentProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public enum PaymentProvider {
PAYONEER,
SODEXO,
EDENRED,
KASPI,
YKB_WORLD_PAY,
APPLEPAY,
GOOGLEPAY,
Expand Down
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 @@ -1131,6 +1131,41 @@ void init_afterpay_apm_payment() {
assertEquals(ApmAdditionalAction.REDIRECT_TO_URL, response.getAdditionalAction());
}

@Test
void init_kaspi_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.KASPI)
.price(BigDecimal.ONE)
.paidPrice(BigDecimal.ONE)
.currency(Currency.KZT)
.paymentGroup(PaymentGroup.LISTING_OR_SUBSCRIPTION)
.conversationId("456d1297-908e-4bd6-a13b-4be31a6e47d5")
.externalId("optional-externalId")
.callbackUrl("https://www.your-website.com/craftgate-apm-callback")
.items(items)
.build();

ApmPaymentInitResponse response = craftgate.payment().initApmPayment(request);
assertNotNull(response.getPaymentId());
assertNotNull(response.getRedirectUrl());
assertEquals(PaymentStatus.WAITING, response.getPaymentStatus());
assertEquals(ApmAdditionalAction.REDIRECT_TO_URL, response.getAdditionalAction());
}

@Test
void init_ykb_world_pay_pos_apm_payment() {
List<PaymentItem> items = new ArrayList<>();
Expand Down