Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.generalbytes.batm.server.extensions.communication.ICommunicationProvider;
import com.generalbytes.batm.server.extensions.communication.IPhoneLookupProvider;
import com.generalbytes.batm.server.extensions.communication.voicecall.IVoiceCallProvider;
import com.generalbytes.batm.server.extensions.payment.external.IExternalPaymentProvider;
import com.generalbytes.batm.server.extensions.travelrule.ITravelRuleProvider;
import com.generalbytes.batm.server.extensions.travelrule.ITravelRuleProviderFactory;
import com.generalbytes.batm.server.extensions.travelrule.IWalletTypeEvaluationProvider;
Expand Down Expand Up @@ -86,6 +87,15 @@ public interface IExtension {
*/
IPaymentProcessor createPaymentProcessor(String paymentProcessorLogin);

/**
* This method is used for creating implementation of an external payment provider
*
* @see com.generalbytes.batm.server.extensions.payment.external.IExternalPaymentProvider
*/
default IExternalPaymentProvider createExternalPaymentProvider() {
return null;
}

/**
* This method is used for creating implementation of coin price source
* @param sourceLogin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.generalbytes.batm.server.extensions.payment.external;

import lombok.Data;

/**
* Represents the details of an external payment created using a third-party payment provider.
* This class typically encapsulates information required to complete the payment, such as the
* link (URL) to redirect the customer for payment processing.
*/
@Data
public class ExternalPaymentDetails {

/**
* URL to redirect the customer to for payment processing.
*/
private String paymentLink;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.generalbytes.batm.server.extensions.payment.external;

import com.generalbytes.batm.common.currencies.FiatCurrency;
import lombok.Data;

import java.math.BigDecimal;

/**
* Represents an external payment request containing payment and transaction identifications and amount details.
*/
@Data
public class ExternalPaymentRequest {

/**
* Not null unique identifier (UUID) of the payment. Used to reference the payment.
*
*/
private String externalPaymentId;

/**
* Not null transaction identifier (RID).
*/
private String remoteTransactionId;

/**
* Not null payment amount in fiat currency.
*/
private BigDecimal fiatAmount;

/**
* Not null fiat currency of the payment amount.
*/
private FiatCurrency fiatCurrency;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.generalbytes.batm.server.extensions.payment.external;

/**
* Interface for payment providers that can be used to initiate payments outside BATM.
* For example, by using a third-party payment gateway and redirecting the customer to their payment website.
*/
public interface IExternalPaymentProvider {

/**
* Name of the payment provider that can be noted in CAS.
*/
String getPublicName();

/**
* Initiates an external payment session based on the provided request.
* <p>
* <b>Warning:</b> The payment session initiated by this call should expire before the order expires in CAS (see CAS configuration).
* @param request details of the payment to be initiated
* @return details of the initiated payment session (typically a payment link)
*/
ExternalPaymentDetails initiateExternalPayment(ExternalPaymentRequest request);
}