diff --git a/src/main/java/io/craftgate/adapter/BkmExpressPaymentAdapter.java b/src/main/java/io/craftgate/adapter/BkmExpressPaymentAdapter.java index d942ffd..e6cf7eb 100644 --- a/src/main/java/io/craftgate/adapter/BkmExpressPaymentAdapter.java +++ b/src/main/java/io/craftgate/adapter/BkmExpressPaymentAdapter.java @@ -27,4 +27,9 @@ public PaymentResponse retrievePayment(String ticketId) { String path = "/payment/v1/bkm-express/payments/" + ticketId; return HttpClient.get(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions), PaymentResponse.class); } + + public PaymentResponse retrievePaymentByToken(String token) { + String path = "/payment/v1/bkm-express/" + token; + return HttpClient.get(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions), PaymentResponse.class); + } } \ No newline at end of file diff --git a/src/main/java/io/craftgate/request/CompleteBkmExpressRequest.java b/src/main/java/io/craftgate/request/CompleteBkmExpressRequest.java index 033c967..66a610e 100644 --- a/src/main/java/io/craftgate/request/CompleteBkmExpressRequest.java +++ b/src/main/java/io/craftgate/request/CompleteBkmExpressRequest.java @@ -9,4 +9,5 @@ public class CompleteBkmExpressRequest { private boolean status; private String message; private String ticketId; + private String bkmExpressPaymentToken; } diff --git a/src/test/java/io/craftgate/sample/BkmExpressSample.java b/src/test/java/io/craftgate/sample/BkmExpressSample.java index 33207ac..53c743b 100644 --- a/src/test/java/io/craftgate/sample/BkmExpressSample.java +++ b/src/test/java/io/craftgate/sample/BkmExpressSample.java @@ -73,6 +73,21 @@ void complete_bkm_express() { assertNotNull(response.getOrderId()); } + @Test + void complete_bkm_express_by_token() { + + CompleteBkmExpressRequest completeBkmExpressRequest = CompleteBkmExpressRequest.builder() + .message("İşlem Başarılı") + .status(true) + .ticketId("7c0f7c89-e954-46d5-ad37-2a5c0b5f0356") + .bkmExpressPaymentToken("23f4e147-2c4e-4a2c-8a67-9c783d813b79") + .build(); + + PaymentResponse response = craftgate.bkmExpressPaymentAdapter().complete(completeBkmExpressRequest); + assertNotNull(response); + assertNotNull(response.getOrderId()); + } + @Test void retrieve_bkm_express_payment() { @@ -81,4 +96,13 @@ void retrieve_bkm_express_payment() { PaymentResponse response = craftgate.bkmExpressPaymentAdapter().retrievePayment(ticketId); assertNotNull(response); } + + @Test + void retrieve_bkm_express_payment_by_token() { + + String bkmExpressPaymentToken = "23f4e147-2c4e-4a2c-8a67-9c783d813b79"; + + PaymentResponse response = craftgate.bkmExpressPaymentAdapter().retrievePaymentByToken(bkmExpressPaymentToken); + assertNotNull(response); + } }