The page describes the extension point details for the Payment microservice.
Overview
Payment is a microservice that just has the business logic and data layer access to save and fetch data. The actual requirement of Payment is to validate the given payment details and do actions like PreAuthorize, Cancel PreAuthorize, Authorize, Cancel Authorize, Charge, Refund, etc. These can be done only by connecting to the third-party services depending upon the type of payment (e.g. Card, Loyalty, etc.).
Payment Processors
The interface which needs to be used to write an extension for the different third-party services is PaymentProcessor. Below are the methods that are defined in the interface and its use.
boolean supportsOp(int op)
: This method tells if a particular operation is supported by the third-party service or not. For example, Cybersource does not support PreAuthorize and Cancel PreAuthorize. So this method returns false for those operations.boolean isBillingAddressRequired()
: This method tells if the billing address is required for the third-party service or not. For example, the credit card needs billing address but not needed by the loyalty. So this method returns the boolean accordingly.boolean checkIfRequiredPropertiesExists(Map<String, Object> otherProperties)
: This method validates if required properties exist for the token generation or not.boolean checkIfBillingAddressUpdateReqNewToken()
: This method tells if the billing address is updated, does it require a new token generation or not.boolean checkIfPaymentDetailsCanUpdate(Map<String, Object> otherProperties)
: This method tells if the payment details are updated, does it require a new token generation or not.PaymentProcessorResponse createPaymentProfile(PaymentInfo paymentInfo, String currency)
: This method is used to create a token for the given payment details.PaymentProcessorResponse updatePaymentProfile(PaymentInfo paymentInfo, String paymentCode)
: This method is used to update the for the given payment details in the existing token. This might generate a new token depending on the third-party service.PaymentProcessorResponse retrievePayment(String paymentCode, Map<String, Object> otherProperties)
: This method is used to retrieve the payment details for the given token. The Payment service always stores the token of a payment but not any PCI data. So to render the details in the response, this method helps in retrieving them from the third-party service.PaymentProcessorResponse scrubSecureData(String paymentCode, Map<String, Object> otherProperties)
: This method is used to remove the PCI data.PaymentProcessorResponse preAuthorize(String paymentCode, BigDecimal amount, Map<String, Object> otherProperties)
: This method is used to pre-authorize the provided payment. This depends on the third-party service if they have this operation or not. For example, the card payment does not need any pre-authorization. But for the loyalty, this method can be used to check if the provided points are existing for the user or not.PaymentProcessorResponse authorize(String paymentCode, BigDecimal amount, Map<String, Object> otherProperties)
: This method is used to authorize the provided amount in an order.PaymentProcessorResponse cancelAuthorization(String authorizationCode, String paymentCode, BigDecimal amount, Map<String, Object> otherProperties)
: This method is used to cancel the authorized amount.PaymentProcessorResponse charge(String authorizationCode, String paymentCode, BigDecimal amount, Map<String, Object> otherProperties)
: This method is used to charge the amount that authorized. For some third-party services, the charge can be done directly without authorizing. This method will be called during the shipment of the product.PaymentProcessorResponse refund(String authorizationCode, String paymentCode, BigDecimal amount, Map<String, Object> otherProperties)
: This method is used to refund the specific amount which is charged. This method will be called during the product return.
The following is a list of currently existing Payment processors:
DefaultPaymentProcessor
: exists in the payment service itself. This will always return success for all the methods and supports all the payment types.CyberSourceCreditCardProcessor
: supports credit and debit card payments. This processor supports Authorize, Cancel Authorize, Charge, and Refund operations.Cybersource
: supports the payment gateway.
These payment processors can be accessed by creating an entry in the ProviderMaster entity of the Payment microservice. All the settings related to the third-party service need to be mentioned in its properties with defined keys. The processor class should be mentioned in the processorClassName node of ProviderMaster and the payment types that the third-party service supports should be mentioned in supportedTypes node.
See also About Extending Infosys Equinox Commerce.
Revision History
2022-04-10 | JP – Fixed link and http issues.
2019-06-16 | PLK – Link added.
2019-05-24 | AM – Minor copyedit.
2019-01-23 | PLK – Content uploaded.