Skip to content

Commit

Permalink
Update Manuel Refund Service
Browse files Browse the repository at this point in the history
  • Loading branch information
Mustafa Özcan committed Jan 14, 2025
1 parent cd635e7 commit 5fecdd4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/craftgate/adapter/PaymentAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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<PaymentTransactionRefundResponse> {

}
12 changes: 12 additions & 0 deletions src/test/java/io/craftgate/sample/PaymentSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5fecdd4

Please sign in to comment.