Class: ActiveMerchant::Billing::XpayGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::XpayGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/xpay.rb
Constant Summary
collapse
- ENDPOINTS_MAPPING =
{
validation: 'orders/3steps/validation',
purchase: 'orders/3steps/payment',
authorize: 'orders/3steps/payment',
preauth: 'orders/3steps/init',
capture: 'operations/%s/captures',
verify: 'orders/card_verification',
refund: 'operations/%s/refunds'
}
- SUCCESS_MESSAGES =
%w(PENDING AUTHORIZED THREEDS_VALIDATED EXECUTED).freeze
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(amount, credit_card, options = {}) ⇒ Object
-
#capture(amount, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ XpayGateway
constructor
A new instance of XpayGateway.
-
#preauth(amount, credit_card, options = {}) ⇒ Object
-
#purchase(amount, credit_card, options = {}) ⇒ Object
-
#refund(amount, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(credit_card, 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?
#fetch_version, included
#expdate, #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 = {}) ⇒ XpayGateway
Returns a new instance of XpayGateway.
30
31
32
33
34
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 30
def initialize(options = {})
requires!(options, :api_key)
@api_key = options[:api_key]
super
end
|
Instance Method Details
#authorize(amount, credit_card, options = {}) ⇒ Object
44
45
46
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 44
def authorize(amount, credit_card, options = {})
complete_order_request(:authorize, amount, credit_card, options)
end
|
#capture(amount, authorization, options = {}) ⇒ Object
48
49
50
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 48
def capture(amount, authorization, options = {})
operation_request(:capture, amount, authorization, options)
end
|
#preauth(amount, credit_card, options = {}) ⇒ Object
36
37
38
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 36
def preauth(amount, credit_card, options = {})
order_request(:preauth, amount, {}, credit_card, options)
end
|
#purchase(amount, credit_card, options = {}) ⇒ Object
40
41
42
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 40
def purchase(amount, credit_card, options = {})
complete_order_request(:purchase, amount, credit_card, options)
end
|
#refund(amount, authorization, options = {}) ⇒ Object
52
53
54
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 52
def refund(amount, authorization, options = {})
operation_request(:refund, amount, authorization, options)
end
|
#scrub(transcript) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 68
def scrub(transcript)
transcript.
gsub(%r((X-Api-Key: )(\w|-)+), '\1[FILTERED]').
gsub(%r(("pan\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
64
65
66
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 64
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/active_merchant/billing/gateways/xpay.rb', line 56
def verify(credit_card, options = {})
post = {}
add_invoice(post, 0, options)
add_customer_data(post, credit_card, options)
add_credit_card(post, credit_card)
commit(:verify, post, options)
end
|