From ac402aa749ea4e41cc11f172f242e2a3ebd4d047 Mon Sep 17 00:00:00 2001 From: felixojiambo Date: Mon, 16 Dec 2024 08:44:03 +0300 Subject: [PATCH] common interface that all payment gateway clients will implement --- .../gateways/PaymentGateway.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 payment-service/src/main/java/com/finpay/payment_service/gateways/PaymentGateway.java diff --git a/payment-service/src/main/java/com/finpay/payment_service/gateways/PaymentGateway.java b/payment-service/src/main/java/com/finpay/payment_service/gateways/PaymentGateway.java new file mode 100644 index 0000000..82fb05c --- /dev/null +++ b/payment-service/src/main/java/com/finpay/payment_service/gateways/PaymentGateway.java @@ -0,0 +1,25 @@ +package com.finpay.payment_service.gateways; + +import com.finpay.payment_service.dtos.PaymentRequest; +import com.finpay.payment_service.dtos.PaymentGatewayResponse; +import com.finpay.payment_service.dtos.RefundRequest; +import com.finpay.payment_service.dtos.RefundGatewayResponse; + +public interface PaymentGateway { + + /** + * Processes a payment through the specific gateway. + * + * @param paymentRequest The payment details. + * @return The response from the payment gateway. + */ + PaymentGatewayResponse processPayment(PaymentRequest paymentRequest); + + /** + * Processes a refund through the specific gateway. + * + * @param refundRequest The refund details. + * @return The response from the refund gateway. + */ + RefundGatewayResponse processRefund(RefundRequest refundRequest); +}