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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 883c55bf9abc32584d98fe56c9a710e92906bebc5322b1ec9ed9dadf92fcd9dc
4
- data.tar.gz: da1849f216e7d5e3a8365b3427a4bebf914d51e1c41e9736bc3b8df726f58ef7
3
+ metadata.gz: ba84d79847e4ef8659bcf7fce74b966c07bb93fa8e2f29f902a243c9d6e5c8bf
4
+ data.tar.gz: 78e829fc4d218aabee2544a969b184e29e2621bf0d965318d1b33e4e750ebae4
5
5
  SHA512:
6
- metadata.gz: ab3d62146de9a533a9598e0d87970a019f8b23646a92110c3d62ef64ec8385c2158c7435c7b255648faa4740360634f59d5b3a16f95c44347e7aeedc004f9674
7
- data.tar.gz: 598d32db66f8fd5b43cfb27766826223d4a7dd80c73204e23e6a5bb36783775f8c521d8682e4c466f059e6f71541b8c799cfed5bab1330fc4992901c06cb62cc
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.handleCardSetup` 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.handleCardPayment` if you'd like to charge the customer immediately (think checking out of a shopping cart).
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
- t.references :owner
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
@@ -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::Stripe::Billable }
22
+ Pay.billable_models.each { |model| model.include Pay::Braintree::Billable }
23
23
  end
24
24
 
25
25
  def public_key
@@ -12,6 +12,7 @@ module Pay
12
12
 
13
13
  def setup
14
14
  ::Stripe.api_key = private_key
15
+ ::Stripe.api_version = '2020-08-27'
15
16
  ::StripeEvent.signing_secret = signing_secret
16
17
 
17
18
  Pay.charge_model.include Pay::Stripe::Charge
@@ -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
- stripe_sub = customer.subscriptions.create(opts)
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.prorate = prorate
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
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "2.1.3"
2
+ VERSION = "2.2.0"
3
3
  end
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.1.3
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-06-29 00:00:00.000000000 Z
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.4
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: []