Class: ActiveMerchant::Billing::VancoGateway
- Includes:
- Empty
- Defined in:
- lib/active_merchant/billing/gateways/vanco.rb
Constant Summary collapse
- SECONDS_PER_DAY =
3600 * 24
- BUFFER_TIME_IN_SECS =
60 * 3
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 = {}) ⇒ VancoGateway
constructor
A new instance of VancoGateway.
- #purchase(money, payment_method, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #scrub(transcript) ⇒ 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
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ VancoGateway
Returns a new instance of VancoGateway.
21 22 23 24 |
# File 'lib/active_merchant/billing/gateways/vanco.rb', line 21 def initialize( = {}) requires!(, :user_id, :password, :client_id) super end |
Instance Method Details
#purchase(money, payment_method, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_merchant/billing/gateways/vanco.rb', line 26 def purchase(money, payment_method, = {}) moment_less_than_24_hours_ago = Time.now - SECONDS_PER_DAY - BUFFER_TIME_IN_SECS if [:session_id] && [:session_id][:created_at] >= moment_less_than_24_hours_ago commit(purchase_request(money, payment_method, [:session_id][:id], ), :response_transactionref) else MultiResponse.run do |r| r.process { login } r.process { commit(purchase_request(money, payment_method, r.params['response_sessionid'], ), :response_transactionref) } end end end |
#refund(money, authorization, options = {}) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/vanco.rb', line 39 def refund(money, , = {}) MultiResponse.run do |r| r.process { login } r.process { commit(refund_request(money, , r.params['response_sessionid']), :response_creditrequestreceived) } end end |
#scrub(transcript) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/active_merchant/billing/gateways/vanco.rb', line 50 def scrub(transcript) transcript. gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2'). gsub(%r((<CardCVV2>).+(</CardCVV2>))i, '\1[FILTERED]\2'). gsub(%r((<AccountNumber>).+(</AccountNumber>))i, '\1[FILTERED]\2') end |
#supports_scrubbing? ⇒ Boolean
46 47 48 |
# File 'lib/active_merchant/billing/gateways/vanco.rb', line 46 def supports_scrubbing? true end |