Class: ActiveMerchant::Billing::RapydGateway

Inherits:
Gateway
  • Object
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

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?

Methods included from CreditCardFormatting

#expdate, #format

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.



18
19
20
21
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 18

def initialize(options = {})
  requires!(options, :secret_key, :access_key)
  super
end

Instance Method Details

#authorize(money, payment, options = {}) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 31

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



39
40
41
42
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 39

def capture(money, authorization, options = {})
  post = {}
  commit(:post, "payments/#{add_reference(authorization)}/capture", post)
end

#purchase(money, payment, options = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 23

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



44
45
46
47
48
49
50
51
52
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 44

def refund(money, authorization, options = {})
  post = {}
  post[:payment] = add_reference(authorization)
  add_invoice(post, money, options)
  (post, options)
  add_ewallet(post, options)

  commit(:post, 'refunds', post)
end

#scrub(transcript) ⇒ Object



83
84
85
86
87
88
89
90
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 83

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



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 63

def store(payment, options = {})
  post = {}
  add_payment(post, payment, options)
  add_customer_data(post, payment, options, 'store')
  (post, options)
  add_ewallet(post, options)
  add_payment_fields(post, options)
  add_payment_urls(post, options, 'store')
  add_address(post, payment, options)
  commit(:post, 'customers', post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 79

def supports_scrubbing?
  true
end

#unstore(customer) ⇒ Object



75
76
77
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 75

def unstore(customer)
  commit(:delete, "customers/#{add_reference(customer)}", {})
end

#verify(credit_card, options = {}) ⇒ Object



59
60
61
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 59

def verify(credit_card, options = {})
  authorize(0, credit_card, options)
end

#void(authorization, options = {}) ⇒ Object



54
55
56
57
# File 'lib/active_merchant/billing/gateways/rapyd.rb', line 54

def void(authorization, options = {})
  post = {}
  commit(:delete, "payments/#{add_reference(authorization)}", post)
end