pay 3.0.23 → 3.0.24
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.
Potentially problematic release.
This version of pay might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/jobs/pay/customer_sync_job.rb +1 -1
- data/lib/pay/fake_processor/billable.rb +12 -5
- data/lib/pay/fake_processor/subscription.rb +3 -0
- data/lib/pay/stripe/billable.rb +8 -3
- data/lib/pay/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b3ebc48aeb54c0c71ccb8570c00ca5194258982fc06f00a51e2b49211dd82f0
|
4
|
+
data.tar.gz: f13ea4e812837ce733f797b9165ad798a0920e80e95b201a26a83c12c5c91f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44a72ba1d1c77004f2e98a20a0a6014030614be04027b6f2341d58523af3fb686bcef8ebdbde9233f52fc65c7578863430b60e2a0a73feadcf79d95043a94c38
|
7
|
+
data.tar.gz: acf91b1679dabc86e8199a28b5fd87a72a18362c8436dac3fc3318b624896bbce92b6936f8694250e4a46ca84c03defe3209e1d074273abae87fe96fcef4b448
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# 💳 Pay - Payments engine for Ruby on Rails
|
4
4
|
|
5
|
-
[](https://github.com/pay-rails/pay/actions) [](https://badge.fury.io/rb/pay)
|
5
|
+
[](https://github.com/pay-rails/pay/actions) [](https://badge.fury.io/rb/pay) [](https://tuple.app)
|
6
6
|
|
7
7
|
<img src="docs/images/stripe_partner_badge.svg" height="26px">
|
8
8
|
|
@@ -49,7 +49,7 @@ Want to add a new payment provider? Contributions are welcome.
|
|
49
49
|
* **Marketplaces**
|
50
50
|
* [Stripe Connect](docs/marketplaces/stripe_connect.md)
|
51
51
|
* **Contributing**
|
52
|
-
* [Adding A Payment Processor](docs/contributing/
|
52
|
+
* [Adding A Payment Processor](docs/contributing/adding_a_payment_processor.md)
|
53
53
|
|
54
54
|
## 🙏 Contributing
|
55
55
|
|
@@ -5,7 +5,7 @@ module Pay
|
|
5
5
|
def perform(pay_customer_id)
|
6
6
|
Pay::Customer.find(pay_customer_id).update_customer!
|
7
7
|
rescue ActiveRecord::RecordNotFound
|
8
|
-
Rails.logger.info "Couldn't find a Pay::Customer with ID = #{
|
8
|
+
Rails.logger.info "Couldn't find a Pay::Customer with ID = #{pay_customer_id}"
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -31,8 +31,8 @@ module Pay
|
|
31
31
|
processor_id: NanoId.generate,
|
32
32
|
amount: amount,
|
33
33
|
data: {
|
34
|
-
|
35
|
-
|
34
|
+
payment_method_type: :card,
|
35
|
+
brand: "Fake",
|
36
36
|
last4: 1234,
|
37
37
|
exp_month: Date.today.month,
|
38
38
|
exp_year: Date.today.year
|
@@ -44,7 +44,6 @@ module Pay
|
|
44
44
|
def subscribe(name: Pay.default_product_name, plan: Pay.default_plan_name, **options)
|
45
45
|
# Make to generate a processor_id
|
46
46
|
customer
|
47
|
-
|
48
47
|
attributes = options.merge(
|
49
48
|
processor_id: NanoId.generate,
|
50
49
|
name: name,
|
@@ -52,6 +51,11 @@ module Pay
|
|
52
51
|
status: :active,
|
53
52
|
quantity: options.fetch(:quantity, 1)
|
54
53
|
)
|
54
|
+
|
55
|
+
if (trial_period_days = attributes.delete(:trial_period_days))
|
56
|
+
attributes[:trial_ends_at] = trial_period_days.to_i.days.from_now
|
57
|
+
end
|
58
|
+
|
55
59
|
pay_customer.subscriptions.create!(attributes)
|
56
60
|
end
|
57
61
|
|
@@ -59,10 +63,10 @@ module Pay
|
|
59
63
|
# Make to generate a processor_id
|
60
64
|
customer
|
61
65
|
|
62
|
-
pay_customer.payment_methods.create!(
|
66
|
+
pay_payment_method = pay_customer.payment_methods.create!(
|
63
67
|
processor_id: NanoId.generate,
|
64
68
|
default: default,
|
65
|
-
type: :
|
69
|
+
type: :card,
|
66
70
|
data: {
|
67
71
|
brand: "Fake",
|
68
72
|
last4: 1234,
|
@@ -70,6 +74,9 @@ module Pay
|
|
70
74
|
exp_year: Date.today.year
|
71
75
|
}
|
72
76
|
)
|
77
|
+
|
78
|
+
pay_customer.reload_default_payment_method if default
|
79
|
+
pay_payment_method
|
73
80
|
end
|
74
81
|
|
75
82
|
def update_email!
|
data/lib/pay/stripe/billable.rb
CHANGED
@@ -177,8 +177,8 @@ module Pay
|
|
177
177
|
# checkout(mode: "subscription")
|
178
178
|
#
|
179
179
|
# checkout(line_items: "price_12345", quantity: 2)
|
180
|
-
# checkout(line_items [{ price: "price_123" }, { price: "price_456" }])
|
181
|
-
# checkout(line_items
|
180
|
+
# checkout(line_items: [{ price: "price_123" }, { price: "price_456" }])
|
181
|
+
# checkout(line_items: "price_12345", allow_promotion_codes: true)
|
182
182
|
#
|
183
183
|
def checkout(**options)
|
184
184
|
customer unless processor_id?
|
@@ -193,11 +193,16 @@ module Pay
|
|
193
193
|
|
194
194
|
# Line items are optional
|
195
195
|
if (line_items = options.delete(:line_items))
|
196
|
+
quantity = options.delete(:quantity) || 1
|
197
|
+
|
196
198
|
args[:line_items] = Array.wrap(line_items).map { |item|
|
197
199
|
if item.is_a? Hash
|
198
200
|
item
|
199
201
|
else
|
200
|
-
{
|
202
|
+
{
|
203
|
+
price: item,
|
204
|
+
quantity: quantity
|
205
|
+
}
|
201
206
|
end
|
202
207
|
}
|
203
208
|
end
|
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.24
|
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-
|
12
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|