pay 6.7.1 → 6.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6c599414b39eb92d44ee17f7ccb9de063c15eed29b0ea42d404f600df9966a8
4
- data.tar.gz: 9d74f8b7307dfb0f5236c07356227dfb3f51dfa90e2e20a98beefa9a70d362a6
3
+ metadata.gz: 1af316b3951f2b2d0844c3fcfebc005f43a42cca3f2704eb19cde32df968f787
4
+ data.tar.gz: d22bc794be545843843ba97e03ac9190e3835ec61c288aeb2e14fe562be055dc
5
5
  SHA512:
6
- metadata.gz: b9b66934a36fedbd9bba2bbf01d3d4c97f32bf561d391919a980b3c95aa6ab59abcb0bf972c3f283707e8f578c329025525396f50a85e39a74572b7623467484
7
- data.tar.gz: 7720adbb3990da1bb586a0be8f53d071ebce4bca693f37213b56a0987b8ecc865495abb56ad6ada95472e8af272bb07c407d14becdc346b16d9160358d76be78
6
+ metadata.gz: a855e7acead57687470d16476fdee052649ae15977f21e611fbf529d337551895696310fbdc7f62d9242142f737de3c4045077c4208d79aa6bb38313467003c9
7
+ data.tar.gz: d9071f2afbb72357256e78997a0617d4edbc5fbb1f904fc2a9afaff3078e2f19fbe8fa6b9b39708e75b0cba27b16f9dd9778be86514f0fdaabaacf86aa105be3
@@ -1,7 +1,9 @@
1
1
  class CreatePayTables < ActiveRecord::Migration[6.0]
2
2
  def change
3
- create_table :pay_customers do |t|
4
- t.belongs_to :owner, polymorphic: true, index: false
3
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
4
+
5
+ create_table :pay_customers, id: primary_key_type do |t|
6
+ t.belongs_to :owner, polymorphic: true, index: false, type: foreign_key_type
5
7
  t.string :processor, null: false
6
8
  t.string :processor_id
7
9
  t.boolean :default
@@ -12,8 +14,8 @@ class CreatePayTables < ActiveRecord::Migration[6.0]
12
14
  add_index :pay_customers, [:owner_type, :owner_id, :deleted_at, :default], name: :pay_customer_owner_index
13
15
  add_index :pay_customers, [:processor, :processor_id], unique: true
14
16
 
15
- create_table :pay_merchants do |t|
16
- t.belongs_to :owner, polymorphic: true, index: false
17
+ create_table :pay_merchants, id: primary_key_type do |t|
18
+ t.belongs_to :owner, polymorphic: true, index: false, type: foreign_key_type
17
19
  t.string :processor, null: false
18
20
  t.string :processor_id
19
21
  t.boolean :default
@@ -22,8 +24,8 @@ class CreatePayTables < ActiveRecord::Migration[6.0]
22
24
  end
23
25
  add_index :pay_merchants, [:owner_type, :owner_id, :processor]
24
26
 
25
- create_table :pay_payment_methods do |t|
26
- t.belongs_to :customer, foreign_key: {to_table: :pay_customers}, null: false, index: false
27
+ create_table :pay_payment_methods, id: primary_key_type do |t|
28
+ t.belongs_to :customer, foreign_key: {to_table: :pay_customers}, null: false, index: false, type: foreign_key_type
27
29
  t.string :processor_id, null: false
28
30
  t.boolean :default
29
31
  t.string :type
@@ -32,8 +34,8 @@ class CreatePayTables < ActiveRecord::Migration[6.0]
32
34
  end
33
35
  add_index :pay_payment_methods, [:customer_id, :processor_id], unique: true
34
36
 
35
- create_table :pay_subscriptions do |t|
36
- t.belongs_to :customer, foreign_key: {to_table: :pay_customers}, null: false, index: false
37
+ create_table :pay_subscriptions, id: primary_key_type do |t|
38
+ t.belongs_to :customer, foreign_key: {to_table: :pay_customers}, null: false, index: false, type: foreign_key_type
37
39
  t.string :name, null: false
38
40
  t.string :processor_id, null: false
39
41
  t.string :processor_plan, null: false
@@ -56,9 +58,9 @@ class CreatePayTables < ActiveRecord::Migration[6.0]
56
58
  add_index :pay_subscriptions, [:metered]
57
59
  add_index :pay_subscriptions, [:pause_starts_at]
58
60
 
59
- create_table :pay_charges do |t|
60
- t.belongs_to :customer, foreign_key: {to_table: :pay_customers}, null: false, index: false
61
- t.belongs_to :subscription, foreign_key: {to_table: :pay_subscriptions}, null: true
61
+ create_table :pay_charges, id: primary_key_type do |t|
62
+ t.belongs_to :customer, foreign_key: {to_table: :pay_customers}, null: false, index: false, type: foreign_key_type
63
+ t.belongs_to :subscription, foreign_key: {to_table: :pay_subscriptions}, null: true, type: foreign_key_type
62
64
  t.string :processor_id, null: false
63
65
  t.integer :amount, null: false
64
66
  t.string :currency
@@ -70,11 +72,21 @@ class CreatePayTables < ActiveRecord::Migration[6.0]
70
72
  end
71
73
  add_index :pay_charges, [:customer_id, :processor_id], unique: true
72
74
 
73
- create_table :pay_webhooks do |t|
75
+ create_table :pay_webhooks, id: primary_key_type do |t|
74
76
  t.string :processor
75
77
  t.string :event_type
76
78
  t.public_send Pay::Adapter.json_column_type, :event
77
79
  t.timestamps
78
80
  end
79
81
  end
82
+
83
+ private
84
+
85
+ def primary_and_foreign_key_types
86
+ config = Rails.configuration.generators
87
+ setting = config.options[config.orm][:primary_key_type]
88
+ primary_key_type = setting || :primary_key
89
+ foreign_key_type = setting || :bigint
90
+ [primary_key_type, foreign_key_type]
91
+ end
80
92
  end
@@ -209,12 +209,15 @@ module Pay
209
209
  customer unless processor_id?
210
210
  args = {
211
211
  customer: processor_id,
212
- mode: "payment",
213
- # These placeholder URLs will be replaced in a following step.
214
- success_url: merge_session_id_param(options.delete(:success_url) || root_url),
215
- cancel_url: merge_session_id_param(options.delete(:cancel_url) || root_url)
212
+ mode: "payment"
216
213
  }
217
214
 
215
+ # Embedded checkouts cannot use URLs
216
+ if options[:ui_mode] != "embedded"
217
+ args[:success_url] = merge_session_id_param(options.delete(:success_url) || root_url)
218
+ args[:cancel_url] = merge_session_id_param(options.delete(:cancel_url) || root_url)
219
+ end
220
+
218
221
  # Line items are optional
219
222
  if (line_items = options.delete(:line_items))
220
223
  quantity = options.delete(:quantity) || 1
data/lib/pay/stripe.rb CHANGED
@@ -42,7 +42,7 @@ module Pay
42
42
 
43
43
  def self.setup
44
44
  ::Stripe.api_key = private_key
45
- ::Stripe.api_version = "2022-11-15"
45
+ ::Stripe.api_version ||= "2022-11-15"
46
46
 
47
47
  # Used by Stripe to identify Pay for support
48
48
  ::Stripe.set_app_info("PayRails", partner_id: "pp_partner_IqhY0UExnJYLxg", version: Pay::VERSION, url: "https://github.com/pay-rails/pay")
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "6.7.1"
2
+ VERSION = "6.7.2"
3
3
  end
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: 6.7.1
4
+ version: 6.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-07-28 00:00:00.000000000 Z
13
+ date: 2023-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.4.17
171
+ rubygems_version: 3.4.18
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Payments engine for Ruby on Rails