Class: Spree::ConektaOxxoPayment
- Inherits:
-
PaymentSource
- Object
- PaymentSource
- Spree::ConektaOxxoPayment
- Defined in:
- app/models/spree/conekta_oxxo_payment.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#server ⇒ Object
Returns the value of attribute server.
-
#test_mode ⇒ Object
Returns the value of attribute test_mode.
Instance Method Summary collapse
- #actions ⇒ Object
- #authorize(_money, source, _gateway_options) ⇒ Object
- #cc_type ⇒ Object
- #gateway_customer_profile_id ⇒ Object
- #gateway_payment_profile_id ⇒ Object
- #last_digits ⇒ Object
- #month ⇒ Object
- #name ⇒ Object
- #year ⇒ Object
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 5 def api_key @api_key end |
#server ⇒ Object
Returns the value of attribute server.
5 6 7 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 5 def server @server end |
#test_mode ⇒ Object
Returns the value of attribute test_mode.
5 6 7 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 5 def test_mode @test_mode end |
Instance Method Details
#actions ⇒ Object
42 43 44 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 42 def actions %w(void) end |
#authorize(_money, source, _gateway_options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 7 def (_money, source, ) Conekta.api_key = api_key Conekta.api_version = '2.0.0' order = Spree::Order.find_by(number: source.number) begin response = Conekta::Order.create(payload(order)) source.update_attribute :conekta_order_id, response.id ActiveMerchant::Billing::Response.new(true, 'Orden creada satisfactoriamente', {}, parse_response(response)) rescue ::Conekta::Error => e ActiveMerchant::Billing::Response.new(false, e.details.map(&:message).join(', ')) end end |
#cc_type ⇒ Object
34 35 36 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 34 def cc_type 'N/A' end |
#gateway_customer_profile_id ⇒ Object
46 47 48 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 46 def gateway_customer_profile_id user_id end |
#gateway_payment_profile_id ⇒ Object
50 51 52 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 50 def gateway_payment_profile_id id end |
#last_digits ⇒ Object
38 39 40 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 38 def last_digits 'N/A' end |
#month ⇒ Object
26 27 28 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 26 def month payment_method.updated_at.month end |
#name ⇒ Object
22 23 24 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 22 def name 'Oxxo Pay' end |
#year ⇒ Object
30 31 32 |
# File 'app/models/spree/conekta_oxxo_payment.rb', line 30 def year payment_method.updated_at.year end |