Class: ActiveMerchant::Billing::DigitzsGateway
- Includes:
- Empty
- Defined in:
- lib/active_merchant/billing/gateways/digitzs.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
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ DigitzsGateway
constructor
A new instance of DigitzsGateway.
- #purchase(money, payment, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #scrub(transcript) ⇒ Object
- #store(payment, options = {}) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
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, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ DigitzsGateway
Returns a new instance of DigitzsGateway.
17 18 19 20 |
# File 'lib/active_merchant/billing/gateways/digitzs.rb', line 17 def initialize( = {}) requires!(, :app_key, :api_key) super end |
Instance Method Details
#purchase(money, payment, options = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/active_merchant/billing/gateways/digitzs.rb', line 22 def purchase(money, payment, = {}) MultiResponse.run do |r| r.process { commit('auth/token', app_token_request()) } r.process { commit('payments', purchase_request(money, payment, ), .merge({ app_token: app_token_from(r) })) } end end |
#refund(money, authorization, options = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/active_merchant/billing/gateways/digitzs.rb', line 29 def refund(money, , = {}) MultiResponse.run do |r| r.process { commit('auth/token', app_token_request()) } r.process { commit('payments', refund_request(money, , ), .merge({ app_token: app_token_from(r) })) } end end |
#scrub(transcript) ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/active_merchant/billing/gateways/digitzs.rb', line 59 def scrub(transcript) transcript. gsub(%r((Authorization: Bearer ).+), '\1[FILTERED]'). gsub(%r((X-Api-Key: )\w+), '\1[FILTERED]'). gsub(%r((\"id\\\":\\\").+), '\1[FILTERED]'). gsub(%r((\"appKey\\\":\\\").+), '\1[FILTERED]'). gsub(%r((\"appToken\\\":\\\").+), '\1[FILTERED]'). gsub(%r((\"code\\\":\\\")\d+), '\1[FILTERED]'). gsub(%r((\"number\\\":\\\")\d+), '\1[FILTERED]') end |
#store(payment, options = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/active_merchant/billing/gateways/digitzs.rb', line 36 def store(payment, = {}) MultiResponse.run do |r| r.process { commit('auth/token', app_token_request()) } [:app_token] = app_token_from(r) if [:customer_id].present? customer_id = check_customer_exists() if customer_id r.process { add_credit_card_to_customer(payment, ) } else r.process { add_customer_with_credit_card(payment, ) } end else r.process { add_customer_with_credit_card(payment, ) } end end end |
#supports_scrubbing? ⇒ Boolean
55 56 57 |
# File 'lib/active_merchant/billing/gateways/digitzs.rb', line 55 def supports_scrubbing? true end |