Class: ActiveMerchant::Billing::BraspagGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::BraspagGateway
- Defined in:
- lib/active_merchant/billing/gateways/braspag.rb
Instance Method Summary collapse
- #authorize(money, creditcard, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ BraspagGateway
constructor
A new instance of BraspagGateway.
- #purchase(money, creditcard, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ BraspagGateway
Returns a new instance of BraspagGateway.
4 5 6 |
# File 'lib/active_merchant/billing/gateways/braspag.rb', line 4 def initialize( = {}) @options = end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/active_merchant/billing/gateways/braspag.rb', line 29 def (money, creditcard, = {}) = { :merchantId => merchant_id, :orderId => [:order_id], :customerName => full_name_from(creditcard), :amount => format_amount([:subtotal]), :paymentMethod => code_for_brand_of(creditcard), :holder => full_name_from(creditcard), :cardNumber => creditcard.number, :expiration => format_expiration_from(creditcard), :securityCode => creditcard.verification_value, :numberPayments => 1, :typePayment => 0 } = gateway. debugger if success?() capture_response = gateway.capture! :merchantId => merchant_id, :orderId => [:order_id] if success?() Response.new success?(), capture_response['message'], { :transaction_id => ['transactionId'] }, :authorization => ['authorisationNumber'] else Response.new false, ['message'] end end |
#purchase(money, creditcard, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_merchant/billing/gateways/braspag.rb', line 8 def purchase(money, creditcard, = {}) full_name = full_name_from creditcard = gateway. :merchantId => merchant_id, :orderId => [:order_id], :customerName => full_name, :amount => format_amount([:subtotal]), :paymentMethod => code_for_brand_of(creditcard), :holder => full_name, :cardNumber => creditcard[:number], :expiration => format_expiration_from(creditcard), :securityCode => creditcard[:verification_value], :numberPayments => 1, :typePayment => 0 if success?() capture_response = gateway.capture! :merchantId => merchant_id, :orderId => [:order_id] if success?() Response.new success?(), capture_response['message'], { :transaction_id => ['transactionId'] }, :authorization => ['authorisationNumber'] else Response.new false, ['message'] end end |