class CheckoutSdk::RequestToken

Attributes

billing_address_line1[RW]
billing_address_line2[RW]
billing_city[RW]
billing_country[RW]
billing_state[RW]
billing_zip[RW]
card_cvv[RW]
card_expiry_month[RW]
card_expiry_year[RW]
card_name[RW]
card_number[RW]
phone_country_code[RW]
phone_number[RW]
token_data_data[RW]
token_data_header[RW]
token_data_protocolVersion[RW]
token_data_signature[RW]
token_data_signedMessage[RW]
token_data_version[RW]
type[RW]

Public Instance Methods

data() click to toggle source
# File lib/checkout_sdk/data/request_token.rb, line 8
def data
  if type == "card"
    card_type
  else
    {
      type: type,
      token_data: token_data(type)
    }
  end
end

Private Instance Methods

applepay_type() click to toggle source
# File lib/checkout_sdk/data/request_token.rb, line 28
def applepay_type
  {
    version: token_data_version,
    data: token_data_data,
    signature: token_data_signature,
    header: token_data_header
  }
end
card_type() click to toggle source
# File lib/checkout_sdk/data/request_token.rb, line 45
def card_type
  {
    type: type,
    number: card_number,
    expiry_month: card_expiry_month,
    expiry_year: card_expiry_year,
    name: card_name,
    cvv: card_cvv,
    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
googlepay_type() click to toggle source
# File lib/checkout_sdk/data/request_token.rb, line 37
def googlepay_type
  {
    signature: token_data_signature,
    protocolVersion: token_data_protocolVersion,
    signedMessage: token_data_signedMessage
  }
end
token_data(type) click to toggle source
# File lib/checkout_sdk/data/request_token.rb, line 21
def token_data(type)
  case type
  when "applepay"  then applepay_type
  when "googlepay" then googlepay_type
  end
end