class ActiveMerchant::Billing::WorldpayGateway

Constants

AVS_CODE_MAP
CARD_CODES
CVC_CODE_MAP

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method ActiveMerchant::Billing::Gateway::new
# File lib/active_merchant/billing/gateways/worldpay.rb, line 50
def initialize(options = {})
  requires!(options, :login, :password)
  super
end

Public Instance Methods

authorize(money, payment_method, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 62
def authorize(money, payment_method, options = {})
  requires!(options, :order_id)
  payment_details = payment_details_from(payment_method)
  authorize_request(money, payment_method, payment_details.merge(options))
end
capture(money, authorization, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 68
def capture(money, authorization, options = {})
  authorization = order_id_from_authorization(authorization.to_s)
  MultiResponse.run do |r|
    r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
    if r.params
      authorization_currency = r.params['amount_currency_code']
      options = options.merge(:currency => authorization_currency) if authorization_currency.present?
    end
    r.process { capture_request(money, authorization, options) }
  end
end
credit(money, payment_method, options = {}) click to toggle source

Credits only function on a Merchant ID/login/profile flagged for Payouts

aka Credit Fund Transfers (CFT), whereas normal purchases, refunds,
and other transactions should be performed on a normal eCom-flagged
merchant ID.
# File lib/active_merchant/billing/gateways/worldpay.rb, line 105
def credit(money, payment_method, options = {})
  payment_details = payment_details_from(payment_method)
  credit_request(money, payment_method, payment_details.merge(:credit => true, **options))
end
purchase(money, payment_method, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 55
def purchase(money, payment_method, options = {})
  MultiResponse.run do |r|
    r.process { authorize(money, payment_method, options) }
    r.process { capture(money, r.authorization, options.merge(:authorization_validated => true)) }
  end
end
refund(money, authorization, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 88
def refund(money, authorization, options = {})
  authorization = order_id_from_authorization(authorization.to_s)
  response = MultiResponse.run do |r|
    r.process { inquire_request(authorization, options, 'CAPTURED', 'SETTLED', 'SETTLED_BY_MERCHANT') }
    r.process { refund_request(money, authorization, options) }
  end

  return response if response.success?
  return response unless options[:force_full_refund_if_unsettled]

  void(authorization, options) if response.params['last_event'] == 'AUTHORISED'
end
scrub(transcript) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 126
def scrub(transcript)
  transcript.
    gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
    gsub(%r((<cardNumber>)\d+(</cardNumber>)), '\1[FILTERED]\2').
    gsub(%r((<cvc>)[^<]+(</cvc>)), '\1[FILTERED]\2')
end
store(credit_card, options={}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 117
def store(credit_card, options={})
  requires!(options, :customer)
  store_request(credit_card, options)
end
supports_scrubbing() click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 122
def supports_scrubbing
  true
end
verify(payment_method, options={}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 110
def verify(payment_method, options={})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, payment_method, options) }
    r.process(:ignore_result) { void(r.authorization, options.merge(:authorization_validated => true)) }
  end
end
void(authorization, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 80
def void(authorization, options = {})
  authorization = order_id_from_authorization(authorization.to_s)
  MultiResponse.run do |r|
    r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
    r.process { cancel_request(authorization, options) }
  end
end

Private Instance Methods

action_success?(action, raw) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 534
def action_success?(action, raw)
  case action
  when 'store'
    raw[:token].present?
  else
    false
  end
end
add_address(xml, address) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 389
def add_address(xml, address)
  return unless address

  address = address_with_defaults(address)

  xml.tag! 'cardAddress' do
    xml.tag! 'address' do
      if m = /^\s*([^\s]+)\s+(.+)$/.match(address[:name])
        xml.tag! 'firstName', m[1]
        xml.tag! 'lastName', m[2]
      end
      xml.tag! 'address1', address[:address1]
      xml.tag! 'address2', address[:address2] if address[:address2]
      xml.tag! 'postalCode', address[:zip]
      xml.tag! 'city', address[:city]
      xml.tag! 'state', address[:state]
      xml.tag! 'countryCode', address[:country]
      xml.tag! 'telephoneNumber', address[:phone] if address[:phone]
    end
  end
end
add_amount(xml, money, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 259
def add_amount(xml, money, options)
  currency = options[:currency] || currency(money)

  amount_hash = {
    :value => localized_amount(money, currency),
    'currencyCode' => currency,
    'exponent' => currency_exponent(currency)
  }

  if options[:debit_credit_indicator]
    amount_hash['debitCreditIndicator'] = options[:debit_credit_indicator]
  end

  xml.tag! 'amount', amount_hash
end
add_authenticated_shopper_id(xml, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 385
def add_authenticated_shopper_id(xml, options)
  xml.tag!('authenticatedShopperID', options[:customer]) if options[:customer]
end
add_card(xml, payment_method, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 325
def add_card(xml, payment_method, options)
  xml.tag! 'cardNumber', payment_method.number
  xml.tag! 'expiryDate' do
    xml.tag! 'date', 'month' => format(payment_method.month, :two_digits), 'year' => format(payment_method.year, :four_digits)
  end

  xml.tag! 'cardHolderName', options[:execute_threed] ? '3D' : payment_method.name
  xml.tag! 'cvc', payment_method.verification_value

  add_address(xml, (options[:billing_address] || options[:address]))
end
add_hcg_additional_data(xml, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 411
def add_hcg_additional_data(xml, options)
  xml.tag! 'hcgAdditionalData' do
    options[:hcg_additional_data].each do |k, v|
      xml.tag! 'param', {name: k.to_s}, v
    end
  end
end
add_instalments_data(xml, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 419
def add_instalments_data(xml, options)
  xml.tag! 'thirdPartyData' do
    xml.tag! 'instalments', options[:instalments]
    xml.tag! 'cpf', options[:cpf] if options[:cpf]
  end
end
add_payment_method(xml, amount, payment_method, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 275
def add_payment_method(xml, amount, payment_method, options)
  if options[:payment_type] == :pay_as_order
    if options[:merchant_code]
      xml.tag! 'payAsOrder', 'orderCode' => payment_method, 'merchantCode' => options[:merchant_code] do
        add_amount(xml, amount, options)
      end
    else
      xml.tag! 'payAsOrder', 'orderCode' => payment_method do
        add_amount(xml, amount, options)
      end
    end
  else
    xml.tag! 'paymentDetails', credit_fund_transfer_attribute(options) do
      if options[:payment_type] == :token
        xml.tag! 'TOKEN-SSL', 'tokenScope' => options[:token_scope] do
          xml.tag! 'paymentTokenID', options[:token_id]
        end
      else
        xml.tag! card_code_for(payment_method) do
          add_card(xml, payment_method, options)
        end
      end
      add_stored_credential_options(xml, options)
      if options[:ip] && options[:session_id]
        xml.tag! 'session', 'shopperIPAddress' => options[:ip], 'id' => options[:session_id]
      else
        xml.tag! 'session', 'shopperIPAddress' => options[:ip] if options[:ip]
        xml.tag! 'session', 'id' => options[:session_id] if options[:session_id]
      end

      if three_d_secure = options[:three_d_secure]
        add_three_d_secure(three_d_secure, xml)
      end
    end
  end
end
add_shopper(xml, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 373
def add_shopper(xml, options)
  return unless options[:execute_threed] || options[:email] || options[:customer]
  xml.tag! 'shopper' do
    xml.tag! 'shopperEmailAddress', options[:email] if  options[:email]
    add_authenticated_shopper_id(xml, options)
    xml.tag! 'browser' do
      xml.tag! 'acceptHeader', options[:accept_header]
      xml.tag! 'userAgentHeader', options[:user_agent]
    end
  end
end
add_stored_credential_options(xml, options={}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 337
def add_stored_credential_options(xml, options={})
  if options[:stored_credential]
    add_stored_credential_using_normalized_fields(xml, options)
  else
    add_stored_credential_using_gateway_specific_fields(xml, options)
  end
end
add_stored_credential_using_gateway_specific_fields(xml, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 361
def add_stored_credential_using_gateway_specific_fields(xml, options)
  return unless options[:stored_credential_usage]

  if options[:stored_credential_initiated_reason]
    xml.tag! 'storedCredentials', 'usage' => options[:stored_credential_usage], 'merchantInitiatedReason' => options[:stored_credential_initiated_reason] do
      xml.tag! 'schemeTransactionIdentifier', options[:stored_credential_transaction_id] if options[:stored_credential_transaction_id]
    end
  else
    xml.tag! 'storedCredentials', 'usage' => options[:stored_credential_usage]
  end
end
add_stored_credential_using_normalized_fields(xml, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 345
def add_stored_credential_using_normalized_fields(xml, options)
  if options[:stored_credential][:initial_transaction]
    xml.tag! 'storedCredentials', 'usage' => 'FIRST'
  else
    reason = case options[:stored_credential][:reason_type]
             when 'installment' then 'INSTALMENT'
             when 'recurring' then 'RECURRING'
             when 'unscheduled' then 'UNSCHEDULED'
             end

    xml.tag! 'storedCredentials', 'usage' => 'USED', 'merchantInitiatedReason' => reason do
      xml.tag! 'schemeTransactionIdentifier', options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
    end
  end
end
add_three_d_secure(three_d_secure, xml) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 312
def add_three_d_secure(three_d_secure, xml)
  xml.tag! 'info3DSecure' do
    xml.tag! 'threeDSVersion', three_d_secure[:version]
    if three_d_secure[:version] =~ /^2/
      xml.tag! 'dsTransactionId', three_d_secure[:ds_transaction_id]
    else
      xml.tag! 'xid', three_d_secure[:xid]
    end
    xml.tag! 'cavv', three_d_secure[:cavv]
    xml.tag! 'eci', three_d_secure[:eci]
  end
end
address_with_defaults(address) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 426
def address_with_defaults(address)
  address ||= {}
  address.delete_if { |_, v| v.blank? }
  address.reverse_merge!(default_address)
end
authorization_from(action, raw, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 555
def authorization_from(action, raw, options)
  order_id = order_id_from(raw)

  case action
  when 'store'
    authorization_from_token_details(
      order_id: order_id,
      token_id: raw[:payment_token_id],
      token_scope: 'shopper',
      customer: options[:customer]
    )
  else
    order_id
  end
end
authorization_from_token_details(options={}) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 576
def authorization_from_token_details(options={})
  [options[:order_id], options[:token_id], options[:token_scope], options[:customer]].join('|')
end
authorize_request(money, payment_method, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 135
def authorize_request(money, payment_method, options)
  commit('authorize', build_authorization_request(money, payment_method, options), 'AUTHORISED', options)
end
build_authorization_request(money, payment_method, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 191
def build_authorization_request(money, payment_method, options)
  build_request do |xml|
    xml.tag! 'submit' do
      xml.tag! 'order', order_tag_attributes(options) do
        xml.description(options[:description].blank? ? 'Purchase' : options[:description])
        add_amount(xml, money, options)
        if options[:order_content]
          xml.tag! 'orderContent' do
            xml.cdata! options[:order_content]
          end
        end
        add_payment_method(xml, money, payment_method, options)
        add_shopper(xml, options)
        if options[:hcg_additional_data]
          add_hcg_additional_data(xml, options)
        end
        if options[:instalments]
          add_instalments_data(xml, options)
        end
      end
    end
  end
end
build_capture_request(money, authorization, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 219
def build_capture_request(money, authorization, options)
  build_order_modify_request(authorization) do |xml|
    xml.tag! 'capture' do
      time = Time.now
      xml.tag! 'date', 'dayOfMonth' => time.day, 'month' => time.month, 'year'=> time.year
      add_amount(xml, money, options)
    end
  end
end
build_order_inquiry_request(authorization, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 183
def build_order_inquiry_request(authorization, options)
  build_request do |xml|
    xml.tag! 'inquiry' do
      xml.tag! 'orderInquiry', 'orderCode' => authorization
    end
  end
end
build_order_modify_request(authorization) { |xml| ... } click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 173
def build_order_modify_request(authorization)
  build_request do |xml|
    xml.tag! 'modify' do
      xml.tag! 'orderModification', 'orderCode' => authorization do
        yield xml
      end
    end
  end
end
build_refund_request(money, authorization, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 235
def build_refund_request(money, authorization, options)
  build_order_modify_request(authorization) do |xml|
    xml.tag! 'refund' do
      add_amount(xml, money, options.merge(:debit_credit_indicator => 'credit'))
    end
  end
end
build_request() { |xml| ... } click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 163
def build_request
  xml = Builder::XmlMarkup.new :indent => 2
  xml.instruct! :xml, :encoding => 'UTF-8'
  xml.declare! :DOCTYPE, :paymentService, :PUBLIC, '-//WorldPay//DTD WorldPay PaymentService v1//EN', 'http://dtd.worldpay.com/paymentService_v1.dtd'
  xml.tag! 'paymentService', 'version' => '1.4', 'merchantCode' => @options[:login] do
    yield xml
  end
  xml.target!
end
build_store_request(credit_card, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 243
def build_store_request(credit_card, options)
  build_request do |xml|
    xml.tag! 'submit' do
      xml.tag! 'paymentTokenCreate' do
        add_authenticated_shopper_id(xml, options)
        xml.tag! 'createToken'
        xml.tag! 'paymentInstrument' do
          xml.tag! 'cardDetails' do
            add_card(xml, credit_card, options)
          end
        end
      end
    end
  end
end
build_void_request(authorization, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 229
def build_void_request(authorization, options)
  build_order_modify_request(authorization) do |xml|
    xml.tag! 'cancel'
  end
end
cancel_request(authorization, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 143
def cancel_request(authorization, options)
  commit('cancel', build_void_request(authorization, options), :ok, options)
end
capture_request(money, authorization, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 139
def capture_request(money, authorization, options)
  commit('capture', build_capture_request(money, authorization, options), :ok, options)
end
card_code_for(payment_method) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 629
def card_code_for(payment_method)
  CARD_CODES[card_brand(payment_method)] || CARD_CODES['unknown']
end
commit(action, request, *success_criteria, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 473
def commit(action, request, *success_criteria, options)
  xml = ssl_post(url, request, headers(options))
  raw = parse(action, xml)
  if options[:execute_threed]
    raw[:cookie] = @cookie
    raw[:session_id] = options[:session_id]
  end
  success = success_from(action, raw, success_criteria)
  message = message_from(success, raw, success_criteria)

  Response.new(
    success,
    message,
    raw,
    :authorization => authorization_from(action, raw, options),
    :error_code => error_code_from(success, raw),
    :test => test?,
    :avs_result => AVSResult.new(code: AVS_CODE_MAP[raw[:avs_result_code_description]]),
    :cvv_result => CVVResult.new(CVC_CODE_MAP[raw[:cvc_result_code_description]])
  )
rescue ActiveMerchant::ResponseError => e
  if e.response.code.to_s == '401'
    return Response.new(false, 'Invalid credentials', {}, :test => test?)
  else
    raise e
  end
end
credit_fund_transfer_attribute(options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 613
def credit_fund_transfer_attribute(options)
  return unless options[:credit]
  {'action' => 'REFUND'}
end
credit_request(money, payment_method, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 155
def credit_request(money, payment_method, options)
  commit('credit', build_authorization_request(money, payment_method, options), :ok, 'SENT_FOR_REFUND', options)
end
currency_exponent(currency) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 623
def currency_exponent(currency)
  return 0 if non_fractional_currency?(currency)
  return 3 if three_decimal_currency?(currency)
  return 2
end
default_address() click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 432
def default_address
  {
    address1: 'N/A',
    zip: '0000',
    city: 'N/A',
    state: 'N/A',
    country: 'US'
  }
end
encoded_credentials() click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 618
def encoded_credentials
  credentials = "#{@options[:login]}:#{@options[:password]}"
  "Basic #{[credentials].pack('m').strip}"
end
error_code_from(success, raw) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 543
def error_code_from(success, raw)
  unless success == 'SUCCESS'
    raw[:iso8583_return_code_code] || raw[:error_code] || nil
  end
end
handle_response(response) click to toggle source

Override the regular handle response so we can access the headers Set-Cookie value is needed for 3DS transactions

# File lib/active_merchant/billing/gateways/worldpay.rb, line 507
def handle_response(response)
  case response.code.to_i
  when 200...300
    @cookie = response['Set-Cookie']
    response.body
  else
    raise ResponseError.new(response)
  end
end
headers(options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 462
def headers(options)
  headers = {
    'Content-Type' => 'text/xml',
    'Authorization' => encoded_credentials
  }
  if options[:cookie]
    headers['Cookie'] = options[:cookie] if options[:cookie]
  end
  headers
end
inquire_request(authorization, options, *success_criteria) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 147
def inquire_request(authorization, options, *success_criteria)
  commit('inquiry', build_order_inquiry_request(authorization, options), *success_criteria, options)
end
message_from(success, raw, success_criteria) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 521
def message_from(success, raw, success_criteria)
  return 'SUCCESS' if success
  raw[:iso8583_return_code_description] || raw[:error] || required_status_message(raw, success_criteria)
end
order_id_from(raw) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 571
def order_id_from(raw)
  pair = raw.detect { |k, v| k.to_s =~ /_order_code$/ }
  (pair ? pair.last : nil)
end
order_id_from_authorization(authorization) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 580
def order_id_from_authorization(authorization)
  token_details_from_authorization(authorization)[:order_id]
end
order_tag_attributes(options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 215
def order_tag_attributes(options)
  { 'orderCode' => options[:order_id], 'installationId' => options[:inst_id] || @options[:inst_id] }.reject { |_, v| !v }
end
parse(action, xml) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 442
def parse(action, xml)
  parse_element({:action => action}, REXML::Document.new(xml))
end
parse_element(raw, node) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 446
def parse_element(raw, node)
  node_name = node.name.underscore
  node.attributes.each do |k, v|
    raw["#{node_name}_#{k.underscore}".to_sym] = v
  end
  if node.has_elements?
    raw[node_name.to_sym] = true unless node.name.blank?
    node.elements.each { |e| parse_element(raw, e) }
  elsif node.children.count > 1
    raw[node_name.to_sym] = node.children.join(' ').strip
  else
    raw[node_name.to_sym] = node.text unless node.text.nil?
  end
  raw
end
payment_details_from(payment_method) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 596
def payment_details_from(payment_method)
  payment_details = {}
  if payment_method.respond_to?(:number)
    payment_details[:payment_type] = :credit
  else
    token_details = token_details_from_authorization(payment_method)
    payment_details.merge!(token_details)
    if token_details.has_key?(:token_id)
      payment_details[:payment_type] = :token
    else
      payment_details[:payment_type] = :pay_as_order
    end
  end

  payment_details
end
refund_request(money, authorization, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 151
def refund_request(money, authorization, options)
  commit('refund', build_refund_request(money, authorization, options), :ok, options)
end
required_status_message(raw, success_criteria) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 549
def required_status_message(raw, success_criteria)
  if(!success_criteria.include?(raw[:last_event]))
    "A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(" or ")} is required."
  end
end
store_request(credit_card, options) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 159
def store_request(credit_card, options)
  commit('store', build_store_request(credit_card, options), options)
end
success_criteria_success?(raw, success_criteria) click to toggle source

success_criteria can be:

- a string or an array of strings (if one of many responses)
- An array of strings if one of many responses could be considered a
  success.
# File lib/active_merchant/billing/gateways/worldpay.rb, line 530
def success_criteria_success?(raw, success_criteria)
  success_criteria.include?(raw[:last_event]) || raw[:ok].present?
end
success_from(action, raw, success_criteria) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 517
def success_from(action, raw, success_criteria)
  success_criteria_success?(raw, success_criteria) || action_success?(action, raw)
end
token_details_from_authorization(authorization) click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 584
def token_details_from_authorization(authorization)
  order_id, token_id, token_scope, customer = authorization.split('|')

  token_details = {}
  token_details[:order_id] = order_id if order_id.present?
  token_details[:token_id] = token_id if token_id.present?
  token_details[:token_scope] = token_scope if token_scope.present?
  token_details[:customer] = customer if customer.present?

  token_details
end
url() click to toggle source
# File lib/active_merchant/billing/gateways/worldpay.rb, line 501
def url
  test? ? self.test_url : self.live_url
end