solidus_oxxo_pay 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +26 -0
- data/README.md +42 -0
- data/Rakefile +21 -0
- data/app/assets/images/oxxopay_brand.png +0 -0
- data/app/assets/javascripts/spree/backend/solidus_oxxo_pay.js +2 -0
- data/app/assets/javascripts/spree/frontend/solidus_oxxo_pay.js +2 -0
- data/app/assets/stylesheets/spree/backend/solidus_oxxo_pay.css +4 -0
- data/app/assets/stylesheets/spree/frontend/solidus_oxxo_pay.css +122 -0
- data/app/controllers/spree/conekta_oxxo_controller.rb +19 -0
- data/app/helpers/spree/base_helper_decorator.rb +9 -0
- data/app/models/spree/conekta_oxxo_payment.rb +96 -0
- data/app/models/spree/payment_method/conekta_oxxo.rb +25 -0
- data/app/policies/payment_oxxo_policy.rb +14 -0
- data/app/views/spree/admin/payments/source_forms/_conektaoxxo.html.erb +12 -0
- data/app/views/spree/admin/payments/source_views/_conektaoxxo.html.erb +13 -0
- data/app/views/spree/checkout/payment/_conektaoxxo.html.erb +11 -0
- data/app/views/spree/checkout/payment_label/_conektaoxxo_label.html.erb +3 -0
- data/app/views/spree/conekta/payments/_conekta_oxxo.html.erb +29 -0
- data/app/views/spree/conekta_oxxo/receipt.html.erb +14 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20181121200357_create_conekta_oxxo_payments.rb +12 -0
- data/lib/generators/solidus_oxxo_pay/install/install_generator.rb +30 -0
- data/lib/solidus_oxxo_pay.rb +4 -0
- data/lib/solidus_oxxo_pay/engine.rb +25 -0
- data/lib/solidus_oxxo_pay/factories.rb +6 -0
- data/lib/solidus_oxxo_pay/version.rb +3 -0
- metadata +314 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4a67c8525d3ca13b4ef0c58656688a7ce4b0d12926e27bfafef78c7404ee104c
|
4
|
+
data.tar.gz: 19023765bd1f752e8f844fb3e7ca5b4a69a6239ad3d14c6e716e0094027f4020
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c73e5c4b115b1b53b7b497ec5ec571e88ec6278ad3b17f485aa5ee908d0439e62529ed1670a3eeb31c45b801085b76c124e452dd55d367333f2c04d5041ec5b6
|
7
|
+
data.tar.gz: cdbaa65fd03881925198e2103773df9a85acb4386f20e610dd50639ab6f685bbcbbbae8a5643c4bb95064f4d2c80ebc550d117581c934e02a5dc2f7b8e84259c
|
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2018 Magmalabs
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name Spree nor the names of its contributors may be used to
|
13
|
+
endorse or promote products derived from this software without specific
|
14
|
+
prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
20
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
[](https://travis-ci.org/magma-labs/solidus_oxxo_pay)
|
2
|
+
|
3
|
+
SolidusOxxoPay
|
4
|
+
==============
|
5
|
+
|
6
|
+
This extensions allows process payments using mexican payment Conekta Oxxo
|
7
|
+
|
8
|
+
Installation
|
9
|
+
------------
|
10
|
+
|
11
|
+
Add solidus_oxxo_pay to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'solidus_oxxo_pay'
|
15
|
+
```
|
16
|
+
|
17
|
+
Bundle your dependencies and run the installation generator:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
bundle
|
21
|
+
bundle exec rails g solidus_oxxo_pay:install
|
22
|
+
```
|
23
|
+
|
24
|
+
Testing
|
25
|
+
-------
|
26
|
+
|
27
|
+
First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs, and [Rubocop](https://github.com/bbatsov/rubocop) static code analysis. The dummy app can be regenerated by using `rake test_app`.
|
28
|
+
|
29
|
+
```shell
|
30
|
+
bundle
|
31
|
+
bundle exec rake test_app
|
32
|
+
bundle exec rake
|
33
|
+
```
|
34
|
+
|
35
|
+
When testing your applications integration with this extension you may use it's factories.
|
36
|
+
Simply add this require statement to your spec_helper:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'solidus_oxxo_pay/factories'
|
40
|
+
```
|
41
|
+
|
42
|
+
Copyright (c) 2018 Magmalabs, released under the MIT License
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'spree/testing_support/extension_rake'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
task :default do
|
10
|
+
if Dir["spec/dummy"].empty?
|
11
|
+
Rake::Task[:test_app].invoke
|
12
|
+
Dir.chdir("../../")
|
13
|
+
end
|
14
|
+
Rake::Task[:spec].invoke
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Generates a dummy app for testing'
|
18
|
+
task :test_app do
|
19
|
+
ENV['LIB_NAME'] = 'solidus_oxxo_pay'
|
20
|
+
Rake::Task['extension:test_app'].invoke
|
21
|
+
end
|
Binary file
|
@@ -0,0 +1,122 @@
|
|
1
|
+
.opps-title {
|
2
|
+
margin-bottom: 10px;
|
3
|
+
font-size: 15px;
|
4
|
+
font-weight: 600;
|
5
|
+
text-transform: uppercase;
|
6
|
+
}
|
7
|
+
|
8
|
+
.opps {
|
9
|
+
width: 496px;
|
10
|
+
border-radius: 4px;
|
11
|
+
box-sizing: border-box;
|
12
|
+
padding: 0 45px;
|
13
|
+
margin: 40px auto;
|
14
|
+
overflow: hidden;
|
15
|
+
border: 1px solid #b0afb5;
|
16
|
+
font-family: 'Open Sans', sans-serif;
|
17
|
+
color: #4f5365;
|
18
|
+
}
|
19
|
+
|
20
|
+
.opps-reminder {
|
21
|
+
position: relative;
|
22
|
+
top: -1px;
|
23
|
+
padding: 9px 0 10px;
|
24
|
+
font-size: 11px;
|
25
|
+
text-transform: uppercase;
|
26
|
+
text-align: center;
|
27
|
+
color: #ffffff;
|
28
|
+
background: #000000;
|
29
|
+
}
|
30
|
+
|
31
|
+
.opps-info {
|
32
|
+
margin-top: 26px;
|
33
|
+
position: relative;
|
34
|
+
}
|
35
|
+
|
36
|
+
.opps-info:after {
|
37
|
+
visibility: hidden;
|
38
|
+
display: block;
|
39
|
+
font-size: 0;
|
40
|
+
content: " ";
|
41
|
+
clear: both;
|
42
|
+
height: 0;
|
43
|
+
|
44
|
+
}
|
45
|
+
|
46
|
+
.opps-brand {
|
47
|
+
width: 45%;
|
48
|
+
float: left;
|
49
|
+
}
|
50
|
+
|
51
|
+
.opps-brand img {
|
52
|
+
max-width: 150px;
|
53
|
+
margin-top: 2px;
|
54
|
+
}
|
55
|
+
|
56
|
+
.opps-ammount {
|
57
|
+
width: 55%;
|
58
|
+
float: right;
|
59
|
+
}
|
60
|
+
|
61
|
+
.opps-ammount h2 {
|
62
|
+
font-size: 36px;
|
63
|
+
color: #000000;
|
64
|
+
line-height: 24px;
|
65
|
+
margin-bottom: 15px;
|
66
|
+
}
|
67
|
+
|
68
|
+
.opps-ammount h2 sup {
|
69
|
+
font-size: 16px;
|
70
|
+
position: relative;
|
71
|
+
top: -2px
|
72
|
+
}
|
73
|
+
|
74
|
+
.opps-ammount p {
|
75
|
+
font-size: 10px;
|
76
|
+
line-height: 14px;
|
77
|
+
}
|
78
|
+
|
79
|
+
.opps-reference {
|
80
|
+
margin-top: 14px;
|
81
|
+
}
|
82
|
+
|
83
|
+
.opps-reference {
|
84
|
+
font-size: 27px;
|
85
|
+
color: #000000;
|
86
|
+
text-align: center;
|
87
|
+
margin-top: -1px;
|
88
|
+
padding: 6px 0 7px;
|
89
|
+
border: 1px solid #b0afb5;
|
90
|
+
border-radius: 4px;
|
91
|
+
background: #f8f9fa;
|
92
|
+
}
|
93
|
+
|
94
|
+
.opps-instructions {
|
95
|
+
margin: 32px -45px 0;
|
96
|
+
padding: 32px 45px 45px;
|
97
|
+
border-top: 1px solid #b0afb5;
|
98
|
+
background: #f8f9fa;
|
99
|
+
}
|
100
|
+
|
101
|
+
.steps-list {
|
102
|
+
margin: 17px 0 0 16px;
|
103
|
+
}
|
104
|
+
|
105
|
+
li + li {
|
106
|
+
margin-top: 10px;
|
107
|
+
color: #000000;
|
108
|
+
}
|
109
|
+
|
110
|
+
.oxxo-print-button {
|
111
|
+
color: #1155cc;
|
112
|
+
}
|
113
|
+
|
114
|
+
.opps-footnote {
|
115
|
+
margin-top: 22px;
|
116
|
+
padding: 22px 20 24px;
|
117
|
+
color: #108f30;
|
118
|
+
text-align: center;
|
119
|
+
border: 1px solid #108f30;
|
120
|
+
border-radius: 4px;
|
121
|
+
background: #ffffff;
|
122
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spree
|
2
|
+
class ConektaOxxoController < StoreController
|
3
|
+
skip_before_action :verify_authenticity_token
|
4
|
+
|
5
|
+
def create
|
6
|
+
if params[:data][:object][:object] == 'charge' && params[:data][:object][:status] == 'paid'
|
7
|
+
payment = Spree::Payment.find_by(response_code: params[:data][:object][:payment_method][:reference])
|
8
|
+
policy = PaymentOxxoPolicy.new(payment)
|
9
|
+
policy.process(params[:data][:object])
|
10
|
+
end
|
11
|
+
head :ok
|
12
|
+
end
|
13
|
+
|
14
|
+
def receipt
|
15
|
+
@payment = Spree::Payment.find(params[:id])
|
16
|
+
render layout: false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Spree::BaseHelper
|
2
|
+
def conekta_oxxo_receipt(order = nil)
|
3
|
+
@order ||= order
|
4
|
+
if @order.paid_with?('Oxxo')
|
5
|
+
response_code = @order.payments&.last.response_code
|
6
|
+
render partial: 'spree/conekta/payments/conekta_oxxo', locals: { order: @order, response_code: response_code }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Spree
|
2
|
+
class ConektaOxxoPayment < Spree::PaymentSource
|
3
|
+
attr_accessor :server, :test_mode, :api_key
|
4
|
+
|
5
|
+
def authorize(money, creditcard, gateway_options)
|
6
|
+
|
7
|
+
::Conekta.api_key = api_key
|
8
|
+
::Conekta.api_version = "2.0.0"
|
9
|
+
|
10
|
+
order = Spree::Order.find_by(number: creditcard.number)
|
11
|
+
|
12
|
+
begin
|
13
|
+
response = ::Conekta::Order.create(payload(order))
|
14
|
+
creditcard.update_attribute :conekta_order_id, response.id
|
15
|
+
ActiveMerchant::Billing::Response.new(true, 'Orden creada satisfactoriamente', {}, parse_response(response))
|
16
|
+
rescue ::Conekta::Error => error
|
17
|
+
ActiveMerchant::Billing::Response.new(false, error.details.map(&:message).join(', '))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def name
|
22
|
+
'Oxxo Pay'
|
23
|
+
end
|
24
|
+
|
25
|
+
def month
|
26
|
+
payment_method.updated_at.month
|
27
|
+
end
|
28
|
+
|
29
|
+
def year
|
30
|
+
payment_method.updated_at.year
|
31
|
+
end
|
32
|
+
|
33
|
+
def cc_type
|
34
|
+
'N/A'
|
35
|
+
end
|
36
|
+
|
37
|
+
def last_digits
|
38
|
+
'N/A'
|
39
|
+
end
|
40
|
+
|
41
|
+
def actions
|
42
|
+
%w(void)
|
43
|
+
end
|
44
|
+
|
45
|
+
def gateway_customer_profile_id
|
46
|
+
user_id
|
47
|
+
end
|
48
|
+
|
49
|
+
def gateway_payment_profile_id
|
50
|
+
id
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def payload(order)
|
55
|
+
{
|
56
|
+
currency: 'MXN',
|
57
|
+
customer_info: {
|
58
|
+
name: order.ship_address.full_name,
|
59
|
+
email: order.email,
|
60
|
+
phone: order.ship_address.phone
|
61
|
+
},
|
62
|
+
charges: [
|
63
|
+
{
|
64
|
+
payment_method: {
|
65
|
+
type: 'oxxo_cash'
|
66
|
+
}
|
67
|
+
}
|
68
|
+
],
|
69
|
+
line_items: order_line_items(order),
|
70
|
+
shipping_lines: shipping_lines(order),
|
71
|
+
shipping_contact: {
|
72
|
+
address: {
|
73
|
+
street1: order.ship_address.address1,
|
74
|
+
postal_code: order.ship_address.zipcode,
|
75
|
+
country: 'mx'
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
def order_line_items(order)
|
82
|
+
order.line_items.map { |li| {name: li.product.name, unit_price: (li.price * 100).to_i, quantity: li.quantity} }
|
83
|
+
end
|
84
|
+
|
85
|
+
def parse_response(response)
|
86
|
+
{
|
87
|
+
authorization: response.charges.first.payment_method.reference,
|
88
|
+
conekta_order_id: response.id
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
def shipping_lines(order)
|
93
|
+
order.shipments.map {|s| {id: s.id, carrier: s.shipping_method.name, amount: (s.cost * 100).to_i} }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Spree
|
2
|
+
class PaymentMethod::ConektaOxxo < Spree::PaymentMethod
|
3
|
+
preference :api_key, :string, default: ''
|
4
|
+
|
5
|
+
def payment_profiles_supported?
|
6
|
+
false
|
7
|
+
end
|
8
|
+
|
9
|
+
def source_required?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def gateway_class
|
14
|
+
Spree::ConektaOxxoPayment
|
15
|
+
end
|
16
|
+
|
17
|
+
def payment_source_class
|
18
|
+
Spree::ConektaOxxoPayment
|
19
|
+
end
|
20
|
+
|
21
|
+
def auto_capture?
|
22
|
+
false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class PaymentOxxoPolicy
|
2
|
+
attr_reader :payment
|
3
|
+
|
4
|
+
def initialize(payment)
|
5
|
+
@payment = payment
|
6
|
+
end
|
7
|
+
|
8
|
+
def process(options)
|
9
|
+
return unless options[:status].eql?('paid')
|
10
|
+
|
11
|
+
payment.complete if (options[:amount].to_i/100 - payment.amount).abs < 0.01
|
12
|
+
payment.order.updater.update
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<fieldset>
|
2
|
+
<legend align="center">Oxxo Pay</legend>
|
3
|
+
<div class="opps-info text-center">
|
4
|
+
<div class="opps-brand">
|
5
|
+
<%= image_tag 'oxxopay_brand.png', alt: 'OXXOPay' %>
|
6
|
+
</div>
|
7
|
+
<% param_prefix = "payment_source[#{payment_method.id}]" %>
|
8
|
+
<%= hidden_field_tag "#{param_prefix}[first_name]", @order.ship_address&.first_name %>
|
9
|
+
<%= hidden_field_tag "#{param_prefix}[last_name]", @order.ship_address&.last_name %>
|
10
|
+
<%= hidden_field_tag "#{param_prefix}[number]", @order.number %>
|
11
|
+
</div>
|
12
|
+
</fieldset>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<fieldset>
|
2
|
+
<legend align="center">Oxxo Pay</legend>
|
3
|
+
<div class="opps-info text-center">
|
4
|
+
<div class="opps-brand">
|
5
|
+
<%= image_tag 'oxxopay_brand.png', alt: 'OXXOPay' %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class="opps-reference">
|
9
|
+
<h3>Referencia</h3>
|
10
|
+
<h1><%= payment.response_code.to_s.scan(/.{1,4}/).join('-') %></h1>
|
11
|
+
</div>
|
12
|
+
<%= link_to t('payment.print_ticket'), oxxo_pay_receipt_path(id: payment.id), target: 'new', class: 'eyecatcher-link__text' %>
|
13
|
+
</fieldset>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="twelve rows alpha omega center">
|
3
|
+
<div class="payment-label-title">Oxxo Pay</div>
|
4
|
+
<p class="payment-label-description">Al completar tu compra se te entregará un número de referencia para que puedas
|
5
|
+
pagar en tu tienda Oxxo más cercana</p>
|
6
|
+
<% param_prefix = "payment_source[#{payment_method.id}]" %>
|
7
|
+
<%= hidden_field_tag "#{param_prefix}[first_name]", current_order.ship_address&.first_name %>
|
8
|
+
<%= hidden_field_tag "#{param_prefix}[last_name]", current_order.ship_address&.last_name %>
|
9
|
+
<%= hidden_field_tag "#{param_prefix}[number]", current_order&.number %>
|
10
|
+
</div>
|
11
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<div class="opps">
|
2
|
+
<div class="opps-header">
|
3
|
+
<div class="opps-info">
|
4
|
+
<div class="opps-brand">
|
5
|
+
<%= image_tag 'oxxopay_brand.png', alt: 'OXXOPay', class: 'summary-oxxo-image' %>
|
6
|
+
</div>
|
7
|
+
<div class="opps-ammount">
|
8
|
+
<h3 class="opps-title">Monto a pagar</h3>
|
9
|
+
<h2><%= order.display_total %> <sup>MXN</sup></h2>
|
10
|
+
<p>OXXO cobrará una comisión adicional al momento de realizar el pago.</p>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<div class="opps-reference">
|
14
|
+
<h3 class="opps-reference-title">Referencia</h3>
|
15
|
+
<h1 class="opps-reference"><%= response_code.scan(/.{1,4}/).join('-') %></h1>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div class="opps-instructions">
|
19
|
+
<h3>Instrucciones</h3>
|
20
|
+
<ol class="steps-list">
|
21
|
+
<li>Acude a la tienda OXXO más cercana. <a href="https://www.google.com.mx/maps/search/oxxo/" target="_blank">Encuéntrala aquí</a>.</li>
|
22
|
+
<li>Indica en caja que quieres realizar un pago de <strong>OXXOPay</strong>.</li>
|
23
|
+
<li>Dicta al cajero el número de referencia en esta ficha para que tecleé directamete en la pantalla de venta.</li>
|
24
|
+
<li>Realiza el pago correspondiente con dinero en efectivo.</li>
|
25
|
+
<li>Al confirmar tu pago, el cajero te entregará un comprobante impreso. <strong>En el podrás verificar que se haya realizado correctamente.</strong> Conserva este comprobante de pago.</li>
|
26
|
+
</ol>
|
27
|
+
<div class="opps-footnote">Al completar estos pasos recibirás un correo confirmando tu pago.</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<%= stylesheet_link_tag 'oxxo_pay', media: 'all', 'data-turbolinks-track': 'false' %>
|
4
|
+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700" rel="stylesheet">
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<%= conekta_oxxo_receipt(@payment.order) %>
|
8
|
+
</body>
|
9
|
+
<script type="text/javascript" charset="utf-8">
|
10
|
+
document.addEventListener('DOMContentLoaded', function () {
|
11
|
+
window.print();
|
12
|
+
});
|
13
|
+
</script>
|
14
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateConektaOxxoPayments < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :spree_conekta_oxxo_payments do |t|
|
4
|
+
t.references :payment_method
|
5
|
+
t.string :number
|
6
|
+
t.string :conekta_order_id
|
7
|
+
t.string :first_name
|
8
|
+
t.string :last_name
|
9
|
+
t.integer :user_id
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module SolidusOxxoPay
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
class_option :auto_run_migrations, type: :boolean, default: false
|
5
|
+
|
6
|
+
def add_javascripts
|
7
|
+
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_oxxo_pay\n"
|
8
|
+
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_oxxo_pay\n"
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_stylesheets
|
12
|
+
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_oxxo_pay\n", before: /\*\//, verbose: true
|
13
|
+
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_oxxo_pay\n", before: /\*\//, verbose: true
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_migrations
|
17
|
+
run 'bundle exec rake railties:install:migrations FROM=solidus_oxxo_pay'
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_migrations
|
21
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
|
22
|
+
if run_migrations
|
23
|
+
run 'bundle exec rake db:migrate'
|
24
|
+
else
|
25
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SolidusOxxoPay
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
require 'spree/core'
|
4
|
+
isolate_namespace Spree
|
5
|
+
engine_name 'solidus_oxxo_pay'
|
6
|
+
|
7
|
+
# use rspec for tests
|
8
|
+
config.generators do |g|
|
9
|
+
g.test_framework :rspec
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer 'spree_payment_network.register.payment_methods' do |app|
|
13
|
+
app.config.spree.payment_methods << Spree::PaymentMethod::ConektaOxxo
|
14
|
+
app.config.assets.precompile += %w( oxxopay_brand.png )
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.activate
|
18
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
19
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
config.to_prepare(&method(:activate).to_proc)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
|
3
|
+
#
|
4
|
+
# Example adding this to your spec_helper will load these Factories for use:
|
5
|
+
# require 'solidus_oxxo_pay/factories'
|
6
|
+
end
|
metadata
ADDED
@@ -0,0 +1,314 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solidus_oxxo_pay
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Magmalabs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: solidus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: solidus_support
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: deface
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: conekta
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: capybara
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: capybara-screenshot
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: poltergeist
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: coffee-rails
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: sass-rails
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: database_cleaner
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: ffaker
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: factory_bot
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: rspec-rails
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: rubocop
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: 0.49.0
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: 0.49.0
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: rubocop-rspec
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - '='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: 1.4.0
|
222
|
+
type: :development
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - '='
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 1.4.0
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: simplecov
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0'
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: sqlite3
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - "~>"
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 1.3.6
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 1.3.6
|
257
|
+
description: This extension process payments using the Conekta Oxxo payment method
|
258
|
+
email: developers@magmalabs.io
|
259
|
+
executables: []
|
260
|
+
extensions: []
|
261
|
+
extra_rdoc_files: []
|
262
|
+
files:
|
263
|
+
- LICENSE
|
264
|
+
- README.md
|
265
|
+
- Rakefile
|
266
|
+
- app/assets/images/oxxopay_brand.png
|
267
|
+
- app/assets/javascripts/spree/backend/solidus_oxxo_pay.js
|
268
|
+
- app/assets/javascripts/spree/frontend/solidus_oxxo_pay.js
|
269
|
+
- app/assets/stylesheets/spree/backend/solidus_oxxo_pay.css
|
270
|
+
- app/assets/stylesheets/spree/frontend/solidus_oxxo_pay.css
|
271
|
+
- app/controllers/spree/conekta_oxxo_controller.rb
|
272
|
+
- app/helpers/spree/base_helper_decorator.rb
|
273
|
+
- app/models/spree/conekta_oxxo_payment.rb
|
274
|
+
- app/models/spree/payment_method/conekta_oxxo.rb
|
275
|
+
- app/policies/payment_oxxo_policy.rb
|
276
|
+
- app/views/spree/admin/payments/source_forms/_conektaoxxo.html.erb
|
277
|
+
- app/views/spree/admin/payments/source_views/_conektaoxxo.html.erb
|
278
|
+
- app/views/spree/checkout/payment/_conektaoxxo.html.erb
|
279
|
+
- app/views/spree/checkout/payment_label/_conektaoxxo_label.html.erb
|
280
|
+
- app/views/spree/conekta/payments/_conekta_oxxo.html.erb
|
281
|
+
- app/views/spree/conekta_oxxo/receipt.html.erb
|
282
|
+
- config/locales/en.yml
|
283
|
+
- config/routes.rb
|
284
|
+
- db/migrate/20181121200357_create_conekta_oxxo_payments.rb
|
285
|
+
- lib/generators/solidus_oxxo_pay/install/install_generator.rb
|
286
|
+
- lib/solidus_oxxo_pay.rb
|
287
|
+
- lib/solidus_oxxo_pay/engine.rb
|
288
|
+
- lib/solidus_oxxo_pay/factories.rb
|
289
|
+
- lib/solidus_oxxo_pay/version.rb
|
290
|
+
homepage: https://www.magmalabs.io/
|
291
|
+
licenses:
|
292
|
+
- MIT
|
293
|
+
metadata: {}
|
294
|
+
post_install_message:
|
295
|
+
rdoc_options: []
|
296
|
+
require_paths:
|
297
|
+
- lib
|
298
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
299
|
+
requirements:
|
300
|
+
- - ">="
|
301
|
+
- !ruby/object:Gem::Version
|
302
|
+
version: '0'
|
303
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
304
|
+
requirements:
|
305
|
+
- - ">="
|
306
|
+
- !ruby/object:Gem::Version
|
307
|
+
version: '0'
|
308
|
+
requirements: []
|
309
|
+
rubyforge_project:
|
310
|
+
rubygems_version: 2.7.6
|
311
|
+
signing_key:
|
312
|
+
specification_version: 4
|
313
|
+
summary: A solidus extension to process payments via Conekta Oxxo
|
314
|
+
test_files: []
|