Search Results for

    Show / Hide Table of Contents

    Class MoneyInMerchant

    IMoneyInMerchant Is the base class for creating custom money in merchants. It provides default implementations where possible. Do not implement directly. You must implement one of the children abstract classes: SavedPaymentMoneyInMerchant, SinglePaymentMoneyInMerchant, or RedirectMoneyInMerchant. SavedPaymentMoneyInMerchant is normally used to tokenize and process credit cards. SinglePaymentMoneyInMerchant is used to process payments without saved payment data. This can be something that can be looked up by the associate, like reward points. RedirectMoneyInMerchant is used to forward the customer to the merchant's site to complete an order. This is done if the merchant can't process the payment as two separate steps (tokenize card, then charge card) and instead needs to control the full payment process. After the customer hits submit order, the order will be created in a pending state until they have completed the payment. Normally, after the payment is completed from the merchant's site, the merchant will then call a provided custom API endpoint to send the results of the attempted payment.

    Inheritance
    System.Object
    MoneyInMerchant
    RedirectMoneyInMerchant
    SavedPaymentMoneyInMerchant
    SinglePaymentMoneyInMerchant
    Namespace: DirectScale.Disco.Extension
    Assembly: DirectScale.Disco.Extension.Abstractions.dll
    Syntax
    public abstract class MoneyInMerchant : Object

    Methods

    GetNewPayerId(Int32)

    It is common for merchants to have their own accounts and ids for our customers, that will need to be used to process transactions for them. Override this method with logic for creating an account with the merchant and return the associate's PayerId with that merchant, if needed.

    Declaration
    public virtual Task<string> GetNewPayerId(int associateId)
    Parameters
    Type Name Description
    System.Int32 associateId

    The associate to create the external merchant account for.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    Override to return a merchant's Payer id for the associate, otherwise, the payerId used will be the associateId.

    Exceptions
    Type Condition
    System.NotImplementedException

    If this interface is implemented directly, instead of one of it's child classes.

    RefundPayment(String, Int32, String, Double, Double, String, String, String)

    Called when a refund has been submitted. Should include all custom work needed to return funds to the customer.

    Declaration
    public abstract Task<ExtendedPaymentResult> RefundPayment(string payerId, int orderNumber, string currencyCode, double paymentAmount, double refundAmount, string referenceNumber, string transactionNumber, string authorizationCode)
    Parameters
    Type Name Description
    System.String payerId

    If GetNewPayerId(Int32) has been overridden, it will be that payerId, otherwise the associateId is passed in.

    System.Int32 orderNumber

    The order that is having a payment refunded.

    System.String currencyCode

    The currency the payment was processed in.

    System.Double paymentAmount

    The full amount charged.

    System.Double refundAmount

    The refund amount requested.

    System.String referenceNumber

    This will match the value returned by ChargePayment when the payment was chared.

    System.String transactionNumber

    This will match the value returned by ChargePayment when the payment was chared.

    System.String authorizationCode

    This will match the value returned by ChargePayment when the payment was chared.

    Returns
    Type Description
    System.Threading.Tasks.Task<ExtendedPaymentResult>

    A PaymentResponse that will be written to the DB as a new negative payment.

    Remarks

    This will write a new payment entry into the DB for orderNumber for a negative amount, based on the return value PaymentResponse.Amount. If the full amount of the order is refunded, then volume is adjusted or clawbacks occur as needed. No default implementation can be provided. This must be implemented in custom merchant.

    Exceptions
    Type Condition
    System.Exception

    If null is returned

    System.Exception

    If PaymentResponse.Status.Rejected

    ValidateCurrency(String)

    Allows the merchant to validate the currency before an charge/refund is attempted and return an error.

    Declaration
    public virtual Task<ValidationResult> ValidateCurrency(string currencyCode)
    Parameters
    Type Name Description
    System.String currencyCode
    Returns
    Type Description
    System.Threading.Tasks.Task<ValidationResult>

    ValidationResult indicating if the process should continue, and an error message if there is one.

    Exceptions
    Type Condition
    System.NotImplementedException

    If this interface is implemented directly, instead of one of it's child classes.

    ValidatePayment(String, NewPayment)

    Allows the merchant to validate a payment what is about to be charged or refuned and return an error.

    Declaration
    public virtual Task<ValidationResult> ValidatePayment(string payerId, NewPayment payment)
    Parameters
    Type Name Description
    System.String payerId

    The associate's id for this merchant, or the associateId if no payerId is set.

    NewPayment payment

    The payment about to be processed.

    Returns
    Type Description
    System.Threading.Tasks.Task<ValidationResult>

    ValidationResult indicating if the process should continue, and an error message if there is one.

    Exceptions
    Type Condition
    System.NotImplementedException

    If this interface is implemented directly, instead of one of it's child classes.

    In This Article
    Back to top Copyright © 2022 DirectScale
    Generated by DocFX