Class: ActiveMerchant::Billing::PaysafeGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::PaysafeGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/paysafe.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
-
#authorize(money, payment, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#credit(money, payment, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ PaysafeGateway
constructor
A new instance of PaysafeGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(payment, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#unstore(pm_profile_id) ⇒ Object
-
#verify(payment, options = {}) ⇒ Object
This is a ‘$0 auth’ done at a specific verification endpoint at the gateway.
-
#void(authorization, options = {}) ⇒ Object
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?
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of PaysafeGateway.
13
14
15
16
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 13
def initialize(options = {})
requires!(options, :username, :password, :account_id)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
28
29
30
31
32
33
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 28
def authorize(money, payment, options = {})
post = {}
add_auth_purchase_params(post, money, payment, options)
commit(:post, 'auths', post, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
35
36
37
38
39
40
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 35
def capture(money, authorization, options = {})
post = {}
add_invoice(post, money, options)
commit(:post, "auths/#{authorization}/settlements", post, options)
end
|
#credit(money, payment, options = {}) ⇒ Object
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 57
def credit(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
add_customer_data(post, payment, options) unless payment.is_a?(String)
add_merchant_details(post, options)
add_billing_address(post, options)
commit(:post, 'standalonecredits', post, options)
end
|
#purchase(money, payment, options = {}) ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 18
def purchase(money, payment, options = {})
post = {}
add_auth_purchase_params(post, money, payment, options)
add_airline_travel_details(post, options)
add_split_pay_details(post, options)
post[:settleWithAuth] = true
commit(:post, 'auths', post, options)
end
|
#refund(money, authorization, options = {}) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 42
def refund(money, authorization, options = {})
post = {}
add_invoice(post, money, options)
commit(:post, "settlements/#{authorization}/refunds", post, options)
end
|
#scrub(transcript) ⇒ Object
96
97
98
99
100
101
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 96
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )[a-zA-Z0-9:_]+), '\1[FILTERED]').
gsub(%r(("cardNum\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
end
|
#store(payment, options = {}) ⇒ Object
78
79
80
81
82
83
84
85
86
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 78
def store(payment, options = {})
post = {}
add_payment(post, payment)
add_address_for_vaulting(post, options)
add_profile_data(post, payment, options)
add_store_data(post, payment, options)
commit(:post, 'profiles', post, options)
end
|
#supports_scrubbing? ⇒ Boolean
92
93
94
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 92
def supports_scrubbing?
true
end
|
#unstore(pm_profile_id) ⇒ Object
88
89
90
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 88
def unstore(pm_profile_id)
commit(:delete, "profiles/#{get_id_from_store_auth(pm_profile_id)}", nil, nil)
end
|
#verify(payment, options = {}) ⇒ Object
This is a ‘$0 auth’ done at a specific verification endpoint at the gateway
69
70
71
72
73
74
75
76
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 69
def verify(payment, options = {})
post = {}
add_payment(post, payment)
add_billing_address(post, options)
add_customer_data(post, payment, options) unless payment.is_a?(String)
commit(:post, 'verifications', post, options)
end
|
#void(authorization, options = {}) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 49
def void(authorization, options = {})
post = {}
money = options[:amount]
add_invoice(post, money, options)
commit(:post, "auths/#{authorization}/voidauths", post, options)
end
|