Module: AuthorizeNet::CIM::Fields

Included in:
Response, Transaction, Reporting::Response
Defined in:
lib/authorize_net/fields.rb

Constant Summary collapse

REFID_FIELDS =
{:refId => :reference_id}
VALIDATION_MODE_FIELDS =
{:validationMode => :validation_mode}
CUSTOMER_PROFILE_ID_FIELDS =
{:customerProfileId => :customer_profile_id}
CUSTOMER_PAYMENT_PROFILE_ID_FIELDS =
{:customerPaymentProfileId => :customer_payment_profile_id}
BILL_TO_FIELDS =
{:billTo  => [
  {:firstName => :first_name},
  {:lastName => :last_name},
  {:company => :company},
  {:address => :address},
  {:city => :city},
  {:state => :state},
  {:zip => :zip},
  {:country => :country},
  {:phoneNumber => :phone},
  {:faxNumber => :fax}
]}
SHIP_TO_FIELDS =
{:shipTo  => [
  {:firstName => :ship_to_first_name},
  {:lastName => :ship_to_last_name},
  {:company => :ship_to_company},
  {:address => :ship_to_address},
  {:city => :ship_to_city},
  {:state => :ship_to_state},
  {:zip => :ship_to_zip},
  {:country => :ship_to_country},
  {:phoneNumber => :ship_to_phone},
  {:faxNumber => :ship_to_fax}
], :_multivalue => :addresses}
ADDRESS_FIELDS =
{:address => [
    {:firstName => :first_name},
    {:lastName => :last_name},
    {:company => :company},
    {:address => :address},
    {:city => :city},
    {:state => :state},
    {:zip => :zip},
    {:country => :country},
    {:phoneNumber => :phone},
    {:faxNumber => :fax}
  ]
}
PAYMENT_PROFILE_FIELDS =
[
  {:customerType => :cust_type},
  BILL_TO_FIELDS,
  {:payment => [
    {:creditCard => [
      {:cardNumber => :card_num},
      {:expirationDate => :exp_date},
      {:cardCode => :card_code}
    ]},
    {:bankAccount => [
      {:accountType => :bank_acct_type},
      {:routingNumber => :bank_aba_code},
      {:accountNumber => :bank_acct_num},
      {:nameOnAccount => :bank_acct_name},
      {:echeckType => :echeck_type},
      {:bankName => :bank_name}
    ]}
  ]}
]
PROFILE_FIELDS =
{:profile => [
  {:merchantCustomerId => :cust_id},
  {:description => :description},
  {:email => :email},
  {:paymentProfiles => PAYMENT_PROFILE_FIELDS, :_multivalue => :payment_profiles},
  SHIP_TO_FIELDS
]}
TRANSACTION_FIELDS =
[
  {:amount => :amount},
  {:tax => [
    {:amount => :tax},
    {:name => :tax_name},
    {:description => :tax_description}
  ]},
  {:shipping => [
    {:amount => :freight},
    {:name => :freight_name},
    {:description => :freight_description}
  ]},
  {:duty => [
    {:amount => :duty},
    {:name => :duty_name},
    {:description => :duty_description}
  ]},
  {:lineItems => [
    {:itemId => :line_item_id},
    {:name => :line_item_name},
    {:description => :line_item_description},
    {:quantity => :line_item_quantity},
    {:unitPrice => :line_item_unit_price},
    {:taxable => :line_item_taxable}
  ], :_multivalue => :line_items},
  CUSTOMER_PROFILE_ID_FIELDS,
  CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
  {:customerShippingAddressId => :customer_address_id},
  {:creditCardNumberMasked => :card_num_masked},
  {:bankRoutingNumberMasked => :bank_aba_code_masked},
  {:bankAccountNumberMasked => :bank_acct_num_masked},
  {:order => [
    {:invoiceNumber => :invoice_number},
    {:description => :description},
    {:purchaseOrderNumber => :po_num}
  ]},
  {:taxExempt => :tax_exempt},
  {:recurringBilling => :recurring_billing},
  {:cardCode => :card_code},
  {:splitTenderId => :split_tender_id},
  {:approvalCode => :auth_code},
  {:transId => :trans_id}
]
TRANSACTION_AUTH_FIELDS =
[
  {:profileTransAuthOnly => TRANSACTION_FIELDS}
]
TRANSACTION_AUTH_CAPTURE_FIELDS =
[
  {:profileTransAuthCapture => TRANSACTION_FIELDS}
]
TRANSACTION_CAPTURE_FIELDS =
[
  {:profileTransCaptureOnly => TRANSACTION_FIELDS}
]
TRANSACTION_PRIOR_AUTH_CAPTURE_FIELDS =
[
  {:profileTransPriorAuthCapture => TRANSACTION_FIELDS}
]
TRANSACTION_REFUND_FIELDS =
[
  {:profileTransRefund => TRANSACTION_FIELDS}
]
TRANSACTION_VOID_FIELDS =
[
  {:profileTransVoid => [
    CUSTOMER_PROFILE_ID_FIELDS,
    CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
    {:transId => :trans_id}
  ]}
]
CREATE_PROFILE_FIELDS =
[
  REFID_FIELDS,
  PROFILE_FIELDS,
  VALIDATION_MODE_FIELDS
]
CREATE_PAYMENT_FIELDS =
[
  REFID_FIELDS,
  CUSTOMER_PROFILE_ID_FIELDS,
  {:paymentProfile => PAYMENT_PROFILE_FIELDS},
  VALIDATION_MODE_FIELDS
]
CREATE_ADDRESS_FIELDS =
[
  REFID_FIELDS,
  CUSTOMER_PROFILE_ID_FIELDS,
  ADDRESS_FIELDS
]
CREATE_TRANSACTION_FIELDS =
[
  REFID_FIELDS,
  {:transaction => [], :_conditional => :select_transaction_type_fields},
  {:extraOptions => :extra_options}
]
DELETE_PROFILE_FIELDS =
[
  REFID_FIELDS,
  CUSTOMER_PROFILE_ID_FIELDS
]
DELETE_PAYMENT_FIELDS =
[
  REFID_FIELDS,
  CUSTOMER_PROFILE_ID_FIELDS,
  CUSTOMER_PAYMENT_PROFILE_ID_FIELDS
]
DELETE_ADDRESS_FIELDS =
[
  REFID_FIELDS,
  CUSTOMER_PROFILE_ID_FIELDS,
  {:customerAddressId => :customer_address_id}
]
GET_PROFILE_IDS_FIELDS =
[]
GET_PROFILE_FIELDS =
[
  CUSTOMER_PROFILE_ID_FIELDS
]
GET_PAYMENT_FIELDS =
[
  CUSTOMER_PROFILE_ID_FIELDS,
  CUSTOMER_PAYMENT_PROFILE_ID_FIELDS
]
GET_ADDRESS_FIELDS =
[
  CUSTOMER_PROFILE_ID_FIELDS,
  {:customerAddressId => :customer_address_id}
]
UPDATE_PROFILE_FIELDS =
[
  REFID_FIELDS,
  {:profile => [
    {:merchantCustomerId => :cust_id},
    {:description => :description},
    {:email => :email},
    CUSTOMER_PROFILE_ID_FIELDS
  ]}
]
UPDATE_PAYMENT_FIELDS =
[
  REFID_FIELDS,
  CUSTOMER_PROFILE_ID_FIELDS,
  {:paymentProfile => PAYMENT_PROFILE_FIELDS + [CUSTOMER_PAYMENT_PROFILE_ID_FIELDS]},
  VALIDATION_MODE_FIELDS
]
UPDATE_ADDRESS_FIELDS =
[
  REFID_FIELDS,
  CUSTOMER_PROFILE_ID_FIELDS,
  {:address => [
    {:firstName => :first_name},
    {:lastName => :last_name},
    {:company => :company},
    {:address => :address},
    {:city => :city},
    {:state => :state},
    {:zip => :zip},
    {:country => :country},
    {:phoneNumber => :phone},
    {:faxNumber => :fax},
    {:customerAddressId => :customer_address_id}
  ]}
]
UPDATE_SPLIT_FIELDS =
[
  {:splitTenderId => :split_tender_id},
  {:splitTenderStatus => :split_tender_status}
]
VALIDATE_PAYMENT_FIELDS =
[
  CUSTOMER_PROFILE_ID_FIELDS,
  CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
  {:customerShippingAddressId => :customer_address_id},
  {:cardCode => :card_code},
  VALIDATION_MODE_FIELDS
]
FIELDS =
{
  AuthorizeNet::XmlTransaction::Type::CIM_CREATE_PROFILE => CREATE_PROFILE_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_CREATE_PAYMENT => CREATE_PAYMENT_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_CREATE_ADDRESS => CREATE_ADDRESS_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_CREATE_TRANSACTION => CREATE_TRANSACTION_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_DELETE_PROFILE => DELETE_PROFILE_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_DELETE_PAYMENT => DELETE_PAYMENT_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_DELETE_ADDRESS => DELETE_ADDRESS_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_GET_PROFILE_IDS => GET_PROFILE_IDS_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_GET_PROFILE => GET_PROFILE_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_GET_PAYMENT => GET_PAYMENT_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_GET_ADDRESS => GET_ADDRESS_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_PROFILE => UPDATE_PROFILE_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_PAYMENT => UPDATE_PAYMENT_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_ADDRESS => UPDATE_ADDRESS_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_SPLIT => UPDATE_SPLIT_FIELDS,
  AuthorizeNet::XmlTransaction::Type::CIM_VALIDATE_PAYMENT => VALIDATE_PAYMENT_FIELDS
}
ADDRESS_ENTITY_DESCRIPTION =
EntityDescription.new(
  [
    {:firstName => :first_name},
    {:lastName => :last_name},
    {:company => :company},
    {:address => :address},
    {:city => :city},
    {:state => :state},
    {:zip => :zip},
    {:country => :country},
    {:phoneNumber => :phone},
    {:faxNumber => :fax}
  ],
  AuthorizeNet::Address
)
CREDIT_CARD_ENTITY_DESCRIPTION =
EntityDescription.new(
  [
    {:cardNumber => :card_num},
    {:expirationDate => :exp_date},
    {:cardCode => :card_code},
    {:cardType => :card_type}
  ],
  AuthorizeNet::CreditCard,
  [:card_num, :exp_date]
)
ECHECK_ENTITY_DESCRIPTION =
EntityDescription.new(
  [
    {:accountType => :account_type},
    {:routingNumber => :routing_number},
    {:accountNumber => :account_number},
    {:nameOnAccount => :account_holder_name},
    {:echeckType => :echeck_type},
    {:bankName => :bank_name}
  ],
  AuthorizeNet::ECheck,
  [:routing_number, :account_number, :bank_name, :account_holder_name]
)
PAYMENT_PROFILE_ENTITY_DESCRIPTION =
EntityDescription.new(
  [
    CUSTOMER_PAYMENT_PROFILE_ID_FIELDS,
    {:customerType => :cust_type},
    {:billTo => ADDRESS_ENTITY_DESCRIPTION, :_value => :billing_address},
    {:payment => [
      {:creditCard => CREDIT_CARD_ENTITY_DESCRIPTION, :_value => :payment_method},
      {:bankAccount => ECHECK_ENTITY_DESCRIPTION, :_value => :payment_method}
    ]}
  ],
  AuthorizeNet::CIM::PaymentProfile
)
PROFILE_ENTITY_DESCRIPTION =
EntityDescription.new(
  [
    {:merchantCustomerId => :id},
    {:description => :description},
    {:email => :email},
    CUSTOMER_PROFILE_ID_FIELDS,
    {:paymentProfiles => PAYMENT_PROFILE_ENTITY_DESCRIPTION, :_multivalue => :payment_profiles},
    {:shipTo => ADDRESS_ENTITY_DESCRIPTION, :_multivalue => :addresses}
  ],
  AuthorizeNet::CIM::CustomerProfile
)