Class: ActiveMerchant::Billing::PayboxDirectGateway
- Defined in:
- lib/active_merchant/billing/gateways/paybox_direct.rb
Constant Summary collapse
- API_VERSION =
Payment API Version
'00103'
- TRANSACTIONS =
Transactions hash
{ authorization: '00001', capture: '00002', purchase: '00003', unreferenced_credit: '00004', void: '00005', refund: '00014' }
- CURRENCY_CODES =
{ 'AUD' => '036', 'CAD' => '124', 'CZK' => '203', 'DKK' => '208', 'HKD' => '344', 'ICK' => '352', 'JPY' => '392', 'NOK' => '578', 'SGD' => '702', 'SEK' => '752', 'CHF' => '756', 'GBP' => '826', 'USD' => '840', 'EUR' => '978', 'XPF' => '953' }
- SUCCESS_CODES =
['00000']
- UNAVAILABILITY_CODES =
%w[00001 00097 00098]
- SUCCESS_MESSAGE =
'The transaction was approved'
- FAILURE_MESSAGE =
'The transaction failed'
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
- #add_3dsecure(post, options) ⇒ Object
- #authorize(money, creditcard, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
- #credit(money, identification, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ PayboxDirectGateway
constructor
A new instance of PayboxDirectGateway.
- #purchase(money, creditcard, options = {}) ⇒ Object
- #refund(money, identification, options = {}) ⇒ Object
- #void(identification, 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, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #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 = {}) ⇒ PayboxDirectGateway
Returns a new instance of PayboxDirectGateway.
62 63 64 65 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 62 def initialize( = {}) requires!(, :login, :password) super end |
Instance Method Details
#add_3dsecure(post, options) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 67 def add_3dsecure(post, ) # ECI=02 => MasterCard success # ECI=05 => Visa, Amex or JCB success if [:eci] == '02' || [:eci] == '05' post[:"3DSTATUS"] = 'Y' post[:"3DENROLLED"] = 'Y' post[:"3DSIGNVAL"] = 'Y' post[:"3DERROR"] = '0' else post[:"3DSTATUS"] = 'N' post[:"3DENROLLED"] = 'N' post[:"3DSIGNVAL"] = 'N' post[:"3DERROR"] = '10000' end post[:"3DECI"] = [:eci] post[:"3DXID"] = [:xid] post[:"3DCAVV"] = [:cavv] post[:"3DCAVVALGO"] = [:cavv_algorithm] end |
#authorize(money, creditcard, options = {}) ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 87 def (money, creditcard, = {}) post = {} add_invoice(post, ) add_creditcard(post, creditcard) add_3dsecure(post, [:three_d_secure]) if [:three_d_secure] add_amount(post, money, ) commit('authorization', money, post) end |
#capture(money, authorization, options = {}) ⇒ Object
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 107 def capture(money, , = {}) requires!(, :order_id) post = {} add_invoice(post, ) add_amount(post, money, ) post[:numappel] = [0, 10] post[:numtrans] = [10, 10] commit('capture', money, post) end |
#credit(money, identification, options = {}) ⇒ Object
130 131 132 133 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 130 def credit(money, identification, = {}) ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE refund(money, identification, ) end |
#purchase(money, creditcard, options = {}) ⇒ Object
97 98 99 100 101 102 103 104 105 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 97 def purchase(money, creditcard, = {}) post = {} add_invoice(post, ) add_creditcard(post, creditcard) add_3dsecure(post, [:three_d_secure]) if [:three_d_secure] add_amount(post, money, ) commit('purchase', money, post) end |
#refund(money, identification, options = {}) ⇒ Object
135 136 137 138 139 140 141 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 135 def refund(money, identification, = {}) post = {} add_invoice(post, ) add_reference(post, identification) add_amount(post, money, ) commit('refund', money, post) end |
#void(identification, options = {}) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/active_merchant/billing/gateways/paybox_direct.rb', line 118 def void(identification, = {}) requires!(, :order_id, :amount) post = {} add_invoice(post, ) add_reference(post, identification) add_amount(post, [:amount], ) post[:porteur] = '000000000000000' post[:dateval] = '0000' commit('void', [:amount], post) end |