congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CreditCard
Code IndexAdd Tabnine to your IDE (free)

How to use
CreditCard
in
com.aoindustries.creditcards

Best Java code snippets using com.aoindustries.creditcards.CreditCard (Showing top 13 results out of 315)

origin: com.aoindustries/ao-credit-cards-stripe

private static Map<String,Object> makeCardParams(CreditCard creditCard, boolean update) {
  return makeCardParams(
    creditCard,
    update,
    creditCard.getCardNumber(),
    creditCard.getExpirationMonth(),
    creditCard.getExpirationYear(),
    creditCard.getCardCode()
  );
}
origin: com.aoindustries/ao-credit-cards-stripe

/** https://stripe.com/docs/api#update_card */
private static void addCardParams(
  CreditCard creditCard,
  boolean update,
  Map<String,Object> cardParams
) {
  addParam(update, cardParams, "name", CreditCard.getFullName(creditCard.getFirstName(), creditCard.getLastName()));
  addParam(update, cardParams, "address_line1", creditCard.getStreetAddress1());
  addParam(update, cardParams, "address_line2", creditCard.getStreetAddress2());
  addParam(update, cardParams, "address_city", creditCard.getCity());
  addParam(update, cardParams, "address_zip", creditCard.getPostalCode());
  addParam(update, cardParams, "address_state", creditCard.getState());
  addParam(update, cardParams, "address_country", creditCard.getCountryCode());
}
origin: com.aoindustries/ao-credit-cards-stripe

/** https://stripe.com/docs/api#update_customer */
private static void addCustomerParams(
  CreditCard creditCard,
  boolean update,
  Map<String,Object> customerParams
) {
  addParam(update, customerParams, "description", creditCard.getComments());
  addParam(update, customerParams, "email", creditCard.getEmail());
  addParam(update, customerParams, "metadata", makeMetadata(creditCard, update));
}
origin: com.aoindustries/ao-credit-cards-stripe

/** https://stripe.com/docs/api#metadata */
private static Map<String,Object> makeMetadata(CreditCard creditCard, boolean update) {
  Map<String,Object> metadata = new LinkedHashMap<String,Object>();
  addMetaData(update, metadata, "company_name", creditCard.getCompanyName(), true);
  addMetaData(update, metadata, "phone", creditCard.getPhone(), true);
  addMetaData(update, metadata, "fax", creditCard.getFax(), true);
  addMetaData(update, metadata, "customer_id", creditCard.getCustomerId(), true);
  addMetaData(update, metadata, "customer_tax_id", creditCard.getCustomerTaxId(), true);
  return metadata;
}
origin: com.aoindustries/ao-credit-cards-usaepay

request.put("UMcard", creditCard.getCardNumber());
request.put("UMexpir", creditCard.getExpirationDateMMYY());
String customerId = creditCard.getCustomerId();
if(customerId!=null && customerId.length()>0) request.put("UMcustid", customerId);
String comments = creditCard.getComments();
if(comments != null && comments.length()>0) request.put("UMcomments", comments);
String cvv2 = creditCard.getCardCode();
if(cvv2!=null && cvv2.length()>0) request.put("UMcvv2", cvv2);
String email = creditCard.getEmail();
if(email!=null && email.length()>0) request.put("UMcustemail", email);
request.put("UMname", CreditCard.getFullName(creditCard.getFirstName(), creditCard.getLastName()));
String street = getStreetAddress(creditCard.getStreetAddress1(), creditCard.getStreetAddress2());
if(street.length()>0) request.put("UMstreet", street);
String zip = creditCard.getPostalCode();
if(zip!=null && zip.length()>0) request.put("UMzip", zip);
String billfname = creditCard.getFirstName();
if(billfname!=null && billfname.length()>0) request.put("UMbillfname", billfname);
String billlname = creditCard.getLastName();
if(billlname!=null && billlname.length()>0) request.put("UMbilllname", billlname);
String billcompany = creditCard.getCompanyName();
if(billcompany!=null && billcompany.length()>0) request.put("UMbillcompany", billcompany);
origin: com.aoindustries/ao-credit-cards-sagePayments

if(creditCard.getProviderUniqueId() != null) {
      emptyStringIfNull(merchantId),
      emptyStringIfNull(merchantKey),
      emptyStringIfNull(CreditCard.getFullName(creditCard.getFirstName(), creditCard.getLastName())),
      emptyStringIfNull(getStreetAddress(creditCard.getStreetAddress1(), creditCard.getStreetAddress2())),
      emptyStringIfNull(creditCard.getCity()),
      emptyStringIfNull(creditCard.getState()),
      emptyStringIfNull(creditCard.getPostalCode()),
      emptyStringIfNull(creditCard.getCountryCode()),
      emptyStringIfNull(creditCard.getEmail()),
      emptyStringIfNull(creditCard.getProviderUniqueId()),
      emptyStringIfNull(null),
      emptyStringIfNull(transactionRequest.getTaxAmount()==null ? null : transactionRequest.getTaxAmount().toString()),
      emptyStringIfNull(transactionRequest.getOrderNumber()),
      emptyStringIfNull(creditCard.getPhone()),
      emptyStringIfNull(creditCard.getFax()),
      emptyStringIfNull(CreditCard.getFullName(transactionRequest.getShippingFirstName(), transactionRequest.getShippingLastName())),
      emptyStringIfNull(getStreetAddress(transactionRequest.getShippingStreetAddress1(), transactionRequest.getShippingStreetAddress2())),
      emptyStringIfNull(transactionRequest.getShippingCity()),
      emptyStringIfNull(merchantId),
      emptyStringIfNull(merchantKey),
      emptyStringIfNull(CreditCard.getFullName(creditCard.getFirstName(), creditCard.getLastName())),
      emptyStringIfNull(getStreetAddress(creditCard.getStreetAddress1(), creditCard.getStreetAddress2())),
      emptyStringIfNull(creditCard.getCity()),
      emptyStringIfNull(creditCard.getState()),
      emptyStringIfNull(creditCard.getPostalCode()),
origin: com.aoindustries/ao-credit-cards-stripe

@Override
public void updateCreditCardNumberAndExpiration(
  CreditCard creditCard,
  String cardNumber,
  byte expirationMonth,
  short expirationYear,
  String cardCode
) throws IOException {
  // Replace the default Card
  Map<String,Object> cardParams = makeCardParams(
    creditCard,
    true,
    cardNumber,
    expirationMonth,
    expirationYear,
    cardCode!=null ? CreditCard.numbersOnly(cardCode) : creditCard.getCardCode()
  );
  Map<String,Object> updateParams = new HashMap<String,Object>();
  addParam(true, updateParams, "card", cardParams);
  try {
    Customer customer = Customer.retrieve(creditCard.getProviderUniqueId(), options);
    customer.update(updateParams, options);
  } catch(StripeException e) {
    ConvertedError converted = convertError(e);
    // TODO: Throw ErrorCodeException to provide more details
    throw new LocalizedIOException(e, accessor, "MerchantServicesProvider.updateCreditCardNumberAndExpiration.notSuccessful");
  }
}
origin: com.aoindustries/ao-credit-cards-stripe

/** https://stripe.com/docs/api#create_charge */
private static Map<String,Object> makeShippingParams(TransactionRequest transactionRequest, CreditCard creditCard, boolean update) {
  Map<String,Object> shippingParams = new HashMap<String,Object>();
  addParam(update, shippingParams, "address", makeShippingAddressParams(transactionRequest, update));
  addParam(update, shippingParams, "name", CreditCard.getFullName(transactionRequest.getShippingFirstName(), transactionRequest.getShippingLastName()));
  // Phone cannot be in the shipping by itself
  if(!shippingParams.isEmpty()) addParam(update, shippingParams, "phone", creditCard.getPhone());
  // Unused: tracking_number
  return shippingParams;
}
// </editor-fold>
origin: com.aoindustries/ao-credit-cards-sagePayments

  emptyStringIfNull(merchantId),
  emptyStringIfNull(merchantKey),
  emptyStringIfNull(creditCard.getCardNumber()),
  emptyStringIfNull(creditCard.getExpirationDateMMYY())
).get_any();
origin: com.aoindustries/ao-credit-cards-stripe

addParam(false, chargeParams, "amount", amount);
addParam(false, chargeParams, "currency", currency.getCurrencyCode());
if(creditCard.getProviderUniqueId() != null) {
  addParam(false, chargeParams, "customer", creditCard.getProviderUniqueId());
} else {
  addParam(false, chargeParams, "receipt_email", creditCard.getEmail());
origin: com.aoindustries/ao-credit-cards-authorizeNet

addField(querySB, "x_method", "CC");
addField(querySB, "x_amount", getAmount(transactionRequest));
addField(querySB, "x_card_num", CreditCard.numbersOnly(creditCard.getCardNumber()));
addField(querySB, "x_exp_date", creditCard.getExpirationDateMMYY());
addField(querySB, "x_card_code", creditCard.getCardCode());
if(transactionRequest.getTestMode()) addField(querySB, "x_test_request", "TRUE");
addField(querySB, "x_duplicate_window", transactionRequest.getDuplicateWindow());
addField(querySB, "x_first_name", creditCard.getFirstName());
addField(querySB, "x_last_name", creditCard.getLastName());
addField(querySB, "x_company", creditCard.getCompanyName());
addField(querySB, "x_address", getStreetAddress(creditCard.getStreetAddress1(), creditCard.getStreetAddress2()));
addField(querySB, "x_city", creditCard.getCity());
addField(querySB, "x_state", creditCard.getState());
addField(querySB, "x_zip", CreditCard.numbersOnly(creditCard.getPostalCode()));
addField(querySB, "x_country", creditCard.getCountryCode());
addField(querySB, "x_phone", creditCard.getPhone());
addField(querySB, "x_fax", creditCard.getFax());
addField(querySB, "x_email", creditCard.getEmail());
addField(querySB, "x_email_customer", transactionRequest.getEmailCustomer() ? "TRUE" : "FALSE");
addField(querySB, "x_merchant_email", transactionRequest.getMerchantEmail());
addField(querySB, "x_cust_id", creditCard.getCustomerId());
addField(querySB, "x_customer_ip", transactionRequest.getCustomerIp());
addField(querySB, "x_ship_to_city", transactionRequest.getShippingCity());
addField(querySB, "x_ship_to_state", transactionRequest.getShippingState());
addField(querySB, "x_ship_to_zip", CreditCard.numbersOnly(transactionRequest.getShippingPostalCode()));
addField(querySB, "x_ship_to_country", transactionRequest.getShippingCountryCode());
origin: com.aoindustries/ao-credit-cards-payflowPro

String comment1 = transactionRequest.getDescription();
if(comment1 != null && comment1.length()>0) invoice.setComment1("Transaction Description: "+comment1);
String comment2 = creditCard.getComments();
if(comment2 != null && comment2.length()>0) invoice.setComment2("Credit Card Comments: "+comment2);
String orderNumber = transactionRequest.getOrderNumber();
billTo.setFirstName(creditCard.getFirstName());
billTo.setLastName(creditCard.getLastName());
String email = creditCard.getEmail();
if(email!=null && email.length()>0) billTo.setEmail(email);
String phone = creditCard.getPhone();
if(phone!=null && phone.length()>0) billTo.setPhoneNum(phone);
String street = getStreetAddress(creditCard.getStreetAddress1(), creditCard.getStreetAddress2());
if(street.length()>0) billTo.setStreet(street);
String city = creditCard.getCity();
if(city!=null && city.length()>0) billTo.setCity(city);
String state = creditCard.getState();
if(state!=null && state.length()>0) {
  if(state.length()==2) billTo.setState(state);
  else logger.log(Level.WARNING, "PayflowPro: state is not two-digits, and no automatic conversion has been implemented, not sending STATE", state);
String zip = creditCard.getPostalCode();
if(zip!=null && zip.length()>0) billTo.setZip(CreditCard.numbersOnly(zip));
String cardCountryCode = creditCard.getCountryCode();
if(cardCountryCode!=null && cardCountryCode.length()>0) billTo.setBillToCountry(cardCountryCode);
String companyName = creditCard.getCompanyName();
if(companyName!=null && companyName.length()>0) billTo.setCompanyName(companyName);
invoice.setBillTo(billTo);
origin: com.aoindustries/ao-credit-cards-stripe

/**
 * Meta data contains both card meta data (also associated with "customer" for stored cards) and transaction meta data.
 * https://stripe.com/docs/api#create_charge
 */
private static Map<String,Object> makeMetadata(TransactionRequest transactionRequest, CreditCard creditCard, boolean update) {
  Map<String,Object> metadata = makeMetadata(creditCard, update);
  // Additional customer meta data
  addMetaData(update, metadata, "customer_description", creditCard.getComments(), true);
  addMetaData(update, metadata, "customer_email", creditCard.getEmail(), false);
  // Transaction meta data
  addMetaData(update, metadata, "customer_ip", transactionRequest.getCustomerIp(), false);
  addMetaData(update, metadata, "order_number", transactionRequest.getOrderNumber(), false);
  addMetaData(update, metadata, "amount", transactionRequest.getAmount(), false);
  addMetaData(update, metadata, "tax_amount", transactionRequest.getTaxAmount(), false);
  addMetaData(update, metadata, "tax_exempt", transactionRequest.getTaxExempt(), false);
  addMetaData(update, metadata, "shipping_amount", transactionRequest.getShippingAmount(), false);
  addMetaData(update, metadata, "duty_amount", transactionRequest.getDutyAmount(), false);
  addMetaData(update, metadata, "shipping_company_name", transactionRequest.getShippingCompanyName(), true);
  addMetaData(update, metadata, "invoice_number", transactionRequest.getInvoiceNumber(), false);
  addMetaData(update, metadata, "purchase_order_number", transactionRequest.getPurchaseOrderNumber(), false);
  return metadata;
}
com.aoindustries.creditcardsCreditCard

Most used methods

  • getCardCode
  • getCardNumber
  • getCity
  • getCountryCode
  • getEmail
  • getFirstName
  • getLastName
  • getPhone
  • getPostalCode
  • getState
  • getStreetAddress1
  • getStreetAddress2
  • getStreetAddress1,
  • getStreetAddress2,
  • getComments,
  • getCompanyName,
  • getCustomerId,
  • getExpirationDateMMYY,
  • getFax,
  • getFullName,
  • numbersOnly,
  • getCustomerTaxId

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Option (scala)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now