pay 2.1.3 → 2.2.0
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/README.md +5 -5
- data/db/migrate/20170205020145_create_pay_subscriptions.rb +2 -1
- data/db/migrate/20170727235816_create_pay_charges.rb +1 -0
- data/lib/pay/braintree.rb +1 -1
- data/lib/pay/stripe.rb +1 -0
- data/lib/pay/stripe/billable.rb +3 -1
- data/lib/pay/stripe/subscription.rb +1 -1
- data/lib/pay/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba84d79847e4ef8659bcf7fce74b966c07bb93fa8e2f29f902a243c9d6e5c8bf
|
4
|
+
data.tar.gz: 78e829fc4d218aabee2544a969b184e29e2621bf0d965318d1b33e4e750ebae4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c044f842d680969455c49a24124c48e2e80a1b06486db11782032ebdd0db810c1836151f97087bb1e06e083106524e9250520768a96462ff24fdc0723a4c5dd
|
7
|
+
data.tar.gz: 7dbe7db2d4c6161b9516f73a1496092b6ffb9ebf2c5471fe061ccfd79b1335bc0a3238c1e407f621e3717cbd0cf28496790153b884a8540557428b6cf33c665c
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## Pay - Payments engine for Ruby on Rails
|
4
4
|
|
5
|
-
[![Build Status](https://github.com/pay-rails/pay/workflows/Tests/badge.svg)](https://github.com/pay-rails/pay/actions)
|
5
|
+
[![Build Status](https://github.com/pay-rails/pay/workflows/Tests/badge.svg)](https://github.com/pay-rails/pay/actions) [![Gem Version](https://badge.fury.io/rb/pay.svg)](https://badge.fury.io/rb/pay)
|
6
6
|
|
7
7
|
Pay is a payments engine for Ruby on Rails 4.2 and higher.
|
8
8
|
|
@@ -78,6 +78,8 @@ class User < ActiveRecord::Base
|
|
78
78
|
end
|
79
79
|
```
|
80
80
|
|
81
|
+
An `email` attribute or method on your `Billable` model is required.
|
82
|
+
|
81
83
|
To sync over customer names, your `Billable` model should respond to the `first_name` and `last_name` methods. Pay will sync these over to your Customer objects in Stripe and Braintree.
|
82
84
|
|
83
85
|
## Configuration
|
@@ -250,7 +252,7 @@ Name is an internally used name for the subscription.
|
|
250
252
|
|
251
253
|
##### Plan
|
252
254
|
|
253
|
-
Plan is the plan ID from the payment processor.
|
255
|
+
Plan is the plan ID or price ID from the payment processor. For example: `plan_xxxxx` or `price_xxxxx`
|
254
256
|
|
255
257
|
##### Options
|
256
258
|
|
@@ -518,9 +520,7 @@ correctly for SCA payments.
|
|
518
520
|
stripe listen --forward-to localhost:3000/pay/webhooks/stripe
|
519
521
|
```
|
520
522
|
|
521
|
-
You should use `stripe.
|
522
|
-
|
523
|
-
The Javascript will now need to use createPaymentMethod instead of createToken. https://stripe.com/docs/js/payment_intents/create_payment_method
|
523
|
+
You should use `stripe.confirmCardSetup` on the client to collect card information anytime you want to save the card and charge them later (adding a card, then charging them on the next page for example). Use `stripe.confirmCardPayment` if you'd like to charge the customer immediately (think checking out of a shopping cart).
|
524
524
|
|
525
525
|
The Javascript also needs to have a PaymentIntent or SetupIntent created server-side and the ID passed into the Javascript to do this. That way it knows how to safely handle the card tokenization if it meets the SCA requirements.
|
526
526
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class CreatePaySubscriptions < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
3
|
create_table :pay_subscriptions do |t|
|
4
|
-
|
4
|
+
# Some Billable objects use string as ID, add `type: :string` if needed
|
5
|
+
t.references :owner, polymorphic: true
|
5
6
|
t.string :name, null: false
|
6
7
|
t.string :processor, null: false
|
7
8
|
t.string :processor_id, null: false
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class CreatePayCharges < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
3
|
create_table :pay_charges do |t|
|
4
|
+
# Some Billable objects use string as ID, add `type: :string` if needed
|
4
5
|
t.references :owner, polymorphic: true
|
5
6
|
t.string :processor, null: false
|
6
7
|
t.string :processor_id, null: false
|
data/lib/pay/braintree.rb
CHANGED
@@ -19,7 +19,7 @@ module Pay
|
|
19
19
|
|
20
20
|
Pay.charge_model.include Pay::Braintree::Charge
|
21
21
|
Pay.subscription_model.include Pay::Braintree::Subscription
|
22
|
-
Pay.billable_models.each { |model| model.include Pay::
|
22
|
+
Pay.billable_models.each { |model| model.include Pay::Braintree::Billable }
|
23
23
|
end
|
24
24
|
|
25
25
|
def public_key
|
data/lib/pay/stripe.rb
CHANGED
data/lib/pay/stripe/billable.rb
CHANGED
@@ -58,7 +58,9 @@ module Pay
|
|
58
58
|
# Inherit trial from plan unless trial override was specified
|
59
59
|
opts[:trial_from_plan] = true unless opts[:trial_period_days]
|
60
60
|
|
61
|
-
|
61
|
+
opts[:customer] = stripe_customer.id
|
62
|
+
|
63
|
+
stripe_sub = ::Stripe::Subscription.create(opts)
|
62
64
|
subscription = create_subscription(stripe_sub, "stripe", name, plan, status: stripe_sub.status, quantity: quantity)
|
63
65
|
|
64
66
|
# No trial, card requires SCA
|
@@ -37,7 +37,7 @@ module Pay
|
|
37
37
|
subscription = processor_subscription
|
38
38
|
subscription.cancel_at_period_end = false
|
39
39
|
subscription.plan = plan
|
40
|
-
subscription.
|
40
|
+
subscription.proration_behavior = (prorate ? 'create_prorations' : 'none')
|
41
41
|
subscription.trial_end = on_trial? ? trial_ends_at.to_i : "now"
|
42
42
|
subscription.quantity = quantity if quantity?
|
43
43
|
subscription.save
|
data/lib/pay/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Charnes
|
8
8
|
- Chris Oliver
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -258,7 +258,7 @@ homepage: https://github.com/jasoncharnes/pay
|
|
258
258
|
licenses:
|
259
259
|
- MIT
|
260
260
|
metadata: {}
|
261
|
-
post_install_message:
|
261
|
+
post_install_message:
|
262
262
|
rdoc_options: []
|
263
263
|
require_paths:
|
264
264
|
- lib
|
@@ -273,8 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
273
|
- !ruby/object:Gem::Version
|
274
274
|
version: '0'
|
275
275
|
requirements: []
|
276
|
-
rubygems_version: 3.1.
|
277
|
-
signing_key:
|
276
|
+
rubygems_version: 3.1.2
|
277
|
+
signing_key:
|
278
278
|
specification_version: 4
|
279
279
|
summary: A Ruby on Rails subscription engine.
|
280
280
|
test_files: []
|