class CheckoutSdk::PaymentRequestSource

Attributes

amount[RW]
billing_address_line1[RW]
billing_address_line2[RW]
billing_city[RW]
billing_country[RW]
billing_descriptor[RW]
billing_descriptor_city[RW]
billing_descriptor_name[RW]
billing_state[RW]
billing_zip[RW]
capture[RW]
capture_on[RW]
card_cvv[RW]
card_expiry_month[RW]
card_expiry_year[RW]
card_name[RW]
card_number[RW]
card_stored[RW]
currency[RW]
customer_email[RW]
customer_id[RW]
customer_name[RW]
cvv[RW]
description[RW]
failure_url[RW]
id[RW]
metadata[RW]
payment_ip[RW]
payment_type[RW]
phone_country_code[RW]
phone_number[RW]
previous_payment_id[RW]
processing_mid[RW]
recipient_account_number[RW]
recipient_dob[RW]
recipient_last_name[RW]
recipient_zip[RW]
reference[RW]
risk_enabled[RW]
shipping_address_line1[RW]
shipping_address_line2[RW]
shipping_city[RW]
shipping_country[RW]
shipping_phone_country_code[RW]
shipping_phone_number[RW]
shipping_state[RW]
shipping_zip[RW]
success_url[RW]
threeds_attempt_n3d[RW]
threeds_cryptogram[RW]
threeds_eci[RW]
threeds_enabled[RW]
threeds_version[RW]
threeds_xid[RW]
token[RW]
type[RW]

Public Instance Methods

data() click to toggle source
# File lib/checkout_sdk/data/payment_request_source.rb, line 15
def data
  { source: source(type),
    amount: amount,
    currency: currency,
    payment_type: payment_type,
    reference: reference,
    description: description,
    capture: capture,
    capture_on: capture_on,
    customer: {
      id: customer_id,
      email: customer_email,
      name: customer_name
    },
    billing_descriptor: {
      name: billing_descriptor_name,
      city: billing_descriptor_city
    },
    shipping: {
      address: {
        address_line1: shipping_address_line1,
        address_line2: shipping_address_line2,
        city: shipping_city,
        state: shipping_state,
        zip: shipping_zip,
        country: shipping_country
      },
      phone: {
        country_code: shipping_phone_country_code,
        number: shipping_phone_number
      }
    },
    "3ds" => {
      enabled: threeds_enabled,
      attempt_n3d: threeds_attempt_n3d,
      eci: threeds_eci,
      cryptogram: threeds_cryptogram,
      xid: threeds_xid,
      version: threeds_version
    },
    previous_payment_id: previous_payment_id,
    risk: {
      enabled: risk_enabled
    },
    success_url: success_url,
    failure_url: failure_url,
    payment_ip: payment_ip,
    recipient: {
      dob: recipient_dob,
      account_number: recipient_account_number,
      zip: recipient_zip,
      last_name: recipient_last_name
    },
    processing: {
      mid: processing_mid
    },
    metadata: metadata
  }
end

Private Instance Methods

card_type() click to toggle source
# File lib/checkout_sdk/data/payment_request_source.rb, line 105
def card_type
  {
    type: type,
    number: card_number,
    expiry_month: card_expiry_month,
    expiry_year: card_expiry_year,
    name: card_name,
    cvv: card_cvv,
    stored: card_stored,
    billing_address:  {
      address_line1: billing_address_line1,
      address_line2: billing_address_line2,
      city: billing_city,
      state: billing_state,
      zip: billing_zip,
      country: billing_country
    },
    phone: {
      country_code: phone_country_code,
      number: phone_number
    },
  }
end
customer_type() click to toggle source
# File lib/checkout_sdk/data/payment_request_source.rb, line 137
def customer_type
  {
    type: type,
    id: customer_id,
    email: customer_email
  }
end
id_type() click to toggle source
# File lib/checkout_sdk/data/payment_request_source.rb, line 129
def id_type
  {
    type: type,
    id: id,
    cvv: cvv
  }
end
source(type) click to toggle source
# File lib/checkout_sdk/data/payment_request_source.rb, line 77
def source(type)
  case type
  when "id"       then id_type
  when "token"    then token_type
  when "card"     then card_type
  when "customer" then customer_type
  end
end
token_type() click to toggle source
# File lib/checkout_sdk/data/payment_request_source.rb, line 86
def token_type
  {
    type: type,
    token: token,
    billing_address:  {
      address_line1: billing_address_line1,
      address_line2: billing_address_line2,
      city: billing_city,
      state: billing_state,
      zip: billing_zip,
      country: billing_country
    },
    phone: {
      country_code: phone_country_code,
      number: phone_number
    },
  }
end