From 5fecdd4edcda058b7d4280758cecb66a8ee1bd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20=C3=96zcan?= Date: Tue, 14 Jan 2025 14:03:29 +0300 Subject: [PATCH] Update Manuel Refund Service --- .../java/io/craftgate/adapter/PaymentAdapter.java | 6 ++++++ .../PaymentTransactionRefundListResponse.java | 11 +++++++++++ src/test/java/io/craftgate/sample/PaymentSample.java | 12 ++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 src/main/java/io/craftgate/response/PaymentTransactionRefundListResponse.java diff --git a/src/main/java/io/craftgate/adapter/PaymentAdapter.java b/src/main/java/io/craftgate/adapter/PaymentAdapter.java index f663d68..c335348 100644 --- a/src/main/java/io/craftgate/adapter/PaymentAdapter.java +++ b/src/main/java/io/craftgate/adapter/PaymentAdapter.java @@ -148,6 +148,12 @@ public PaymentTransactionRefundResponse refundPaymentTransactionMarkAsRefunded(R refundPaymentTransactionMarkAsRefundedRequest, PaymentTransactionRefundResponse.class); } + public PaymentTransactionRefundListResponse refundPaymentMarkAsRefunded(RefundPaymentRequest refundPaymentRequest) { + String path = "/payment/v1/refunds/mark-as-refunded"; + return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(refundPaymentRequest, path, requestOptions), + refundPaymentRequest, PaymentTransactionRefundListResponse.class); + } + public PaymentRefundResponse refundPayment(RefundPaymentRequest refundPaymentRequest) { String path = "/payment/v1/refunds"; return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(refundPaymentRequest, path, requestOptions), diff --git a/src/main/java/io/craftgate/response/PaymentTransactionRefundListResponse.java b/src/main/java/io/craftgate/response/PaymentTransactionRefundListResponse.java new file mode 100644 index 0000000..ab5d29d --- /dev/null +++ b/src/main/java/io/craftgate/response/PaymentTransactionRefundListResponse.java @@ -0,0 +1,11 @@ +package io.craftgate.response; + +import io.craftgate.response.common.ListResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class PaymentTransactionRefundListResponse extends ListResponse { + +} diff --git a/src/test/java/io/craftgate/sample/PaymentSample.java b/src/test/java/io/craftgate/sample/PaymentSample.java index cdd12fa..c95b5f1 100644 --- a/src/test/java/io/craftgate/sample/PaymentSample.java +++ b/src/test/java/io/craftgate/sample/PaymentSample.java @@ -1628,6 +1628,18 @@ void refund_payment_transaction_mark_as_refunded() { assertEquals(RefundStatus.SUCCESS, response.getStatus()); } + @Test + void refund_payment_mark_as_refunded() { + RefundPaymentRequest request = RefundPaymentRequest.builder() + .paymentId(1024L) + .conversationId("456d1297-908e-4bd6-a13b-4be31a6e47d5") + .build(); + + PaymentTransactionRefundListResponse response = craftgate.payment().refundPaymentMarkAsRefunded(request); + assertNotNull(response); + assertFalse(response.getItems().isEmpty()); + } + @Test void store_card() { final StoreCardRequest storeCardRequest = StoreCardRequest.builder()