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
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
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
A new instance of SmartPs.
- #purchase(money, payment_source, options = {}) ⇒ Object
- #refund(money, 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.
- #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, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ SmartPs
Returns a new instance of SmartPs.
11 12 13 14 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 11 def initialize( = {}) requires!(, :login, :password) super end |
Instance Method Details
#amend(auth, options = {}) ⇒ Object
Amend an existing transaction
101 102 103 104 105 106 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 101 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 32 33 |
# 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, ) add_currency(post, money, ) add_taxes(post, ) add_processor(post, ) commit('auth', money, post) end |
#capture(money, authorization, options = {}) ⇒ Object
49 50 51 52 53 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 49 def capture(money, , = {}) post = {} post[:transactionid] = commit('capture', money, post) end |
#credit(money, payment_source, options = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 61 def credit(money, payment_source, = {}) post = {} add_invoice(post, ) add_payment_source(post, payment_source, ) add_address(post, [:billing_address] || [:address]) add_customer_data(post, ) add_sku(post, ) add_currency(post, money, ) add_processor(post, ) commit('credit', money, post) end |
#delete(vault_id) ⇒ Object Also known as: unstore
108 109 110 111 112 113 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 108 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
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 35 def purchase(money, payment_source, = {}) post = {} add_invoice(post, ) add_payment_source(post, payment_source, ) add_address(post, [:billing_address] || [:address]) add_address(post, [:shipping_address], 'shipping') add_customer_data(post, ) add_currency(post, money, ) add_taxes(post, ) add_processor(post, ) add_eci(post, ) commit('sale', money, post) end |
#refund(money, auth, options = {}) ⇒ Object
73 74 75 76 77 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 73 def refund(money, auth, = {}) post = {} add_transaction(post, auth) commit('refund', money, post) end |
#store(payment_source, options = {}) ⇒ Object
To match the other stored-value gateways, like TrustCommerce, store and unstore need to be defined
117 118 119 120 121 122 123 124 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 117 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.
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 89 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, [:billing_address] || [:address]) add_customer_data(post, ) commit(nil, nil, post) end |
#verify(credit_card, options = {}) ⇒ Object
79 80 81 82 83 84 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 79 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
55 56 57 58 59 |
# File 'lib/active_merchant/billing/gateways/smart_ps.rb', line 55 def void(, = {}) post = {} post[:transactionid] = commit('void', nil, post) end |