Class: ActiveMerchant::Billing::SmartPs
- Defined in:
- lib/active_merchant/billing/gateways/smart_ps.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary
Constants inherited from Gateway
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#amend(auth, options = {}) ⇒ Object
Amend an existing transaction.
-
#authorize(money, creditcard, options = {}) ⇒ Object
Pass :store => true in the options to store the payment info at the gateway and get a generated customer_vault_id in the response.
- #capture(money, authorization, options = {}) ⇒ Object
- #credit(money, payment_source, options = {}) ⇒ Object
- #delete(vault_id) ⇒ Object (also: #unstore)
-
#initialize(options = {}) ⇒ SmartPs
constructor
This is the base gateway for processors who use the smartPS processing system.
- #purchase(money, payment_source, options = {}) ⇒ Object
- #refund(auth, options = {}) ⇒ Object
-
#store(payment_source, options = {}) ⇒ Object
To match the other stored-value gateways, like TrustCommerce, store and unstore need to be defined.
-
#update(vault_id, creditcard, options = {}) ⇒ Object
Update the values (such as CC expiration) stored at the gateway.
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from Utils
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
#initialize(options = {}) ⇒ SmartPs
This is the base gateway for processors who use the smartPS processing system
10 11 12 13 14 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 10 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Method Details
#amend(auth, options = {}) ⇒ Object
Amend an existing transaction
89 90 91 92 93 94 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 89 def amend(auth, = {}) post = {} add_invoice(post, ) add_transaction(post, auth) commit('update', nil, post) end |
#authorize(money, creditcard, options = {}) ⇒ Object
Pass :store => true in the options to store the payment info at the gateway and get a generated customer_vault_id in the response.
Pass :store => some_number_or_string to specify the customer_vault_id the gateway should use (make sure it’s unique).
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 22 def (money, creditcard, = {}) post = {} add_invoice(post, ) add_payment_source(post, creditcard,) add_address(post, [:billing_address]||[:address]) add_address(post, [:shipping_address],"shipping") add_customer_data(post, ) commit('auth', money, post) end |
#capture(money, authorization, options = {}) ⇒ Object
44 45 46 47 48 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 44 def capture(money, , = {}) post ={} post[:transactionid] = commit('capture', money, post) end |
#credit(money, payment_source, options = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 56 def credit(money, payment_source, = {}) post = {} add_invoice(post, ) add_payment_source(post, payment_source, ) add_address(post, ) add_customer_data(post, ) add_sku(post,) commit('credit', money, post) end |
#delete(vault_id) ⇒ Object Also known as: unstore
97 98 99 100 101 102 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 97 def delete(vault_id) post = {} post[:customer_vault] = "delete_customer" add_customer_vault_id(post, vault_id) commit(nil, nil, post) end |
#purchase(money, payment_source, options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 33 def purchase(money, payment_source, = {}) post = {} add_invoice(post, ) add_payment_source(post, payment_source, ) add_address(post, ) add_address(post, [:shipping_address],"shipping") add_customer_data(post, ) commit('sale', money, post) end |
#refund(auth, options = {}) ⇒ Object
67 68 69 70 71 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 67 def refund(auth, = {}) post = {} add_transaction(post, auth) commit('refund', .delete(:amount), post) end |
#store(payment_source, options = {}) ⇒ Object
To match the other stored-value gateways, like TrustCommerce, store and unstore need to be defined
106 107 108 109 110 111 112 113 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 106 def store(payment_source, = {}) post = {} billing_id = .delete(:billing_id).to_s || true add_payment_source(post, payment_source, :store => billing_id) add_address(post, [:billing_address] || [:address]) add_customer_data(post, ) commit(nil, nil, post) end |
#update(vault_id, creditcard, options = {}) ⇒ Object
Update the values (such as CC expiration) stored at the gateway. The CC number must be supplied in the CreditCard object.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 77 def update(vault_id, creditcard, = {}) post = {} post[:customer_vault] = "update_customer" add_customer_vault_id(post, vault_id) add_creditcard(post, creditcard, ) add_address(post, ) add_customer_data(post, ) commit(nil, nil, post) end |
#void(authorization, options = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 50 def void(, = {}) post ={} post[:transactionid] = commit('void', nil, post) end |