Class: ActiveMerchant::Billing::BorgunGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::BorgunGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/borgun.rb
Constant Summary
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?, #supports_scrubbing?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ BorgunGateway
Returns a new instance of BorgunGateway.
19
20
21
22
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 19
def initialize(options={})
requires!(options, :processor, :merchant_id, :username, :password)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 32
def authorize(money, payment, options={})
post = {}
post[:TransType] = '5'
add_invoice(post, money, options)
add_payment_method(post, payment)
commit('authonly', post, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 40
def capture(money, authorization, options={})
post = {}
post[:TransType] = '1'
add_invoice(post, money, options)
add_reference(post, authorization)
commit('capture', post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 24
def purchase(money, payment, options={})
post = {}
post[:TransType] = '1'
add_invoice(post, money, options)
add_payment_method(post, payment)
commit('sale', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 48
def refund(money, authorization, options={})
post = {}
post[:TransType] = '3'
add_invoice(post, money, options)
add_reference(post, authorization)
commit('refund', post)
end
|
#scrub(transcript) ⇒ Object
71
72
73
74
75
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 71
def scrub(transcript)
transcript.gsub(%r((<PAN>)[^&]*(</PAN>))i, '\1[FILTERED]\2').
gsub(%r((<CVC2>)[^&]*(</CVC2>))i, '\1[FILTERED]\2').
gsub(%r(((?:\r\n)?Authorization: Basic )[^\r\n]+(\r\n)?), '\1[FILTERED]\2')
end
|
#supports_scrubbing ⇒ Object
67
68
69
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 67
def supports_scrubbing
true
end
|
#void(authorization, options = {}) ⇒ Object
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/active_merchant/billing/gateways/borgun.rb', line 56
def void(authorization, options={})
post = {}
_, _, _, _, _, transtype, tramount, currency = split_authorization(authorization)
post[:TransType] = transtype
options[:currency] = options[:currency] || CURRENCY_CODES.key(currency)
add_invoice(post, tramount.to_i, options)
add_reference(post, authorization)
commit('void', post)
end
|