All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.braintreegateway.util.PaymentMethodParser Maven / Gradle / Ivy

There is a newer version: 3.32.0_1
Show newest version
package com.braintreegateway.util;

import com.braintreegateway.AmexExpressCheckoutCard;
import com.braintreegateway.AndroidPayCard;
import com.braintreegateway.ApplePayCard;
import com.braintreegateway.CreditCard;
import com.braintreegateway.CustomActionsPaymentMethod;
import com.braintreegateway.MasterpassCard;
import com.braintreegateway.PayPalAccount;
import com.braintreegateway.PaymentMethod;
import com.braintreegateway.Result;
import com.braintreegateway.SamsungPayCard;
import com.braintreegateway.SepaDirectDebitAccount;
import com.braintreegateway.UnknownPaymentMethod;
import com.braintreegateway.UsBankAccount;
import com.braintreegateway.VenmoAccount;
import com.braintreegateway.VisaCheckoutCard;

public class PaymentMethodParser {

    public static Result parsePaymentMethod(NodeWrapper node) {
        if (node.getElementName() == "amex-express-checkout-card") {
            return new Result(node, AmexExpressCheckoutCard.class);
        } else if (node.getElementName() == "android-pay-card") {
            return new Result(node, AndroidPayCard.class);
        } else if (node.getElementName() == "apple-pay-card") {
            return new Result(node, ApplePayCard.class);
        } else if (node.getElementName() == "credit-card") {
            return new Result(node, CreditCard.class);
        } else if (node.getElementName() == "custom-actions-payment-method") {
            return new Result(node, CustomActionsPaymentMethod.class);
        } else if (node.getElementName() == "masterpass-card") {
            return new Result(node, MasterpassCard.class);
        } else if (node.getElementName() == "paypal-account") {
            return new Result(node, PayPalAccount.class);
        } else if (node.getElementName() == "samsung-pay-card") {
            return new Result(node, SamsungPayCard.class);
        } else if (node.getElementName() == "sepa-debit-account") {
            return new Result(node, SepaDirectDebitAccount.class);
        } else if (node.getElementName() == "us-bank-account") {
            return new Result(node, UsBankAccount.class);
        } else if (node.getElementName() == "venmo-account") {
            return new Result(node, VenmoAccount.class);
        } else if (node.getElementName() == "visa-checkout-card") {
            return new Result(node, VisaCheckoutCard.class);
        } else {
            return new Result(node, UnknownPaymentMethod.class);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy