Skip to content

Commit

Permalink
Add Bizum Payment Method (#208)
Browse files Browse the repository at this point in the history
* Add Bizum Payment Method

* Add Bizum Payment Method

---------

Co-authored-by: Mustafa Özcan <[email protected]>
  • Loading branch information
mozcan and Mustafa Özcan authored Nov 26, 2024
1 parent 0016654 commit 65f2bf9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
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 @@ -24,6 +24,7 @@ public enum ApmType {
ISPAY,
CHIPPIN,
PAYMOB,
BIZUM,
FUND_TRANSFER,
CASH_ON_DELIVERY
}
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 @@ -32,5 +32,6 @@ public enum PaymentProvider {
ISPAY,
CHIPPIN,
PAYMOB,
BIZUM,
OFFLINE,
}
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 @@ -1315,6 +1315,43 @@ void init_chippin_apm_payment() {
assertEquals(ApmAdditionalAction.WAIT_FOR_WEBHOOK, response.getAdditionalAction());
}

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

Map<String, String> additionalParams = new HashMap<>();
additionalParams.put("buyerPhoneNumber", "34700000000");

InitApmPaymentRequest request = InitApmPaymentRequest.builder()
.apmType(ApmType.BIZUM)
.price(BigDecimal.ONE)
.paidPrice(BigDecimal.ONE)
.currency(Currency.EUR)
.paymentGroup(PaymentGroup.LISTING_OR_SUBSCRIPTION)
.conversationId("conversationId")
.externalId("externalId")
.additionalParams(additionalParams)
.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_paymob_apm_payment() {
Expand Down

0 comments on commit 65f2bf9

Please sign in to comment.