Class: ActiveMerchant::Billing::MultiPayGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/multi_pay.rb

Constant Summary collapse

CURRENCY_CODES =
{
  'CLP' => '152',
  'USD' => '840'
}
ERROR_MAPPING =
{
  1 => 'Call Issuer',
  2  => 'Call Ref.',
  3  => 'Invalid business-03',
  4  => 'Hold Card',
  5  => 'Reject Card',
  6  => 'Error-Call',
  8  => 'Identify Client',
  9  => 'Request in progress',
  11  => 'VIP-11 approved ',
  12  => 'Invalid transaction',
  13  => 'Amount invalid',
  14  => 'invalid card',
  15  => 'No such issuer',
  19  => 'Repeat transaction',
  21  => 'No transactions-21',
  25  => 'Invalid ID-25',
  30  => 'Format Error',
  31  => 'Invalid bench',
  33  => 'Collect Expired Card',
  34  => 'Collect Expired Card',
  35  => 'Collect Card-35',
  36  => 'Collect Card-36',
  37  => 'Collect Card-37',
  38  => 'Allowable PIN tries exceeded',
  39  => 'No credit account',
  41  => 'Lost Card-41',
  43  => 'Stolen Card-43',
  51  => 'Insufficient Funds',
  52  => 'Without Check Account'
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?

Methods included from Versionable

#fetch_version, included

Methods included from CreditCardFormatting

#format, #strftime_yyyymm, #strftime_yyyymmdd_last_day

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ MultiPayGateway

Returns a new instance of MultiPayGateway.



53
54
55
56
57
58
59
60
61
62
# File 'lib/active_merchant/billing/gateways/multi_pay.rb', line 53

def initialize(options = {})
  requires!(options, :company, :branch, :pos)
  super

  @company = options[:company]
  @branch = options[:branch]
  @pos = options[:pos]
  @user = options[:user]
  @password = options[:password]
end

Instance Method Details

#authorize(money, payment, options = {}) ⇒ Object



64
65
66
67
# File 'lib/active_merchant/billing/gateways/multi_pay.rb', line 64

def authorize(money, payment, options = {})
  request_data = build_request_data(money, payment, options, 'AuthorizeSale')
  commit('AuthorizeSale', { AuthorizeSale: request_data })
end

#capture(money, authorization, options = {}) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/active_merchant/billing/gateways/multi_pay.rb', line 69

def capture(money, authorization, options = {})
  post = {
    Settlement: {
      RequestType: 'Settlement',
      SystemIdentification: '1.0.0',
      CompanyIdentification: @company,
      BranchIdentification: @branch,
      POSIdentification: @pos,
      UserID: options[:user_id],
      Reference: options[:order_id],
      Amount: money,
      OrigReference: authorization
    }.compact
  }

  commit('Settlement', post)
end

#purchase(money, payment, options = {}) ⇒ Object



87
88
89
90
# File 'lib/active_merchant/billing/gateways/multi_pay.rb', line 87

def purchase(money, payment, options = {})
  request_data = build_request_data(money, payment, options, 'Sale')
  commit('Sale', { Sale: request_data })
end

#scrub(transcript) ⇒ Object



96
97
98
99
100
101
# File 'lib/active_merchant/billing/gateways/multi_pay.rb', line 96

def scrub(transcript)
  transcript.
    gsub(/(Authorization: (Bearer|Basic) )\S+/, '\1[FILTERED]').
    gsub(/(\\?"CardNumber\\?":\\?")\d+/, '\1[FILTERED]').
    gsub(/(\\?"SecurityCode\\?":\\?")\d+/, '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/active_merchant/billing/gateways/multi_pay.rb', line 92

def supports_scrubbing?
  true
end