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
-
#redact(pm_profile_id) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(payment, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#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
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
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 34
def authorize(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
add_billing_address(post, options)
add_merchant_details(post, options)
add_customer_data(post, payment, options) unless payment.is_a?(String)
add_three_d_secure(post, payment, options) if options[:three_d_secure]
add_stored_credential(post, options) if options[:stored_credential]
commit(:post, 'auths', post, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
47
48
49
50
51
52
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 47
def capture(money, authorization, options = {})
post = {}
add_invoice(post, money, options)
commit(:post, "auths/#{authorization}/settlements", post, options)
end
|
#credit(money, payment, options = {}) ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 69
def credit(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
commit(:post, 'standalonecredits', post, options)
end
|
#purchase(money, payment, options = {}) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 18
def purchase(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
add_billing_address(post, options)
add_merchant_details(post, options)
add_airline_travel_details(post, options)
add_customer_data(post, payment, options) unless payment.is_a?(String)
add_three_d_secure(post, payment, options) if options[:three_d_secure]
add_stored_credential(post, options) if options[:stored_credential]
add_split_pay_details(post, options)
post[:settleWithAuth] = true
commit(:post, 'auths', post, options)
end
|
#redact(pm_profile_id) ⇒ Object
97
98
99
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 97
def redact(pm_profile_id)
commit_for_redact(:delete, "profiles/#{pm_profile_id}", nil, nil)
end
|
#refund(money, authorization, options = {}) ⇒ Object
54
55
56
57
58
59
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 54
def refund(money, authorization, options = {})
post = {}
add_invoice(post, money, options)
commit(:post, "settlements/#{authorization}/refunds", post, options)
end
|
#scrub(transcript) ⇒ Object
105
106
107
108
109
110
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 105
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
87
88
89
90
91
92
93
94
95
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 87
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
101
102
103
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 101
def supports_scrubbing?
true
end
|
#verify(payment, options = {}) ⇒ Object
This is a ‘$0 auth’ done at a specific verification endpoint at the gateway
78
79
80
81
82
83
84
85
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 78
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
61
62
63
64
65
66
67
|
# File 'lib/active_merchant/billing/gateways/paysafe.rb', line 61
def void(authorization, options = {})
post = {}
money = options[:amount]
add_invoice(post, money, options)
commit(:post, "auths/#{authorization}/voidauths", post, options)
end
|