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

Add GarantiPay v2 integration #160

Merged
merged 2 commits into from
Mar 22, 2024
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
3 changes: 2 additions & 1 deletion src/main/java/io/craftgate/model/PosApmPaymentProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public enum PosApmPaymentProvider {

YKB_WORLD_PAY,
YKB_WORLD_PAY_SHOPPING_LOAN,
GOOGLEPAY,
APPLEPAY
GARANTI_PAY,
}
37 changes: 37 additions & 0 deletions src/test/java/io/craftgate/sample/PaymentSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,43 @@ void init_ykb_world_pay_pos_apm_payment() {
assertEquals(AdditionalAction.SHOW_HTML_CONTENT, response.getAdditionalAction());
}

@Test
void init_garanti_pay_pos_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());

InitPosApmPaymentRequest request = InitPosApmPaymentRequest.builder()
.price(BigDecimal.ONE)
.paidPrice(BigDecimal.ONE)
.currency(Currency.TRY)
.paymentGroup(PaymentGroup.LISTING_OR_SUBSCRIPTION)
.conversationId("456d1297-908e-4bd6-a13b-4be31a6e47d5")
.paymentProvider(PosApmPaymentProvider.GARANTI_PAY)
.additionalParams(new HashMap() {{
put("integrationType", "WEB2APP");
}})
.callbackUrl("https://www.your-website.com/craftgate-pos-apm-callback")
.items(items)
.build();

InitPosApmPaymentResponse response = craftgate.payment().initPosApmPayment(request);
assertNotNull(response.getPaymentId());
assertNotNull(response.getAdditionalData().get("redirectUrl"));
assertEquals(PaymentStatus.WAITING, response.getPaymentStatus());
assertEquals(AdditionalAction.REDIRECT_TO_URL, response.getAdditionalAction());
}

@Test
void complete_pos_apm_payment() {
CompletePosApmPaymentRequest request = CompletePosApmPaymentRequest.builder()
Expand Down
Loading