pay 3.0.19 → 3.0.20
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pay might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/views/pay/user_mailer/receipt.html.erb +1 -1
- data/app/views/pay/user_mailer/refund.html.erb +1 -1
- data/lib/pay/receipts.rb +2 -2
- data/lib/pay/version.rb +1 -1
- metadata +2 -9
- data/lib/generators/active_record/billable_generator.rb +0 -44
- data/lib/generators/active_record/merchant_generator.rb +0 -44
- data/lib/generators/active_record/templates/billable_migration.rb +0 -17
- data/lib/generators/active_record/templates/merchant_migration.rb +0 -12
- data/lib/generators/pay/billable_generator.rb +0 -17
- data/lib/generators/pay/merchant_generator.rb +0 -17
- data/lib/generators/pay/orm_helpers.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc336f11aa6bdd63887622dd48fbec5a3f52b440b41a73d63478a0239d4c787a
|
4
|
+
data.tar.gz: 31e98a7bbe5a0c9ba92201964aab99b3a3743cc42f15eac275f6032a9f52293f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 194be2c0276670440ff121b00048eedba5f91f1a85b53be9bd0145f5147f78d14ab739e57ae90590f6a751c5b3f2013e139650201bfe2b19d455b28c40c896dc
|
7
|
+
data.tar.gz: 9cc1c6d63c0360ccd54b2ee0143b933b292279016618e7e3130b97c150c64350756d7663682f1235f86d7a4983c971def19a7fef13d8148124040b1fccf39c63
|
@@ -10,7 +10,7 @@ Amount: <%= params[:charge].amount_with_currency %><br/>
|
|
10
10
|
Charged to: <%= params[:charge].charged_to %><br/>
|
11
11
|
Transaction ID: <%= params[:charge].id %><br/>
|
12
12
|
Date: <%= params[:charge].created_at %><br/>
|
13
|
-
<% if params[:charge].customer.owner.extra_billing_info? %>
|
13
|
+
<% if params[:charge].customer.owner.try(:extra_billing_info?) %>
|
14
14
|
<%= params[:charge].customer.owner.extra_billing_info %><br/>
|
15
15
|
<% end %>
|
16
16
|
<br/>
|
@@ -11,7 +11,7 @@ Amount: <%= params[:charge].amount_refunded_with_currency %><br/>
|
|
11
11
|
Refunded to: <%= params[:charge].charged_to %><br/>
|
12
12
|
Transaction ID: <%= params[:charge].id %><br/>
|
13
13
|
Date: <%= params[:charge].created_at %><br/>
|
14
|
-
<% if params[:charge].customer.owner.extra_billing_info? %>
|
14
|
+
<% if params[:charge].customer.owner.try(:extra_billing_info?) %>
|
15
15
|
<%= params[:charge].customer.owner.extra_billing_info %><br/>
|
16
16
|
<% end %>
|
17
17
|
<br/>
|
data/lib/pay/receipts.rb
CHANGED
@@ -21,7 +21,7 @@ module Pay
|
|
21
21
|
[I18n.t("pay.receipt.amount"), Pay::Currency.format(amount, currency: currency)],
|
22
22
|
[I18n.t("pay.receipt.charged_to"), charged_to]
|
23
23
|
]
|
24
|
-
line_items << [I18n.t("pay.receipt.additional_info"), customer.owner.extra_billing_info] if customer.owner.extra_billing_info?
|
24
|
+
line_items << [I18n.t("pay.receipt.additional_info"), customer.owner.extra_billing_info] if customer.owner.try(:extra_billing_info?)
|
25
25
|
line_items << [I18n.t("pay.receipt.refunded"), Pay::Currency.format(amount_refunded, currency: currency)] if refunded?
|
26
26
|
|
27
27
|
defaults = {
|
@@ -49,7 +49,7 @@ module Pay
|
|
49
49
|
|
50
50
|
def invoice_pdf(**options)
|
51
51
|
bill_to = [customer.owner.name]
|
52
|
-
bill_to += [customer.owner.extra_billing_info] if customer.owner.extra_billing_info?
|
52
|
+
bill_to += [customer.owner.extra_billing_info] if customer.owner.try(:extra_billing_info?)
|
53
53
|
bill_to += [nil, customer.owner.email]
|
54
54
|
|
55
55
|
total = Pay::Currency.format(amount, currency: currency)
|
data/lib/pay/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Charnes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-09-
|
12
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -123,14 +123,7 @@ files:
|
|
123
123
|
- config/locales/en.yml
|
124
124
|
- config/routes.rb
|
125
125
|
- db/migrate/1_create_pay_tables.rb
|
126
|
-
- lib/generators/active_record/billable_generator.rb
|
127
|
-
- lib/generators/active_record/merchant_generator.rb
|
128
|
-
- lib/generators/active_record/templates/billable_migration.rb
|
129
|
-
- lib/generators/active_record/templates/merchant_migration.rb
|
130
|
-
- lib/generators/pay/billable_generator.rb
|
131
126
|
- lib/generators/pay/email_views_generator.rb
|
132
|
-
- lib/generators/pay/merchant_generator.rb
|
133
|
-
- lib/generators/pay/orm_helpers.rb
|
134
127
|
- lib/generators/pay/views_generator.rb
|
135
128
|
- lib/pay.rb
|
136
129
|
- lib/pay/adapter.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rails/generators/active_record"
|
4
|
-
require "generators/pay/orm_helpers"
|
5
|
-
|
6
|
-
module ActiveRecord
|
7
|
-
module Generators
|
8
|
-
class BillableGenerator < ActiveRecord::Generators::Base
|
9
|
-
include Pay::Generators::OrmHelpers
|
10
|
-
source_root File.expand_path("../templates", __FILE__)
|
11
|
-
|
12
|
-
def copy_pay_billable_migration
|
13
|
-
if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(table_name))
|
14
|
-
migration_template "billable_migration.rb", "#{migration_path}/add_pay_billable_to_#{table_name}.rb", migration_version: migration_version
|
15
|
-
else
|
16
|
-
say "#{model_path} does not exist.", :red
|
17
|
-
say "⚠️ Make sure the #{name} model exists before running this generator."
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# If the file already contains the contents, the user will receive this warning:
|
22
|
-
#
|
23
|
-
# File unchanged! The supplied flag value not found!
|
24
|
-
#
|
25
|
-
# This can be ignored as it just means the contents already exist and the file is unchanged.
|
26
|
-
# Thor will be updated to improve this message: https://github.com/rails/thor/issues/706
|
27
|
-
def inject_pay_billable_content
|
28
|
-
return unless model_exists?
|
29
|
-
|
30
|
-
content = model_contents
|
31
|
-
class_path = (namespaced? ? class_name.to_s.split("::") : [class_name])
|
32
|
-
indent_depth = class_path.size - 1
|
33
|
-
content = content.split("\n").map { |line| " " * indent_depth + line }.join("\n") << "\n"
|
34
|
-
inject_into_class(model_path, class_path.last, content)
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def model_contents
|
40
|
-
" include Pay::Billable"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rails/generators/active_record"
|
4
|
-
require "generators/pay/orm_helpers"
|
5
|
-
|
6
|
-
module ActiveRecord
|
7
|
-
module Generators
|
8
|
-
class MerchantGenerator < ActiveRecord::Generators::Base
|
9
|
-
include Pay::Generators::OrmHelpers
|
10
|
-
source_root File.expand_path("../templates", __FILE__)
|
11
|
-
|
12
|
-
def copy_pay_merchant_migration
|
13
|
-
if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(table_name))
|
14
|
-
migration_template "merchant_migration.rb", "#{migration_path}/add_pay_merchant_to_#{table_name}.rb", migration_version: migration_version
|
15
|
-
else
|
16
|
-
say "#{model_path} does not exist.", :red
|
17
|
-
say "⚠️ Make sure the #{name} model exists before running this generator."
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# If the file already contains the contents, the user will receive this warning:
|
22
|
-
#
|
23
|
-
# File unchanged! The supplied flag value not found!
|
24
|
-
#
|
25
|
-
# This can be ignored as it just means the contents already exist and the file is unchanged.
|
26
|
-
# Thor will be updated to improve this message: https://github.com/rails/thor/issues/706
|
27
|
-
def inject_pay_merchant_content
|
28
|
-
return unless model_exists?
|
29
|
-
|
30
|
-
content = model_contents
|
31
|
-
class_path = (namespaced? ? class_name.to_s.split("::") : [class_name])
|
32
|
-
indent_depth = class_path.size - 1
|
33
|
-
content = content.split("\n").map { |line| " " * indent_depth + line }.join("\n") << "\n"
|
34
|
-
inject_into_class(model_path, class_path.last, content)
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def model_contents
|
40
|
-
" include Pay::Merchant"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class AddPayBillableTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
|
4
|
-
def change
|
5
|
-
change_table :<%= table_name %>, bulk: true do |t|
|
6
|
-
t.string :processor
|
7
|
-
t.string :processor_id
|
8
|
-
t.public_send(Pay::Adapter.json_column_type, :pay_data)
|
9
|
-
t.datetime :trial_ends_at
|
10
|
-
t.string :card_type
|
11
|
-
t.string :card_last4
|
12
|
-
t.string :card_exp_month
|
13
|
-
t.string :card_exp_year
|
14
|
-
t.text :extra_billing_info
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class AddPayMerchantTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
|
4
|
-
def change
|
5
|
-
add_column table_name, :merchant_processor, :string
|
6
|
-
|
7
|
-
# We may already have the pay_data column if a Pay::Billable object is also a Pay::Merchant
|
8
|
-
unless ActiveRecord::Base.connection.column_exists?(table_name, :pay_data)
|
9
|
-
add_column :<%= table_name %>, :pay_data, Pay::Adapter.json_column_type
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rails/generators/named_base"
|
4
|
-
|
5
|
-
module Pay
|
6
|
-
module Generators
|
7
|
-
class BillableGenerator < Rails::Generators::NamedBase
|
8
|
-
include Rails::Generators::ResourceHelpers
|
9
|
-
|
10
|
-
source_root File.expand_path("../templates", __FILE__)
|
11
|
-
|
12
|
-
desc "Generates a migration to add Pay::Billable fields to a model."
|
13
|
-
|
14
|
-
hook_for :orm
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rails/generators/named_base"
|
4
|
-
|
5
|
-
module Pay
|
6
|
-
module Generators
|
7
|
-
class MerchantGenerator < Rails::Generators::NamedBase
|
8
|
-
include Rails::Generators::ResourceHelpers
|
9
|
-
|
10
|
-
source_root File.expand_path("../templates", __FILE__)
|
11
|
-
|
12
|
-
desc "Generates a migration to add Pay::Merchant fields to a model."
|
13
|
-
|
14
|
-
hook_for :orm
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Pay
|
4
|
-
module Generators
|
5
|
-
module OrmHelpers
|
6
|
-
private
|
7
|
-
|
8
|
-
def model_exists?
|
9
|
-
File.exist?(File.join(destination_root, model_path))
|
10
|
-
end
|
11
|
-
|
12
|
-
def migration_exists?(table_name)
|
13
|
-
Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_add_devise_to_#{table_name}.rb$/).first
|
14
|
-
end
|
15
|
-
|
16
|
-
def migration_path
|
17
|
-
if Rails.version >= "5.0.3"
|
18
|
-
db_migrate_path
|
19
|
-
else
|
20
|
-
@migration_path ||= File.join("db", "migrate")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def model_path
|
25
|
-
@model_path ||= File.join("app", "models", "#{file_path}.rb")
|
26
|
-
end
|
27
|
-
|
28
|
-
def migration_version
|
29
|
-
if rails5_and_up?
|
30
|
-
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def rails5_and_up?
|
35
|
-
Rails::VERSION::MAJOR >= 5
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|