Class: ActiveMerchant::Billing::RapydGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::RapydGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/rapyd.rb
Constant Summary
collapse
- USA_PAYMENT_METHODS =
%w[us_debit_discover_card us_debit_mastercard_card us_debit_visa_card us_ach_bank]
- STANDARD_ERROR_CODE_MAPPING =
{}
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
-
#initialize(options = {}) ⇒ RapydGateway
constructor
A new instance of RapydGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(payment, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#unstore(customer) ⇒ Object
-
#verify(credit_card, options = {}) ⇒ Object
-
#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
#initialize(options = {}) ⇒ RapydGateway
Returns a new instance of RapydGateway.
23
24
25
26
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 23
def initialize(options = {})
requires!(options, :secret_key, :access_key)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 36
def authorize(money, payment, options = {})
post = {}
add_auth_purchase(post, money, payment, options)
post[:capture] = false unless payment.is_a?(Check)
commit(:post, 'payments', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
44
45
46
47
48
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 44
def capture(money, authorization, options = {})
post = {}
add_idempotency(options)
commit(:post, "payments/#{add_reference(authorization)}/capture", post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 28
def purchase(money, payment, options = {})
post = {}
add_auth_purchase(post, money, payment, options)
post[:capture] = true unless payment.is_a?(Check)
commit(:post, 'payments', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 50
def refund(money, authorization, options = {})
post = {}
post[:payment] = add_reference(authorization)
add_invoice(post, money, options)
add_metadata(post, options)
add_ewallet(post, options)
add_idempotency(options)
commit(:post, 'refunds', post)
end
|
#scrub(transcript) ⇒ Object
92
93
94
95
96
97
98
99
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 92
def scrub(transcript)
transcript.
gsub(%r((Access_key: )\w+), '\1[FILTERED]').
gsub(%r(("number\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("account_number\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("routing_number\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
end
|
#store(payment, options = {}) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 71
def store(payment, options = {})
post = {}
add_payment(post, payment, options)
add_customer_data(post, payment, options, 'store')
add_metadata(post, options)
add_ewallet(post, options)
add_payment_fields(post, options)
add_payment_urls(post, options, 'store')
add_address(post, payment, options)
add_idempotency(options)
commit(:post, 'customers', post)
end
|
#supports_scrubbing? ⇒ Boolean
88
89
90
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 88
def supports_scrubbing?
true
end
|
#unstore(customer) ⇒ Object
84
85
86
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 84
def unstore(customer)
commit(:delete, "customers/#{add_reference(customer)}", {})
end
|
#verify(credit_card, options = {}) ⇒ Object
67
68
69
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 67
def verify(credit_card, options = {})
authorize(0, credit_card, options)
end
|
#void(authorization, options = {}) ⇒ Object
61
62
63
64
65
|
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 61
def void(authorization, options = {})
post = {}
add_idempotency(options)
commit(:delete, "payments/#{add_reference(authorization)}", post)
end
|