pay 2.2.1 → 2.2.2

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: a39036a88478988fe62a7d8685ba479d662646f107489ccbfd17fdbe8c6aa232
4
- data.tar.gz: 111f9b1d2430e08aa52ea816ca62648ef296e174981f6eb17a637920b4173c10
3
+ metadata.gz: 6b0dc3430e6f89e4c1516a122bde97173ee5bdb1bfa835bb968b36083b633c4f
4
+ data.tar.gz: 0dbd1c62002fa67fbf9e78591f52199c9322e6d52868fb443e640f93dd2863d0
5
5
  SHA512:
6
- metadata.gz: d268759513be6d5fc9576365010cbff751fb75a5ab2c49177bfa6723443d76bd8e40dc220cea76b90d55be3093694ad15abc0c1266fa40990540baa9aae514d3
7
- data.tar.gz: fa8a66eacbfb23afe069d2f62928a2ab52c9bb9f2e349dc331b76b0e58e8d1d3bdca3dd18a053aa5b7fd2dec166158c23ff8debd609eceb19d2f18dc040656c6
6
+ metadata.gz: d6e108e2377cfabdd8da381f225094d4f8f2e0fb25ca28dbadf0cfbfaad1bbafbbb1f4613c92ac0bd8dc0d87c4de14b21d32004ab31ab572588bef4926746f92
7
+ data.tar.gz: 68ebaeed4f068419a51860d853bd914ba6c5076e590bac85005feb431a404bb7ea8c3fbbe113876e0f6ec56ad539d43e698504b99aa5951bc76894d18961f8c6
data/README.md CHANGED
@@ -506,6 +506,20 @@ You can also use the `STRIPE_PRIVATE_KEY` and `STRIPE_SIGNING_SECRET` environmen
506
506
 
507
507
  **To see how to use Stripe Elements JS & Devise, [click here](https://github.com/jasoncharnes/pay/wiki/Using-Stripe-Elements-and-Devise).**
508
508
 
509
+ You need the following event types to trigger the webhook:
510
+
511
+ ```
512
+ customer.subscription.updated
513
+ customer.subscription.deleted
514
+ customer.subscription.created
515
+ payment_method.updated
516
+ invoice.payment_action_required
517
+ customer.updated
518
+ customer.deleted
519
+ charge.succeeded
520
+ charge.refunded
521
+ ```
522
+
509
523
  ##### Strong Customer Authentication (SCA)
510
524
 
511
525
  Our Stripe integration **requires** the use of Payment Method objects to correctly support Strong Customer Authentication with Stripe. If you've previously been using card tokens, you'll need to upgrade your Javascript integration.
@@ -552,7 +566,10 @@ If you have an issue you'd like to submit, please do so using the issue tracker
552
566
 
553
567
  If you'd like to open a PR please make sure the following things pass:
554
568
 
555
- - `rake test`
569
+ ```ruby
570
+ bin/rails db:test:prepare
571
+ bin/rails test
572
+ ```
556
573
 
557
574
  ## License
558
575
 
@@ -1,6 +1,7 @@
1
1
  module Pay
2
2
  class PaymentsController < ApplicationController
3
3
  def show
4
+ @redirect_to = params[:back].presence || root_path
4
5
  @payment = Payment.from_id(params[:id])
5
6
  end
6
7
  end
@@ -51,7 +51,7 @@
51
51
  </div>
52
52
  <% end %>
53
53
 
54
- <%= link_to t("back"), root_path, class: "inline-block w-full px-4 py-3 bg-gray-200 hover:bg-gray-300 text-center text-gray-700 rounded-lg" %>
54
+ <%= link_to t("back"), @redirect_to, class: "inline-block w-full px-4 py-3 bg-gray-200 hover:bg-gray-300 text-center text-gray-700 rounded-lg" %>
55
55
  </div>
56
56
 
57
57
  <p class="text-center text-gray-500 text-sm">
@@ -26,7 +26,7 @@ module ActiveRecord
26
26
  end
27
27
 
28
28
  indent_depth = class_path.size - 1
29
- content = content.split("\n").map { |line| " " * indent_depth + line } .join("\n") << "\n"
29
+ content = content.split("\n").map { |line| " " * indent_depth + line }.join("\n") << "\n"
30
30
 
31
31
  inject_into_class(model_path, class_path.last, content) if model_exists?
32
32
  end
@@ -4,10 +4,9 @@ module Pay
4
4
  module Generators
5
5
  module OrmHelpers
6
6
  def model_contents
7
- buffer = <<-CONTENT
7
+ <<-CONTENT
8
8
  include Pay::Billable
9
9
  CONTENT
10
- buffer
11
10
  end
12
11
 
13
12
  private
data/lib/pay.rb CHANGED
@@ -105,7 +105,7 @@ module Pay
105
105
  class BraintreeError < Error
106
106
  attr_reader :result
107
107
 
108
- def initialize(result=nil)
108
+ def initialize(result = nil)
109
109
  @result = result
110
110
  end
111
111
  end
@@ -124,7 +124,7 @@ module Pay
124
124
  end
125
125
 
126
126
  def message
127
- "This payment attempt failed beacuse of an invalid payment method."
127
+ "This payment attempt failed because of an invalid payment method."
128
128
  end
129
129
  end
130
130
 
@@ -20,8 +20,8 @@ module Pay
20
20
  include Pay::Stripe::Billable if defined? ::Stripe
21
21
  include Pay::Braintree::Billable if defined? ::Braintree
22
22
 
23
- has_many :charges, class_name: Pay.chargeable_class, foreign_key: :owner_id, inverse_of: :owner
24
- has_many :subscriptions, class_name: Pay.subscription_class, foreign_key: :owner_id, inverse_of: :owner
23
+ has_many :charges, class_name: Pay.chargeable_class, foreign_key: :owner_id, inverse_of: :owner, as: :owner
24
+ has_many :subscriptions, class_name: Pay.subscription_class, foreign_key: :owner_id, inverse_of: :owner, as: :owner
25
25
 
26
26
  attribute :plan, :string
27
27
  attribute :quantity, :integer
@@ -24,7 +24,7 @@ module Pay
24
24
 
25
25
  result.customer
26
26
  end
27
- rescue ::Braintree::AuthorizationError => e
27
+ rescue ::Braintree::AuthorizationError
28
28
  raise BraintreeAuthorizationError
29
29
  rescue ::Braintree::BraintreeError => e
30
30
  raise BraintreeError, e.message
@@ -44,7 +44,7 @@ module Pay
44
44
  raise BraintreeError.new(result), result.message unless result.success?
45
45
 
46
46
  save_braintree_transaction(result.transaction)
47
- rescue ::Braintree::AuthorizationError => e
47
+ rescue ::Braintree::AuthorizationError
48
48
  raise BraintreeAuthorizationError
49
49
  rescue ::Braintree::BraintreeError => e
50
50
  raise BraintreeError, e.message
@@ -71,7 +71,7 @@ module Pay
71
71
  raise BraintreeError.new(result), result.message unless result.success?
72
72
 
73
73
  create_subscription(result.subscription, "braintree", name, plan, status: :active)
74
- rescue ::Braintree::AuthorizationError => e
74
+ rescue ::Braintree::AuthorizationError
75
75
  raise BraintreeAuthorizationError
76
76
  rescue ::Braintree::BraintreeError => e
77
77
  raise BraintreeError, e.message
@@ -94,7 +94,7 @@ module Pay
94
94
  update_braintree_card_on_file result.payment_method
95
95
  update_subscriptions_to_payment_method(result.payment_method.token)
96
96
  true
97
- rescue ::Braintree::AuthorizationError => e
97
+ rescue ::Braintree::AuthorizationError
98
98
  raise BraintreeAuthorizationError
99
99
  rescue ::Braintree::BraintreeError => e
100
100
  raise BraintreeError, e.message
@@ -12,7 +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
+ ::Stripe.api_version = "2020-08-27"
16
16
  ::StripeEvent.signing_secret = signing_secret
17
17
 
18
18
  Pay.charge_model.include Pay::Stripe::Charge
@@ -97,7 +97,7 @@ module Pay
97
97
  def update_stripe_email!
98
98
  customer = stripe_customer
99
99
  customer.email = email
100
- customer.description = customer_name
100
+ customer.name = customer_name
101
101
  customer.save
102
102
  end
103
103
 
@@ -137,7 +137,7 @@ module Pay
137
137
  private
138
138
 
139
139
  def create_stripe_customer
140
- customer = ::Stripe::Customer.create(email: email, description: customer_name)
140
+ customer = ::Stripe::Customer.create(email: email, name: customer_name)
141
141
  update(processor: "stripe", processor_id: customer.id)
142
142
 
143
143
  # Update the user's card on file if a token was passed in
@@ -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.proration_behavior = (prorate ? 'create_prorations' : 'none')
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.2.1"
2
+ VERSION = "2.2.2"
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.2.1
4
+ version: 2.2.2
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-09-02 00:00:00.000000000 Z
12
+ date: 2020-11-11 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.2
277
- signing_key:
276
+ rubygems_version: 3.1.4
277
+ signing_key:
278
278
  specification_version: 4
279
279
  summary: A Ruby on Rails subscription engine.
280
280
  test_files: []