Class: ActiveMerchant::Billing::WorldNetGateway
- Defined in:
- lib/active_merchant/billing/gateways/world_net.rb
Overview
Constant Summary collapse
- CARD_TYPES =
{ visa: 'VISA', master: 'MASTERCARD', discover: 'DISCOVER', american_express: 'AMEX', maestro: 'MAESTRO', diners_club: 'DINERS', jcb: 'JCB', secure_card: 'SECURECARD' }.freeze
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
- #authorize(money, payment, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ WorldNetGateway
constructor
A new instance of WorldNetGateway.
- #purchase(money, payment, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
- #scrub(transcript) ⇒ Object
- #store(payment, options = {}) ⇒ Object
- #supports_scrubbing? ⇒ Boolean
- #unstore(payment, options = {}) ⇒ 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?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ WorldNetGateway
Returns a new instance of WorldNetGateway.
28 29 30 31 32 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 28 def initialize( = {}) requires!(, :terminal_id, :secret) [:terminal_type] ||= 2 # eCommerce super end |
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 46 def (money, payment, = {}) requires!(, :order_id) post = {} add_invoice(post, money, ) add_payment(post, payment) add_address(post, payment, ) add_customer_data(post, ) commit('PREAUTH', post) end |
#capture(money, authorization, options = {}) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 58 def capture(money, , = {}) post = {} add_invoice(post, money, ) post[:uniqueref] = commit('PREAUTHCOMPLETION', post) end |
#purchase(money, payment, options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 34 def purchase(money, payment, = {}) requires!(, :order_id) post = {} add_invoice(post, money, ) add_payment(post, payment) add_address(post, payment, ) add_customer_data(post, ) commit('PAYMENT', post) end |
#refund(money, authorization, options = {}) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 66 def refund(money, , = {}) requires!(, :operator, :reason) post = {} post[:uniqueref] = add_invoice(post, money, ) post[:operator] = [:operator] post[:reason] = [:reason] commit('REFUND', post) end |
#scrub(transcript) ⇒ Object
115 116 117 118 119 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 115 def scrub(transcript) transcript. gsub(%r{(<CARDNUMBER>\d{6})\d+(\d{4}</CARDNUMBER>)}, '\1...\2'). gsub(%r{(<CVV>)\d+(</CVV)}, '\1...\2') end |
#store(payment, options = {}) ⇒ Object
91 92 93 94 95 96 97 98 99 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 91 def store(payment, = {}) requires!(, :order_id) post = {} post[:merchantref] = [:order_id] add_payment(post, payment) commit('SECURECARDREGISTRATION', post) end |
#supports_scrubbing? ⇒ Boolean
111 112 113 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 111 def supports_scrubbing? true end |
#unstore(payment, options = {}) ⇒ Object
101 102 103 104 105 106 107 108 109 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 101 def unstore(payment, = {}) requires!(, :order_id) post = {} post[:merchantref] = [:order_id] add_card_reference(post, payment) commit('SECURECARDREMOVAL', post) end |
#verify(credit_card, options = {}) ⇒ Object
84 85 86 87 88 89 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 84 def verify(credit_card, = {}) MultiResponse.run(:use_first_response) do |r| r.process { (100, credit_card, ) } r.process(:ignore_result) { void(r., ) } end end |
#void(authorization, _options = {}) ⇒ Object
78 79 80 81 82 |
# File 'lib/active_merchant/billing/gateways/world_net.rb', line 78 def void(, = {}) post = {} post[:uniqueref] = commit('VOID', post) end |