stripe_wrapper 0.1.0 → 0.1.1
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 +4 -4
- data/app/assets/javascripts/stripe_wrapper/stripe_wrapper.js +43 -0
- data/app/assets/stylesheets/stripe_wrapper/stripe_wrapper.css.scss +178 -0
- data/app/controllers/stripe_wrapper/application_controller.rb +5 -0
- data/app/controllers/stripe_wrapper/charges_controller.rb +13 -3
- data/app/helpers/stripe_wrapper/stripe_wrapper_helper.rb +16 -0
- data/app/models/stripe_wrapper/charge.rb +13 -0
- data/app/models/stripe_wrapper/customer.rb +54 -0
- data/app/views/layouts/stripe_wrapper/_navigation.html.haml +8 -0
- data/app/views/layouts/stripe_wrapper/_navigation_links.html.haml +1 -0
- data/app/views/layouts/stripe_wrapper/_sidebar_navigation.html.haml +25 -0
- data/app/views/layouts/stripe_wrapper/application.html.haml +13 -0
- data/app/views/stripe_wrapper/charges/_pay.html.haml +5 -2
- data/app/views/stripe_wrapper/charges/index.html.haml +19 -0
- data/app/views/stripe_wrapper/customers/index.html.haml +26 -0
- data/config/locales/en.yml +13 -0
- data/config/locales/es.yml +13 -0
- data/config/routes.rb +3 -2
- data/db/migrate/20161215195603_create_stripe_wrapper_customers.rb +1 -0
- data/db/migrate/20161215195608_create_stripe_wrapper_charges.rb +2 -1
- data/lib/stripe_wrapper.rb +41 -1
- data/lib/stripe_wrapper/engine.rb +32 -0
- data/lib/stripe_wrapper/main_app_route_delegator.rb +24 -0
- data/lib/stripe_wrapper/version.rb +1 -1
- metadata +282 -11
- data/app/assets/javascripts/stripe_wrapper/application.js +0 -13
- data/app/assets/stylesheets/stripe_wrapper/application.css +0 -15
- data/app/helpers/stripe_wrapper/application_helper.rb +0 -4
- data/app/views/layouts/stripe_wrapper/application.html.erb +0 -14
- data/app/views/stripe_wrapper/customers/index.html.erb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87ddfc60d443529ba9bec7cc155419cc5d008e97
|
4
|
+
data.tar.gz: 012fdf68fc19719ffe4497394cd05016a604a55f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89f1357b645d0dc28f956d3e46b59d5faa20411bc0de78330da87fbff857b90a0db8db95dcc8fe58a301ad51c9e3b6631758c8803b686e39b05dce80dde71878
|
7
|
+
data.tar.gz: 272cea3206aee073a6999b3484be5a3b9e585df8c942395092ff4106d512cced7477c28cbb516e78cd928bbd147e0bf49e66e2d7807e020fecca8eb8147de222
|
@@ -0,0 +1,43 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
16
|
+
|
17
|
+
var stripeResponseHandler;
|
18
|
+
|
19
|
+
$(function() {
|
20
|
+
var $form;
|
21
|
+
$form = $('#stripe_wrapper_payment_form');
|
22
|
+
$form.submit(function(event) {
|
23
|
+
event.preventDefault();
|
24
|
+
$form.find('.submit').prop('disabled', true);
|
25
|
+
Stripe.card.createToken($form, stripeResponseHandler);
|
26
|
+
return false;
|
27
|
+
});
|
28
|
+
});
|
29
|
+
|
30
|
+
stripeResponseHandler = function(status, response) {
|
31
|
+
var $form, token;
|
32
|
+
$form = $('#stripe_wrapper_payment_form');
|
33
|
+
if (response.error) {
|
34
|
+
console.log("Payment Error");
|
35
|
+
$form.find('.payment-errors').text(response.error.message);
|
36
|
+
$form.find('.submit').prop('disabled', false);
|
37
|
+
} else {
|
38
|
+
console.log("No Payment Error");
|
39
|
+
token = response.id;
|
40
|
+
$('#stripe_token').val(token);
|
41
|
+
$form.get(0).submit();
|
42
|
+
}
|
43
|
+
};
|
@@ -0,0 +1,178 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
16
|
+
@import "bootstrap-sprockets";
|
17
|
+
@import "bootstrap";
|
18
|
+
|
19
|
+
body,html{
|
20
|
+
height: 100%;
|
21
|
+
}
|
22
|
+
.page-content{
|
23
|
+
padding: 0 8px;
|
24
|
+
}
|
25
|
+
.breakable-table{
|
26
|
+
word-break: break-word;
|
27
|
+
a{
|
28
|
+
word-break: normal;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
/* remove outer padding */
|
33
|
+
.main .row{
|
34
|
+
padding: 0px;
|
35
|
+
margin: 0px;
|
36
|
+
}
|
37
|
+
|
38
|
+
/*Remove rounded coners*/
|
39
|
+
|
40
|
+
nav.sidebar.navbar {
|
41
|
+
border-radius: 0px;
|
42
|
+
}
|
43
|
+
|
44
|
+
nav.sidebar, .main{
|
45
|
+
-webkit-transition: margin 200ms ease-out;
|
46
|
+
-moz-transition: margin 200ms ease-out;
|
47
|
+
-o-transition: margin 200ms ease-out;
|
48
|
+
transition: margin 200ms ease-out;
|
49
|
+
}
|
50
|
+
|
51
|
+
/* Add gap to nav and right windows.*/
|
52
|
+
.main{
|
53
|
+
padding: 10px 10px 0 10px;
|
54
|
+
}
|
55
|
+
|
56
|
+
/* .....NavBar: Icon only with coloring/layout.....*/
|
57
|
+
|
58
|
+
/*small/medium side display*/
|
59
|
+
@media (min-width: 768px) {
|
60
|
+
|
61
|
+
/*Allow main to be next to Nav*/
|
62
|
+
.main{
|
63
|
+
position: absolute;
|
64
|
+
width: calc(100% - 40px); /*keeps 100% minus nav size*/
|
65
|
+
margin-left: 40px;
|
66
|
+
float: right;
|
67
|
+
}
|
68
|
+
|
69
|
+
/*lets nav bar to be showed on mouseover*/
|
70
|
+
nav.sidebar:hover + .main{
|
71
|
+
margin-left: 200px;
|
72
|
+
}
|
73
|
+
|
74
|
+
/*Center Brand*/
|
75
|
+
nav.sidebar.navbar.sidebar>.container .navbar-brand, .navbar>.container-fluid .navbar-brand {
|
76
|
+
margin-left: 0px;
|
77
|
+
}
|
78
|
+
/*Center Brand*/
|
79
|
+
nav.sidebar .navbar-brand, nav.sidebar .navbar-header{
|
80
|
+
text-align: center;
|
81
|
+
width: 100%;
|
82
|
+
margin-left: 0px;
|
83
|
+
}
|
84
|
+
|
85
|
+
/*Center Icons*/
|
86
|
+
nav.sidebar a{
|
87
|
+
padding-right: 13px;
|
88
|
+
}
|
89
|
+
|
90
|
+
/*adds border top to first nav box */
|
91
|
+
nav.sidebar .navbar-nav > li:first-child{
|
92
|
+
border-top: 1px #e5e5e5 solid;
|
93
|
+
}
|
94
|
+
|
95
|
+
/*adds border to bottom nav boxes*/
|
96
|
+
nav.sidebar .navbar-nav > li{
|
97
|
+
border-bottom: 1px #e5e5e5 solid;
|
98
|
+
}
|
99
|
+
|
100
|
+
/* Colors/style dropdown box*/
|
101
|
+
nav.sidebar .navbar-nav .open .dropdown-menu {
|
102
|
+
position: static;
|
103
|
+
float: none;
|
104
|
+
width: auto;
|
105
|
+
margin-top: 0;
|
106
|
+
background-color: transparent;
|
107
|
+
border: 0;
|
108
|
+
-webkit-box-shadow: none;
|
109
|
+
box-shadow: none;
|
110
|
+
}
|
111
|
+
|
112
|
+
/*allows nav box to use 100% width*/
|
113
|
+
nav.sidebar .navbar-collapse, nav.sidebar .container-fluid{
|
114
|
+
padding: 0 0px 0 0px;
|
115
|
+
}
|
116
|
+
|
117
|
+
/*colors dropdown box text */
|
118
|
+
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
|
119
|
+
color: #777;
|
120
|
+
}
|
121
|
+
|
122
|
+
/*gives sidebar width/height*/
|
123
|
+
nav.sidebar{
|
124
|
+
width: 200px;
|
125
|
+
height: 100%;
|
126
|
+
margin-left: -160px;
|
127
|
+
float: left;
|
128
|
+
z-index: 8000;
|
129
|
+
margin-bottom: 0px;
|
130
|
+
}
|
131
|
+
|
132
|
+
/*give sidebar 100% width;*/
|
133
|
+
nav.sidebar li {
|
134
|
+
width: 100%;
|
135
|
+
}
|
136
|
+
|
137
|
+
/* Move nav to full on mouse over*/
|
138
|
+
nav.sidebar:hover{
|
139
|
+
margin-left: 0px;
|
140
|
+
}
|
141
|
+
/*for hiden things when navbar hidden*/
|
142
|
+
.forAnimate{
|
143
|
+
opacity: 0;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
/* .....NavBar: Fully showing nav bar..... */
|
148
|
+
|
149
|
+
@media (min-width: 1330px) {
|
150
|
+
|
151
|
+
/*Allow main to be next to Nav*/
|
152
|
+
.main{
|
153
|
+
width: calc(100% - 200px); /*keeps 100% minus nav size*/
|
154
|
+
margin-left: 200px;
|
155
|
+
}
|
156
|
+
|
157
|
+
/*Show all nav*/
|
158
|
+
nav.sidebar{
|
159
|
+
margin-left: 0px;
|
160
|
+
float: left;
|
161
|
+
}
|
162
|
+
/*Show hidden items on nav*/
|
163
|
+
nav.sidebar .forAnimate{
|
164
|
+
opacity: 1;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
nav.sidebar .navbar-nav .open .dropdown-menu>li>a:hover, nav.sidebar .navbar-nav .open .dropdown-menu>li>a:focus {
|
169
|
+
color: #CCC;
|
170
|
+
background-color: transparent;
|
171
|
+
}
|
172
|
+
|
173
|
+
nav:hover .forAnimate{
|
174
|
+
opacity: 1;
|
175
|
+
}
|
176
|
+
section{
|
177
|
+
padding-left: 15px;
|
178
|
+
}
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module StripeWrapper
|
2
2
|
class ApplicationController < ActionController::Base
|
3
|
+
include StripeWrapper::StripeWrapperHelper
|
3
4
|
protect_from_forgery with: :exception
|
5
|
+
|
6
|
+
def main_app_current_user
|
7
|
+
@current_user = User.find(main_app.scope.session["warden.user.user.key"].first[1]) rescue nil #FIXME find a proper way to get main_app current_user
|
8
|
+
end
|
4
9
|
end
|
5
10
|
end
|
@@ -3,12 +3,22 @@ require_dependency "stripe_wrapper/application_controller"
|
|
3
3
|
module StripeWrapper
|
4
4
|
class ChargesController < ApplicationController
|
5
5
|
|
6
|
+
def process_payment
|
7
|
+
@user = main_app_current_user
|
8
|
+
token = params[:stripe_token]
|
9
|
+
@amount = stripe_get_amount
|
10
|
+
redirect_url = params[:redirect_path]
|
6
11
|
|
7
|
-
|
8
|
-
|
12
|
+
@customer = Customer.find_or_create_customer(token,@user)
|
13
|
+
@charge = @customer.process_new_charge(@amount)
|
14
|
+
|
15
|
+
# abort
|
16
|
+
|
17
|
+
return redirect_to redirect_url+"?charge_id=#{@charge.id}"
|
9
18
|
end
|
19
|
+
|
10
20
|
def index
|
11
|
-
@charges = Charge.all
|
21
|
+
@charges = Charge.all.order("ID DESC")
|
12
22
|
end
|
13
23
|
|
14
24
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module StripeWrapper
|
2
|
+
module StripeWrapperHelper
|
3
|
+
def stripe_pay(route_url)
|
4
|
+
render partial: 'stripe_wrapper/charges/pay', locals:{redirect_url: route_url}
|
5
|
+
end
|
6
|
+
def stripe_wrapper_path
|
7
|
+
return StripeWrapper::Engine.routes.url_helpers
|
8
|
+
end
|
9
|
+
def stripe_set_amount(amount)
|
10
|
+
session[:stripe_payment_amount] = @amount.to_i
|
11
|
+
end
|
12
|
+
def stripe_get_amount
|
13
|
+
session[:stripe_payment_amount].to_i
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,4 +1,17 @@
|
|
1
1
|
module StripeWrapper
|
2
2
|
class Charge < ApplicationRecord
|
3
|
+
belongs_to :stripe_customer, class_name: 'Customer', foreign_key: 'customer_id'
|
4
|
+
has_one :user, through: :stripe_customer
|
5
|
+
|
6
|
+
def self.build_stripe_charge(stripe_charge)
|
7
|
+
return Charge.new(Charge.white_params(stripe_charge))
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
def self.white_params(stripe_charge)
|
12
|
+
params = ActionController::Parameters.new(stripe_charge.as_json)
|
13
|
+
params.permit(:object, :amount, :application, :application_fee,:balance_transaction,:captured,:created,:currency,:customer,:description,:cvc_check,:failure_code,:failude_message)
|
14
|
+
end
|
15
|
+
|
3
16
|
end
|
4
17
|
end
|
@@ -1,4 +1,58 @@
|
|
1
1
|
module StripeWrapper
|
2
2
|
class Customer < ApplicationRecord
|
3
|
+
|
4
|
+
belongs_to :user
|
5
|
+
has_many :charges
|
6
|
+
|
7
|
+
def to_s
|
8
|
+
self.user.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.get_customer(user)
|
12
|
+
Customer.find_by_user_id(user.id) rescue nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.build_stripe_customer(stripe_customer)
|
16
|
+
return Customer.new(Customer.white_params(stripe_customer))
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find_or_create_customer(token,user)
|
20
|
+
customer = Customer.get_customer(user)
|
21
|
+
|
22
|
+
return customer if customer.present?()
|
23
|
+
|
24
|
+
# If the customer is not present, we create it
|
25
|
+
|
26
|
+
stripe_customer = StripeWrapper.create_customer(token,user)
|
27
|
+
|
28
|
+
customer = Customer.build_stripe_customer(stripe_customer)
|
29
|
+
|
30
|
+
customer.customer_id = stripe_customer.id
|
31
|
+
customer.user_id = user.id
|
32
|
+
|
33
|
+
customer.save
|
34
|
+
|
35
|
+
return customer
|
36
|
+
end
|
37
|
+
|
38
|
+
def process_new_charge(amount,metadata={},currency='clp',description='')
|
39
|
+
begin
|
40
|
+
stripe_charge = StripeWrapper.create_charge(self.customer_id,nil,amount,currency,metadata,description)
|
41
|
+
charge = Charge.build_stripe_charge(stripe_charge)
|
42
|
+
charge.customer_id = self.id
|
43
|
+
if charge.save
|
44
|
+
return charge
|
45
|
+
else
|
46
|
+
return nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def self.white_params(stripe_customer)
|
53
|
+
params = ActionController::Parameters.new(stripe_customer.as_json)
|
54
|
+
params.permit(:customer_id, :account_balance, :created, :currency, :default_source, :delinquent, :description, :discount, :email, :livemode)
|
55
|
+
end
|
56
|
+
|
3
57
|
end
|
4
58
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
.container
|
2
|
+
.navbar-header
|
3
|
+
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", :type => "button"}
|
4
|
+
%span.sr-only Toggle navigation
|
5
|
+
%span.icon-bar
|
6
|
+
%span.icon-bar
|
7
|
+
%span.icon-bar
|
8
|
+
= link_to 'StripeWrapper', root_path, class: 'navbar-brand'
|
@@ -0,0 +1 @@
|
|
1
|
+
test
|
@@ -0,0 +1,25 @@
|
|
1
|
+
%nav.navbar.navbar-inverse.sidebar{:role => "navigation"}
|
2
|
+
.container-fluid
|
3
|
+
/ Brand and toggle get grouped for better mobile display
|
4
|
+
.navbar-header
|
5
|
+
%button.navbar-toggle{"data-target" => "#bs-sidebar-navbar-collapse-1", "data-toggle" => "collapse", :type => "button"}
|
6
|
+
%span.sr-only Toggle navigation
|
7
|
+
%span.icon-bar
|
8
|
+
%span.icon-bar
|
9
|
+
%span.icon-bar
|
10
|
+
%a.navbar-brand{:href => "#"} StripeWrapper
|
11
|
+
/ Collect the nav links, forms, and other content for toggling
|
12
|
+
#bs-sidebar-navbar-collapse-1.collapse.navbar-collapse
|
13
|
+
%ul.nav.navbar-nav
|
14
|
+
%li{class: controller.controller_name == 'home' ? 'active' : ''}
|
15
|
+
=link_to root_path do
|
16
|
+
=I18n.t('stripe_wrapper.menu.home')
|
17
|
+
%span.pull-right.hidden-xs.showopacity.glyphicon.glyphicon-home{:style => "font-size:16px;"}
|
18
|
+
%li{class: controller.controller_name == 'customers' ? 'active' : ''}
|
19
|
+
=link_to customers_path do
|
20
|
+
=I18n.t('stripe_wrapper.menu.customers')
|
21
|
+
%span.pull-right.hidden-xs.showopacity.glyphicon.glyphicon-user{:style => "font-size:16px;"}
|
22
|
+
%li{class: controller.controller_name == 'charges' ? 'active' : ''}
|
23
|
+
=link_to charges_path do
|
24
|
+
=I18n.t('stripe_wrapper.menu.charges')
|
25
|
+
%span.pull-right.hidden-xs.showopacity.glyphicon.glyphicon-usd{:style => "font-size:16px;"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}/
|
5
|
+
%title= content_for?(:title) ? yield(:title) : "StripeWrapper"
|
6
|
+
= stylesheet_link_tag 'stripe_wrapper/stripe_wrapper.css', media: 'all', 'data-turbolinks-track' => 'reload'
|
7
|
+
= javascript_include_tag 'stripe_wrapper/stripe_wrapper', 'data-turbolinks-track' => 'reload'
|
8
|
+
= csrf_meta_tags
|
9
|
+
%body
|
10
|
+
= render "layouts/stripe_wrapper/sidebar_navigation"
|
11
|
+
.main
|
12
|
+
.page-content
|
13
|
+
= yield
|
@@ -1,6 +1,9 @@
|
|
1
|
+
= stylesheet_link_tag "stripe_wrapper/stripe_wrapper", media: "all"
|
2
|
+
= javascript_include_tag "stripe_wrapper/stripe_wrapper"
|
1
3
|
= javascript_include_tag 'https://js.stripe.com/v2/'
|
2
|
-
= form_tag
|
4
|
+
= form_tag stripe_wrapper_path.process_payment_charges_path, method: :post, role:'form',id: 'stripe_wrapper_payment_form' do
|
3
5
|
=hidden_field_tag :stripe_token
|
6
|
+
=hidden_field_tag :redirect_path, redirect_url
|
4
7
|
.container.payment_partial
|
5
8
|
.row
|
6
9
|
.col-xs-12.col-md-7.col-md-offset-2
|
@@ -39,7 +42,7 @@
|
|
39
42
|
%a{:href => "#"}
|
40
43
|
%span.badge.pull-right
|
41
44
|
%span.glyphicon.glyphicon-usd>
|
42
|
-
|
45
|
+
@amount
|
43
46
|
Total
|
44
47
|
%br/
|
45
48
|
=submit_tag 'Pagar', class: 'btn btn-success btn-lg btn-block submit'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
%p#notice= notice
|
2
|
+
%h1=I18n.t('stripe_wrapper.models.charges.other')
|
3
|
+
%table.table.breakable-table.table-striped
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th User
|
7
|
+
%th Customer
|
8
|
+
%th Amount
|
9
|
+
%th Amount Refunded
|
10
|
+
%th Description
|
11
|
+
%th{:colspan => "3"}
|
12
|
+
%tbody
|
13
|
+
- @charges.each do |charge|
|
14
|
+
%tr
|
15
|
+
%td=link_to charge.user,main_app.user_path(charge.user) if charge.user.present?()
|
16
|
+
%td=link_to charge.stripe_customer,customer_path(charge.stripe_customer) if charge.stripe_customer.present?()
|
17
|
+
%td= charge.amount
|
18
|
+
%td= charge.amount_refunded
|
19
|
+
%td= charge.description
|
@@ -0,0 +1,26 @@
|
|
1
|
+
%p#notice= notice
|
2
|
+
%h1=I18n.t('stripe_wrapper.models.customers.other')
|
3
|
+
%table.table.breakable-table.table-striped
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th User
|
7
|
+
%th Customer
|
8
|
+
%th Account balance
|
9
|
+
%th Currency
|
10
|
+
%th Default source
|
11
|
+
%th Description
|
12
|
+
%th Email
|
13
|
+
%th{:colspan => "3"}
|
14
|
+
%tbody
|
15
|
+
- @customers.each do |customer|
|
16
|
+
%tr
|
17
|
+
%td=link_to customer.user,main_app.user_path(customer.user) if customer.user.present?()
|
18
|
+
%td= customer.customer_id
|
19
|
+
%td= customer.account_balance
|
20
|
+
%td= customer.currency
|
21
|
+
%td= customer.default_source
|
22
|
+
%td= customer.description
|
23
|
+
%td= customer.email
|
24
|
+
%td= link_to 'Show', customer
|
25
|
+
%td= link_to 'Edit', edit_customer_path(customer)
|
26
|
+
%td= link_to 'Destroy', customer, method: :delete, data: { confirm: 'Are you sure?' }
|
data/config/routes.rb
CHANGED
@@ -2,6 +2,7 @@ class CreateStripeWrapperCharges < ActiveRecord::Migration[5.0]
|
|
2
2
|
def change
|
3
3
|
create_table :stripe_wrapper_charges do |t|
|
4
4
|
t.string :stripe_id
|
5
|
+
t.integer :customer_id
|
5
6
|
t.string :object
|
6
7
|
t.float :amount
|
7
8
|
t.float :amount_refunded
|
@@ -15,7 +16,7 @@ class CreateStripeWrapperCharges < ActiveRecord::Migration[5.0]
|
|
15
16
|
t.text :description
|
16
17
|
t.string :cvc_check
|
17
18
|
t.string :failure_code
|
18
|
-
t.string :
|
19
|
+
t.string :failure_message
|
19
20
|
|
20
21
|
t.timestamps
|
21
22
|
end
|
data/lib/stripe_wrapper.rb
CHANGED
@@ -1,5 +1,45 @@
|
|
1
1
|
require "stripe_wrapper/engine"
|
2
2
|
|
3
3
|
module StripeWrapper
|
4
|
-
|
4
|
+
require "stripe"
|
5
|
+
Stripe.api_key = ENV["STRIPE_KEY"]
|
6
|
+
|
7
|
+
# Source is either a customer or a token
|
8
|
+
def self.create_charge(customer=nil,source=nil,amount=0,currency='clp',metadata={},description='')
|
9
|
+
#Metadata must be a hash. Example: :metadata => {'order_id' => '6735'}
|
10
|
+
Stripe::Charge.create({
|
11
|
+
amount: amount,
|
12
|
+
currency: currency,
|
13
|
+
customer: customer,
|
14
|
+
source: source, # obtained with Stripe.js
|
15
|
+
description: description,
|
16
|
+
metadata: metadata
|
17
|
+
}
|
18
|
+
# , { idempotency_key: "oSTGoYvkC1kaczHw"}
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.create_customer(token,user)
|
23
|
+
Stripe::Customer.create(
|
24
|
+
:description => "Customer for liam.moore@example.com",
|
25
|
+
:email => user.email,
|
26
|
+
:source => token # obtained with Stripe.js
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_customer(user)
|
31
|
+
customer = StripeCustomer.find_by_user_id(user.id)
|
32
|
+
customer = Customer.parse(Stripe::Customer.retrieve(customer.stripe_id)) rescue nil #TODO implement customer model
|
33
|
+
end
|
34
|
+
def self.update_customer(user,customer_params)
|
35
|
+
customer = StripeCustomer.find_by_user_id(user.id)
|
36
|
+
stripe_customer = Stripe::Customer.retrieve(customer.stripe_id)
|
37
|
+
customer_params.each do |param|
|
38
|
+
stripe_customer.send("#{param[0]}=",param[1])
|
39
|
+
end
|
40
|
+
stripe_customer.save
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
|
5
45
|
end
|
@@ -1,5 +1,37 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
require 'bootstrap-sass'
|
3
|
+
require_dependency 'stripe_wrapper/main_app_route_delegator'
|
4
|
+
|
1
5
|
module StripeWrapper
|
2
6
|
class Engine < ::Rails::Engine
|
7
|
+
require 'jquery-rails'
|
3
8
|
isolate_namespace StripeWrapper
|
9
|
+
|
10
|
+
initializer 'stripe_wrapper.action_controller' do |app|
|
11
|
+
ActiveSupport.on_load :action_controller do
|
12
|
+
helper StripeWrapper::StripeWrapperHelper
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
config.to_prepare do
|
17
|
+
::StripeWrapper::ApplicationController.helper ::StripeWrapper::MainAppRouteDelegator
|
18
|
+
end
|
19
|
+
|
20
|
+
initializer 'StripeWrapper precompile hook', group: :all do |app|
|
21
|
+
app.config.assets.precompile += %w(
|
22
|
+
stripe_wrapper/stripe_wrapper.js
|
23
|
+
stripe_wrapper/stripe_wrapper.css
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
initializer "config.stripe" do |app|
|
28
|
+
config.stripe = {
|
29
|
+
:publishable_key => ENV['STRIPE_PUBLIC_KEY'],
|
30
|
+
:secret_key => ENV['STRIPE_KEY']
|
31
|
+
}
|
32
|
+
|
33
|
+
Stripe.api_key = ENV['STRIPE_KEY']
|
34
|
+
end
|
35
|
+
|
4
36
|
end
|
5
37
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module StripeWrapper
|
2
|
+
# If StripeWrapper is rendered within an application layout, this module allows
|
3
|
+
# referring to the routes in the layout directly, without having to use `main_app.`.
|
4
|
+
module MainAppRouteDelegator
|
5
|
+
# delegate url helpers to main_app
|
6
|
+
# def method_missing(method, *args, &block)
|
7
|
+
# if main_app_route_method?(method)
|
8
|
+
# main_app.send(method, *args)
|
9
|
+
# else
|
10
|
+
# super
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
|
14
|
+
# def respond_to?(method, *args)
|
15
|
+
# super || main_app_route_method?(method)
|
16
|
+
# end
|
17
|
+
|
18
|
+
# private
|
19
|
+
|
20
|
+
# def main_app_route_method?(method)
|
21
|
+
# method.to_s =~ /_(?:path|url)$/ && main_app.respond_to?(method)
|
22
|
+
# end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Peebles | @waclock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,34 +30,186 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 5.0.0.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: jquery-rails
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '5'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '5'
|
33
53
|
- !ruby/object:Gem::Dependency
|
34
54
|
name: rails-i18n
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
36
56
|
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '5.0'
|
37
60
|
- - ">="
|
38
61
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
62
|
+
version: 5.0.1
|
40
63
|
type: :runtime
|
41
64
|
prerelease: false
|
42
65
|
version_requirements: !ruby/object:Gem::Requirement
|
43
66
|
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '5.0'
|
44
70
|
- - ">="
|
45
71
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
72
|
+
version: 5.0.1
|
47
73
|
- !ruby/object:Gem::Dependency
|
48
74
|
name: stripe
|
49
75
|
requirement: !ruby/object:Gem::Requirement
|
50
76
|
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.57'
|
51
80
|
- - ">="
|
52
81
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
82
|
+
version: 1.57.1
|
54
83
|
type: :runtime
|
55
84
|
prerelease: false
|
56
85
|
version_requirements: !ruby/object:Gem::Requirement
|
57
86
|
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.57'
|
58
90
|
- - ">="
|
59
91
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
92
|
+
version: 1.57.1
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: haml
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '4.0'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 4.0.7
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '4.0'
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 4.0.7
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: haml-rails
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0.9'
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 0.9.0
|
123
|
+
type: :runtime
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0.9'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.9.0
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: less-rails-bootstrap
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.3'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 3.3.5
|
143
|
+
type: :runtime
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '3.3'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.3.5
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: sass-rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '5.0'
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 5.0.0
|
163
|
+
type: :runtime
|
164
|
+
prerelease: false
|
165
|
+
version_requirements: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '5.0'
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 5.0.0
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: bootstrap-sass
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '3.3'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 3.3.7
|
183
|
+
type: :runtime
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '3.3'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 3.3.7
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: devise
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '4.0'
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 4.0.0
|
203
|
+
type: :runtime
|
204
|
+
prerelease: false
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '4.0'
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: 4.0.0
|
61
213
|
- !ruby/object:Gem::Dependency
|
62
214
|
name: sqlite3
|
63
215
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +224,118 @@ dependencies:
|
|
72
224
|
- - ">="
|
73
225
|
- !ruby/object:Gem::Version
|
74
226
|
version: '0'
|
227
|
+
- !ruby/object:Gem::Dependency
|
228
|
+
name: better_errors
|
229
|
+
requirement: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - ">="
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '0'
|
234
|
+
type: :development
|
235
|
+
prerelease: false
|
236
|
+
version_requirements: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '0'
|
241
|
+
- !ruby/object:Gem::Dependency
|
242
|
+
name: binding_of_caller
|
243
|
+
requirement: !ruby/object:Gem::Requirement
|
244
|
+
requirements:
|
245
|
+
- - ">="
|
246
|
+
- !ruby/object:Gem::Version
|
247
|
+
version: '0'
|
248
|
+
type: :development
|
249
|
+
prerelease: false
|
250
|
+
version_requirements: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '0'
|
255
|
+
- !ruby/object:Gem::Dependency
|
256
|
+
name: haml
|
257
|
+
requirement: !ruby/object:Gem::Requirement
|
258
|
+
requirements:
|
259
|
+
- - ">="
|
260
|
+
- !ruby/object:Gem::Version
|
261
|
+
version: '0'
|
262
|
+
type: :development
|
263
|
+
prerelease: false
|
264
|
+
version_requirements: !ruby/object:Gem::Requirement
|
265
|
+
requirements:
|
266
|
+
- - ">="
|
267
|
+
- !ruby/object:Gem::Version
|
268
|
+
version: '0'
|
269
|
+
- !ruby/object:Gem::Dependency
|
270
|
+
name: haml-rails
|
271
|
+
requirement: !ruby/object:Gem::Requirement
|
272
|
+
requirements:
|
273
|
+
- - ">="
|
274
|
+
- !ruby/object:Gem::Version
|
275
|
+
version: '0'
|
276
|
+
type: :development
|
277
|
+
prerelease: false
|
278
|
+
version_requirements: !ruby/object:Gem::Requirement
|
279
|
+
requirements:
|
280
|
+
- - ">="
|
281
|
+
- !ruby/object:Gem::Version
|
282
|
+
version: '0'
|
283
|
+
- !ruby/object:Gem::Dependency
|
284
|
+
name: therubyracer
|
285
|
+
requirement: !ruby/object:Gem::Requirement
|
286
|
+
requirements:
|
287
|
+
- - ">="
|
288
|
+
- !ruby/object:Gem::Version
|
289
|
+
version: '0'
|
290
|
+
type: :development
|
291
|
+
prerelease: false
|
292
|
+
version_requirements: !ruby/object:Gem::Requirement
|
293
|
+
requirements:
|
294
|
+
- - ">="
|
295
|
+
- !ruby/object:Gem::Version
|
296
|
+
version: '0'
|
297
|
+
- !ruby/object:Gem::Dependency
|
298
|
+
name: bootstrap-sass
|
299
|
+
requirement: !ruby/object:Gem::Requirement
|
300
|
+
requirements:
|
301
|
+
- - ">="
|
302
|
+
- !ruby/object:Gem::Version
|
303
|
+
version: '0'
|
304
|
+
type: :development
|
305
|
+
prerelease: false
|
306
|
+
version_requirements: !ruby/object:Gem::Requirement
|
307
|
+
requirements:
|
308
|
+
- - ">="
|
309
|
+
- !ruby/object:Gem::Version
|
310
|
+
version: '0'
|
311
|
+
- !ruby/object:Gem::Dependency
|
312
|
+
name: figaro
|
313
|
+
requirement: !ruby/object:Gem::Requirement
|
314
|
+
requirements:
|
315
|
+
- - ">="
|
316
|
+
- !ruby/object:Gem::Version
|
317
|
+
version: '0'
|
318
|
+
type: :development
|
319
|
+
prerelease: false
|
320
|
+
version_requirements: !ruby/object:Gem::Requirement
|
321
|
+
requirements:
|
322
|
+
- - ">="
|
323
|
+
- !ruby/object:Gem::Version
|
324
|
+
version: '0'
|
325
|
+
- !ruby/object:Gem::Dependency
|
326
|
+
name: devise
|
327
|
+
requirement: !ruby/object:Gem::Requirement
|
328
|
+
requirements:
|
329
|
+
- - ">="
|
330
|
+
- !ruby/object:Gem::Version
|
331
|
+
version: '0'
|
332
|
+
type: :development
|
333
|
+
prerelease: false
|
334
|
+
version_requirements: !ruby/object:Gem::Requirement
|
335
|
+
requirements:
|
336
|
+
- - ">="
|
337
|
+
- !ruby/object:Gem::Version
|
338
|
+
version: '0'
|
75
339
|
description: Wrapper around Stripe for rails.
|
76
340
|
email:
|
77
341
|
- john@mispistachos.cl
|
@@ -83,33 +347,40 @@ files:
|
|
83
347
|
- README.md
|
84
348
|
- Rakefile
|
85
349
|
- app/assets/config/stripe_wrapper_manifest.js
|
86
|
-
- app/assets/javascripts/stripe_wrapper/application.js
|
87
350
|
- app/assets/javascripts/stripe_wrapper/customers.js
|
351
|
+
- app/assets/javascripts/stripe_wrapper/stripe_wrapper.js
|
88
352
|
- app/assets/stylesheets/scaffold.css
|
89
|
-
- app/assets/stylesheets/stripe_wrapper/application.css
|
90
353
|
- app/assets/stylesheets/stripe_wrapper/customers.css
|
354
|
+
- app/assets/stylesheets/stripe_wrapper/stripe_wrapper.css.scss
|
91
355
|
- app/controllers/stripe_wrapper/application_controller.rb
|
92
356
|
- app/controllers/stripe_wrapper/charges_controller.rb
|
93
357
|
- app/controllers/stripe_wrapper/customers_controller.rb
|
94
|
-
- app/helpers/stripe_wrapper/application_helper.rb
|
95
358
|
- app/helpers/stripe_wrapper/customers_helper.rb
|
359
|
+
- app/helpers/stripe_wrapper/stripe_wrapper_helper.rb
|
96
360
|
- app/jobs/stripe_wrapper/application_job.rb
|
97
361
|
- app/mailers/stripe_wrapper/application_mailer.rb
|
98
362
|
- app/models/stripe_wrapper/application_record.rb
|
99
363
|
- app/models/stripe_wrapper/charge.rb
|
100
364
|
- app/models/stripe_wrapper/customer.rb
|
101
|
-
- app/views/layouts/stripe_wrapper/
|
365
|
+
- app/views/layouts/stripe_wrapper/_navigation.html.haml
|
366
|
+
- app/views/layouts/stripe_wrapper/_navigation_links.html.haml
|
367
|
+
- app/views/layouts/stripe_wrapper/_sidebar_navigation.html.haml
|
368
|
+
- app/views/layouts/stripe_wrapper/application.html.haml
|
102
369
|
- app/views/stripe_wrapper/charges/_pay.html.haml
|
370
|
+
- app/views/stripe_wrapper/charges/index.html.haml
|
103
371
|
- app/views/stripe_wrapper/customers/_form.html.erb
|
104
372
|
- app/views/stripe_wrapper/customers/edit.html.erb
|
105
|
-
- app/views/stripe_wrapper/customers/index.html.
|
373
|
+
- app/views/stripe_wrapper/customers/index.html.haml
|
106
374
|
- app/views/stripe_wrapper/customers/new.html.erb
|
107
375
|
- app/views/stripe_wrapper/customers/show.html.erb
|
376
|
+
- config/locales/en.yml
|
377
|
+
- config/locales/es.yml
|
108
378
|
- config/routes.rb
|
109
379
|
- db/migrate/20161215195603_create_stripe_wrapper_customers.rb
|
110
380
|
- db/migrate/20161215195608_create_stripe_wrapper_charges.rb
|
111
381
|
- lib/stripe_wrapper.rb
|
112
382
|
- lib/stripe_wrapper/engine.rb
|
383
|
+
- lib/stripe_wrapper/main_app_route_delegator.rb
|
113
384
|
- lib/stripe_wrapper/version.rb
|
114
385
|
- lib/tasks/stripe_wrapper_tasks.rake
|
115
386
|
homepage: https://mispistachos.cl
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require_tree .
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Stripe wrapper</title>
|
5
|
-
<%= stylesheet_link_tag "stripe_wrapper/application", media: "all" %>
|
6
|
-
<%= javascript_include_tag "stripe_wrapper/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
@@ -1,45 +0,0 @@
|
|
1
|
-
<p id="notice"><%= notice %></p>
|
2
|
-
|
3
|
-
<h1>Customers</h1>
|
4
|
-
|
5
|
-
<table>
|
6
|
-
<thead>
|
7
|
-
<tr>
|
8
|
-
<th>Customer</th>
|
9
|
-
<th>Account balance</th>
|
10
|
-
<th>Created</th>
|
11
|
-
<th>Currency</th>
|
12
|
-
<th>Default source</th>
|
13
|
-
<th>Delinquent</th>
|
14
|
-
<th>Description</th>
|
15
|
-
<th>Discount</th>
|
16
|
-
<th>Email</th>
|
17
|
-
<th>Livemode</th>
|
18
|
-
<th colspan="3"></th>
|
19
|
-
</tr>
|
20
|
-
</thead>
|
21
|
-
|
22
|
-
<tbody>
|
23
|
-
<% @customers.each do |customer| %>
|
24
|
-
<tr>
|
25
|
-
<td><%= customer.customer_id %></td>
|
26
|
-
<td><%= customer.account_balance %></td>
|
27
|
-
<td><%= customer.created %></td>
|
28
|
-
<td><%= customer.currency %></td>
|
29
|
-
<td><%= customer.default_source %></td>
|
30
|
-
<td><%= customer.delinquent %></td>
|
31
|
-
<td><%= customer.description %></td>
|
32
|
-
<td><%= customer.discount %></td>
|
33
|
-
<td><%= customer.email %></td>
|
34
|
-
<td><%= customer.livemode %></td>
|
35
|
-
<td><%= link_to 'Show', customer %></td>
|
36
|
-
<td><%= link_to 'Edit', edit_customer_path(customer) %></td>
|
37
|
-
<td><%= link_to 'Destroy', customer, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
38
|
-
</tr>
|
39
|
-
<% end %>
|
40
|
-
</tbody>
|
41
|
-
</table>
|
42
|
-
|
43
|
-
<br>
|
44
|
-
|
45
|
-
<%= link_to 'New Customer', new_customer_path %>
|