Skip to content

Commit ea9126e

Browse files
Merge branch 'master' into routing-options
2 parents 4329eee + 6a5e0db commit ea9126e

File tree

4 files changed

+78
-4
lines changed

4 files changed

+78
-4
lines changed

src/main/java/io/craftgate/adapter/PaymentAdapter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,16 @@ public BnplPaymentVerifyResponse verifyBnplPayment(Long paymentId) {
264264
return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions), BnplPaymentVerifyResponse.class);
265265
}
266266

267+
public BnplLimitInquiryResponse bnplLimitInquiryInit(BnplLimitInquiryRequest bnplLimitInquiryRequest) {
268+
String path = "/payment/v1/bnpl-payments/limit-inquiry/init";
269+
return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(bnplLimitInquiryRequest, path, requestOptions), BnplLimitInquiryResponse.class);
270+
}
271+
272+
public BnplLimitInquiryResponse bnplLimitInquiry(BnplLimitInquiryRequest bnplLimitInquiryRequest) {
273+
String path = "/payment/v1/bnpl-payments/limit-inquiry";
274+
return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(bnplLimitInquiryRequest, path, requestOptions), BnplLimitInquiryResponse.class);
275+
}
276+
267277
public InstantTransferBanksResponse retrieveActiveBanks() {
268278
String path = "/payment/v1/instant-transfer-banks";
269279
return HttpClient.get(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions),
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package io.craftgate.request;
2+
3+
import io.craftgate.model.ApmType;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Builder;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
import java.util.Map;
10+
11+
@Data
12+
@Builder
13+
@AllArgsConstructor
14+
@NoArgsConstructor
15+
public class BnplLimitInquiryRequest {
16+
17+
private ApmType apmType;
18+
private Long merchantApmId;
19+
private Map<String, Object> additionalParams;
20+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.craftgate.response;
2+
3+
import io.craftgate.model.ApmAdditionalAction;
4+
import io.craftgate.model.PaymentStatus;
5+
import lombok.Data;
6+
7+
import java.util.Map;
8+
9+
@Data
10+
public class BnplLimitInquiryResponse {
11+
12+
private PaymentStatus paymentStatus;
13+
private ApmAdditionalAction additionalAction;
14+
private Map<String, Object> additionalData;
15+
private String errorCode;
16+
private String errorMessage;
17+
}

src/test/java/io/craftgate/sample/BnplPaymentSample.java

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
import io.craftgate.model.Currency;
77
import io.craftgate.model.PaymentGroup;
88
import io.craftgate.request.BnplPaymentOfferRequest;
9+
import io.craftgate.request.BnplLimitInquiryRequest;
910
import io.craftgate.request.InitBnplPaymentRequest;
1011
import io.craftgate.request.dto.BnplPaymentCartItem;
1112
import io.craftgate.request.dto.PaymentItem;
12-
import io.craftgate.response.BnplPaymentOfferResponse;
13-
import io.craftgate.response.BnplPaymentVerifyResponse;
14-
import io.craftgate.response.InitBnplPaymentResponse;
15-
import io.craftgate.response.PaymentResponse;
13+
import io.craftgate.response.*;
1614
import io.craftgate.response.dto.BnplBankOffer;
1715
import org.junit.jupiter.api.Test;
1816

@@ -113,6 +111,35 @@ void init_bnpl_payment() {
113111
assertNotNull(response.getRedirectUrl());
114112
}
115113

114+
@Test
115+
void init_bnpl_limit_inquiry() {
116+
BnplLimitInquiryRequest request = BnplLimitInquiryRequest.builder()
117+
.apmType(ApmType.ZIP)
118+
.additionalParams(new HashMap<String, Object>() {{
119+
put("buyerPhoneNumber", "5320000000");
120+
put("buyerIdentityNumber", "11111111110");
121+
put("buyerBirthdate", "1990-01-01");
122+
}})
123+
.build();
124+
125+
BnplLimitInquiryResponse response = craftgate.payment().bnplLimitInquiryInit(request);
126+
assertNotNull(response);
127+
}
128+
129+
@Test
130+
void complete_bnpl_limit_inquiry() {
131+
BnplLimitInquiryRequest request = BnplLimitInquiryRequest.builder()
132+
.apmType(ApmType.ZIP)
133+
.additionalParams(new HashMap<String, Object>() {{
134+
put("buyerPhoneNumber", "5320000000");
135+
put("otpCode", "123456");
136+
}})
137+
.build();
138+
139+
BnplLimitInquiryResponse response = craftgate.payment().bnplLimitInquiry(request);
140+
assertNotNull(response);
141+
}
142+
116143
@Test
117144
void init_tom_finance_bnpl_payment() {
118145
BigDecimal price = new BigDecimal("100");

0 commit comments

Comments
 (0)