com.braintreegateway.Customer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.braintree-java
Show all versions of org.apache.servicemix.bundles.braintree-java
This OSGi bundle wraps ${pkgArtifactId} ${pkgVersion} jar file.
The newest version!
package com.braintreegateway;
import com.braintreegateway.util.NodeWrapper;
import java.util.*;
public class Customer {
private Calendar createdAt;
private Calendar updatedAt;
private String company;
private String email;
private String fax;
private String firstName;
private String graphqlId;
private String id;
private String lastName;
private String phone;
private String website;
private List addresses;
private List amexExpressCheckoutCards;
private List androidPayCards;
private List applePayCards;
private List creditCards;
private List customActionsPaymentMethods;
private List masterpassCards;
private List paypalAccounts;
private List samsungPayCards;
private List sepaDirectDebitAccounts;
private List usBankAccounts;
private List venmoAccounts;
private List visaCheckoutCards;
private Map customFields;
public Customer(NodeWrapper node) {
company = node.findString("company");
createdAt = node.findDateTime("created-at");
customFields = node.findMap("custom-fields/*");
email = node.findString("email");
fax = node.findString("fax");
firstName = node.findString("first-name");
graphqlId = node.findString("global-id");
id = node.findString("id");
lastName = node.findString("last-name");
phone = node.findString("phone");
updatedAt = node.findDateTime("updated-at");
website = node.findString("website");
creditCards = new ArrayList();
for (NodeWrapper creditCardResponse : node.findAll("credit-cards/credit-card")) {
creditCards.add(new CreditCard(creditCardResponse));
}
paypalAccounts = new ArrayList();
for (NodeWrapper paypalResponse : node.findAll("paypal-accounts/paypal-account")) {
paypalAccounts.add(new PayPalAccount(paypalResponse));
}
applePayCards = new ArrayList();
for (NodeWrapper applePayCardResponse : node.findAll("apple-pay-cards/apple-pay-card")) {
applePayCards.add(new ApplePayCard(applePayCardResponse));
}
androidPayCards = new ArrayList();
for (NodeWrapper androidPayCardResponse : node.findAll("android-pay-cards/android-pay-card")) {
androidPayCards.add(new AndroidPayCard(androidPayCardResponse));
}
amexExpressCheckoutCards = new ArrayList();
for (NodeWrapper amexExpressCheckoutCardResponse : node.findAll("amex-express-checkout-cards/amex-express-checkout-card")) {
amexExpressCheckoutCards.add(new AmexExpressCheckoutCard(amexExpressCheckoutCardResponse));
}
venmoAccounts = new ArrayList();
for (NodeWrapper venmoAccountResponse : node.findAll("venmo-accounts/venmo-account")) {
venmoAccounts.add(new VenmoAccount(venmoAccountResponse));
}
visaCheckoutCards = new ArrayList();
for (NodeWrapper visaCheckoutCardResponse : node.findAll("visa-checkout-cards/visa-checkout-card")) {
visaCheckoutCards.add(new VisaCheckoutCard(visaCheckoutCardResponse));
}
masterpassCards = new ArrayList();
for (NodeWrapper masterpassCardResponse : node.findAll("masterpass-cards/masterpass-card")) {
masterpassCards.add(new MasterpassCard(masterpassCardResponse));
}
usBankAccounts = new ArrayList();
for (NodeWrapper usBankAccountResponse : node.findAll("us-bank-accounts/us-bank-account")) {
usBankAccounts.add(new UsBankAccount(usBankAccountResponse));
}
sepaDirectDebitAccounts = new ArrayList();
for (NodeWrapper sepaDirectDebitAccountResponse : node.findAll("sepa-debit-accounts/sepa-debit-account")) {
sepaDirectDebitAccounts.add(new SepaDirectDebitAccount(sepaDirectDebitAccountResponse));
}
samsungPayCards = new ArrayList();
for (NodeWrapper samsungPayCardResponse : node.findAll("samsung-pay-cards/samsung-pay-card")) {
samsungPayCards.add(new SamsungPayCard(samsungPayCardResponse));
}
customActionsPaymentMethods = new ArrayList();
for (NodeWrapper customActionsPaymentMethodResponse : node.findAll("custom-actions-payment-methods/custom-actions-payment-method")) {
customActionsPaymentMethods.add(new CustomActionsPaymentMethod(customActionsPaymentMethodResponse));
}
addresses = new ArrayList();
for (NodeWrapper addressResponse : node.findAll("addresses/address")) {
addresses.add(new Address(addressResponse));
}
}
public Calendar getCreatedAt() {
return createdAt;
}
public Calendar getUpdatedAt() {
return updatedAt;
}
public String getId() {
return id;
}
public String getGraphQLId() {
return graphqlId;
}
public String getCompany() {
return company;
}
public Map getCustomFields() {
return customFields;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getEmail() {
return email;
}
public String getFax() {
return fax;
}
public String getPhone() {
return phone;
}
public String getWebsite() {
return website;
}
public List getAddresses() {
return Collections.unmodifiableList(addresses);
}
public List getCreditCards() {
return Collections.unmodifiableList(creditCards);
}
public List getPayPalAccounts() {
return Collections.unmodifiableList(paypalAccounts);
}
public List getApplePayCards() {
return Collections.unmodifiableList(applePayCards);
}
public List getAndroidPayCards() {
return Collections.unmodifiableList(androidPayCards);
}
@Deprecated
public List getAmexExpressCheckoutCards() {
return Collections.unmodifiableList(amexExpressCheckoutCards);
}
public List getVenmoAccounts() {
return Collections.unmodifiableList(venmoAccounts);
}
public List getVisaCheckoutCards() {
return Collections.unmodifiableList(visaCheckoutCards);
}
@Deprecated
public List getMasterpassCards() {
return Collections.unmodifiableList(masterpassCards);
}
public List getUsBankAccounts() {
return Collections.unmodifiableList(usBankAccounts);
}
public List getSepaDirectDebitAccounts() {
return Collections.unmodifiableList(sepaDirectDebitAccounts);
}
public List getSamsungPayCards() {
return Collections.unmodifiableList(samsungPayCards);
}
public List getCustomActionsPaymentMethods() {
return Collections.unmodifiableList(customActionsPaymentMethods);
}
public List extends PaymentMethod> getPaymentMethods() {
List paymentMethods = new ArrayList();
paymentMethods.addAll(getCreditCards());
paymentMethods.addAll(getPayPalAccounts());
paymentMethods.addAll(getApplePayCards());
paymentMethods.addAll(getAndroidPayCards());
paymentMethods.addAll(getAmexExpressCheckoutCards());
paymentMethods.addAll(getVenmoAccounts());
paymentMethods.addAll(getVisaCheckoutCards());
paymentMethods.addAll(getMasterpassCards());
paymentMethods.addAll(getSamsungPayCards());
paymentMethods.addAll(getSepaDirectDebitAccounts());
paymentMethods.addAll(getCustomActionsPaymentMethods());
return Collections.unmodifiableList(paymentMethods);
}
public PaymentMethod getDefaultPaymentMethod() {
for (PaymentMethod paymentMethod : getPaymentMethods()) {
if (paymentMethod.isDefault()) {
return paymentMethod;
}
}
return null;
}
}