From 88625ed0d317d008d9321e2dab916515b0d8b727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20K=C3=B6hlbrugge?= Date: Mon, 16 Sep 2024 19:14:51 +0100 Subject: [PATCH 01/21] Add link to create webhook with all the required events (#1065) --- docs/stripe/5_webhooks.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/stripe/5_webhooks.md b/docs/stripe/5_webhooks.md index 8fdfb9ce..789f2dd5 100644 --- a/docs/stripe/5_webhooks.md +++ b/docs/stripe/5_webhooks.md @@ -54,6 +54,8 @@ checkout.session.completed checkout.session.async_payment_succeeded ``` +[Click here](https://dashboard.stripe.com/webhooks/create?events=charge.succeeded%2Ccharge.refunded%2Cpayment_intent.succeeded%2Cinvoice.upcoming%2Cinvoice.payment_action_required%2Ccustomer.subscription.created%2Ccustomer.subscription.updated%2Ccustomer.subscription.deleted%2Ccustomer.subscription.trial_will_end%2Ccustomer.updated%2Ccustomer.deleted%2Cpayment_method.attached%2Cpayment_method.updated%2Cpayment_method.automatically_updated%2Cpayment_method.detached%2Caccount.updated%2Ccheckout.session.completed%2Ccheckout.session.async_payment_succeeded) to create a new Stripe webhook with all the events pre-filled. + ## Next See [Metered Billing](6_metered_billing.md) From 70a6be12abe2e065998a9d41f195e6eea9799459 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:10:18 -0500 Subject: [PATCH 02/21] Bump puma from 6.4.2 to 6.4.3 (#1067) Bumps [puma](https://github.com/puma/puma) from 6.4.2 to 6.4.3. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](https://github.com/puma/puma/compare/v6.4.2...v6.4.3) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 31ad4a46..7789530b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -181,7 +181,7 @@ GEM psych (5.1.2) stringio public_suffix (6.0.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (3.1.7) From 8c49d545ce232fef69563d07d50db28baad41379 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Mon, 23 Sep 2024 18:29:00 -0500 Subject: [PATCH 03/21] Update upgrade guide --- UPGRADE.md | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index ba6d0da1..cee3c8e2 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,17 +1,19 @@ -# **Upgrade Guide** +# Upgrade Guide Follow this guide to upgrade older Pay versions. These may require database migrations and code changes. -### ** Pay 7.0 to Pay 8.0** +## Pay 7.0 to Pay 8.0 + +Pay has moved to using Single Table Inheritance to handle each payment processor's functionality. To do this, we've provided a migration to update the existing records. ```bash rails pay:install:migrations rails db:migrate ``` -The `PaymentMethod#type` column has been renamed to `payment_method_type`. If you're displaying payment method details, you'll need to update your views to use the new column name. +The `PaymentMethod#type` column has been renamed to `payment_method_type` to prevent conflicting with STI. If you're displaying payment method details, you'll need to update your views to use the new column name. -## **Pay 6.0 to Pay 7.0** +## Pay 6.0 to Pay 7.0 Pay 7 introduces some changes for Stripe and requires a few additional columns. @@ -52,7 +54,7 @@ The secrets/environment variables for Paddle have also been renamed to from `PAD The `paddle_pay` gem requirement has been replaced with `paddle`, which contains APIs for both Paddle Billing and Classic. -## **Pay 5.0 to 6.0** +## Pay 5.0 to 6.0 This version adds support for accessing the start and end of the current billing period of a subscription. This currently only works with Stripe subscriptions. Fields changed: @@ -93,11 +95,11 @@ end Stripe subscriptions created before this upgrade will gain the `current_period_start` and `current_period_end` attributes the next time they are synced. You can manually sync a Stripe subscription by running `Pay::Stripe::Subscription.sync("STRIPE_SUBSCRIPTION_ID")` -## **Pay 3.0 to 4.0** +## Pay 3.0 to 4.0 This is a major change to add Stripe tax support, Stripe metered billing, new configuration options for payment processors and emails, syncing additional customer attributes to Stripe and Braintree, and improving the architecture of Pay. -### **Jump to a topic** +### Jump to a topic - [Method Additions and Changes](#method-additions-and-changes) - [Custom Email Sending Configuration](#custom-email-sending-configuration) - [Customer Attributes](#customer-attributes) @@ -106,7 +108,7 @@ This is a major change to add Stripe tax support, Stripe metered billing, new co - [Enabling Payment Processors](#enabling-payment-processors) - [Supported Dependency Notifications](#supported-dependency-notifications) -### **Method Additions and Changes** +### Method Additions and Changes In an effort to keep a consistant naming convention, the email parameters of `subscription` and `charge` have been updated to have `pay_` prepended to them (`pay_subscription` and `pay_charge` respectively). If you are directly using any of the built in emails or created custom Pay views, you will want to be sure to update your parameter names to the updated names. @@ -126,7 +128,7 @@ The `set_payment_processor` method has a `make_default` optional argument that d Setting the `metadata["pay_name"]` option on a `Stripe::Subscription` object will now set the subscription name if present. Otherwise the `Pay.default_product_name` will be used to set the name. -### **Custom Email Sending Configuration** +### Custom Email Sending Configuration Previously, Pay would send out the following emails based on the value of the `send_emails` configuration variable, which was set to true by default: @@ -150,7 +152,7 @@ end ``` The above example shows the exact defaults that come pre-configured from Pay. The `config.emails.subscription_renewing` example is specific to Stripe but illustrates how a lambda can be used as a way to evaluate more complex conditions to determine whether an email should be sent. All of these settings can be overridden using the initializer mentioned previously and setting your own values for each email. -### **Customer Attributes** +### Customer Attributes The `pay_customer` macro now accepts options for `stripe_attributes` and `braintree_attributes`. These options can accept a method name or a lambda that returns a hash of `pay_customer` attributes. For example: ```ruby @@ -176,7 +178,7 @@ end Being able to send additional customer attributes to Stripe such as the customers address gives you the ability to leverage Stripe's tax support! -### **Stripe Tax Support** +### Stripe Tax Support Using `pay_customer stripe_attributes: :method_name`, you can add an `address` key to `Stripe::Customer` objects which will be used for calculating taxes. `total_tax_amounts` are recorded to `Pay::Charge` records. This includes details for each tax applied to the charge, for example if there are multiple jurisdictions involved. Additionally, when subscribing a customer to a plan the `automatic_tax:` parameter can be enabled as shown here: @@ -184,7 +186,7 @@ Using `pay_customer stripe_attributes: :method_name`, you can add an `address` k @user.payment_processor.subscribe(plan: "growth", automatic_tax: { enabled: true }) ``` -### **Stripe Metered Billing Support** +### Stripe Metered Billing Support Stripe metered billing support removes `quantity` when creating a new subscription (metered billing prices do not allow quantity). Adds `create_usage_record` to `Pay::Subscription` for reporting usage on metered billing plans. The `create_usage_record` method takes a hash of options, see the example below: ```ruby @@ -192,7 +194,7 @@ create_usage_record(subscription_item_id: "si_1234", quantity: 100, action: :set ``` To learn more about creating usage records, see [reporting usage](https://stripe.com/docs/products-prices/pricing-models#reporting-usage) -### **Enabling Payment Processors** +### Enabling Payment Processors Previously, all payment processors were enabled by default. With this new release, Pay now allows you to enable any of the payment processors independently. The use case here is that perhaps you already have an implementation in place in your application for one of the processors that we allow integration with and do not want the Pay implementation to conflict. In such a case you can create or add to an initializer at `config/initializers/pay.rb` the following line, including in the array only the process that you wish Pay to setup in your application: ```ruby @@ -204,7 +206,7 @@ Pay.setup do |config| end ``` -### **Supported Dependency Notifications** +### Supported Dependency Notifications As Pay is working to setup the payment processors that you have enabled it performs a version check on each to ensure that you are using a compatible version. @@ -218,11 +220,11 @@ If you are using a non-compatible version Pay will raise an error message to not --- -## **Pay 2.x to Pay 3.0** +## Pay 2.x to Pay 3.0 This is a major change to add support for multiple payment methods, fixing bugs, and improving the architecture of Pay. -### **Jump to a topic** +### Jump to a topic - [Database Migrations](#database-migrations) - [Pay::Customer](#paycustomer) - [Payment Processor](#payment-processor) @@ -231,7 +233,7 @@ This is a major change to add support for multiple payment methods, fixing bugs, - [Payment Methods](#payment-methods) - [Configuration Changes](#configuration-changes) -### **Database Migrations** +### Database Migrations Upgrading from Pay 2.x to 3.0 requires moving data for several things: @@ -438,7 +440,7 @@ After running migrations, run the following to sync the customer default payment rake pay:payment_methods:sync_default ``` -### **Pay::Customer** +### Pay::Customer The `Pay::Billable` module has been removed and is replaced with `pay_customer` method on your models. @@ -465,7 +467,7 @@ user.pay_customers #=> Returns all the pay customers associated with this User ``` -### **Payment Processor** +### Payment Processor Instead of calling `@user.charge`, Pay 3 moves the `charge`, `subscribe`, and other methods to the `payment_processor` association. This significantly reduces the methods added to the User model. @@ -486,7 +488,7 @@ user.payment_processor.subscribe(plan: "whatever") # Creates Pay::Subscription record for the subscription ``` -### **Generic Trials** +### Generic Trials Generic trials are now done using the fake payment processor @@ -496,11 +498,11 @@ user.payment_processor.subscribe(trial_ends_at: 14.days.from_now, ends_at: 14.da user.payment_processor.on_trial? #=> true ``` -### **Charges & Subscriptions** +### Charges & Subscriptions `Pay::Charge` and `Pay::Subscription` are associated `Pay::Customer` and no longer directly connected to the `owner` -### **Payment Methods** +### Payment Methods Pay 3 now keeps track of multiple payment methods. Each is associated with a Pay::Customer and one is marked as the default. @@ -517,7 +519,7 @@ charge.payment_method_type #=> "paypal" charge.email #=> "test@example.org" ``` -### **Configuration Changes** +### Configuration Changes We've removed several configuration options since Pay 3+ will always use the models from the gem for charges, subscriptions, etc. From c592414e50ffd5a6394109cdd5e64fa4436d18ea Mon Sep 17 00:00:00 2001 From: Lorenzo Zabot Date: Mon, 30 Sep 2024 17:27:18 +0200 Subject: [PATCH 04/21] Update GitHub actions versions (#1070) --- .github/dependabot.yml | 4 ++++ .github/workflows/ci.yml | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0ee37b8f..89829c70 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,3 +12,7 @@ updates: - dependency-name: actionpack versions: - 6.1.2.1 +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: monthly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8cafe9e..0fc20274 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: steps: - name: SQLite3 version run: sqlite3 --version - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -72,7 +72,7 @@ jobs: ports: ['5432:5432'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -115,7 +115,7 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: From 794cec0580f37936e2571f64dc752194a67d1e61 Mon Sep 17 00:00:00 2001 From: Jatin Goyal Date: Mon, 30 Sep 2024 23:12:28 +0530 Subject: [PATCH 05/21] update paddle.js initialization documentation keeping in line with latest paddle docs (#1080) --- docs/paddle_billing/2_javascript.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/paddle_billing/2_javascript.md b/docs/paddle_billing/2_javascript.md index 373de7ad..3310ed8e 100644 --- a/docs/paddle_billing/2_javascript.md +++ b/docs/paddle_billing/2_javascript.md @@ -11,8 +11,8 @@ Add the Paddle.js script in your application layout and initialize it with your ``` From 8cdc7a1a4d36d535471238ff993d2f6aac3e5570 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:42:53 -0500 Subject: [PATCH 06/21] Bump sqlite3 from 2.0.4 to 2.1.0 (#1071) Bumps [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) from 2.0.4 to 2.1.0. - [Release notes](https://github.com/sparklemotion/sqlite3-ruby/releases) - [Changelog](https://github.com/sparklemotion/sqlite3-ruby/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/sqlite3-ruby/compare/v2.0.4...v2.1.0) --- updated-dependencies: - dependency-name: sqlite3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7789530b..0eaa23eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -258,10 +258,10 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (2.0.4) + sqlite3 (2.1.0) mini_portile2 (~> 2.8.0) - sqlite3 (2.0.4-x86_64-darwin) - sqlite3 (2.0.4-x86_64-linux-gnu) + sqlite3 (2.1.0-x86_64-darwin) + sqlite3 (2.1.0-x86_64-linux-gnu) standard (1.40.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) From d7222258688a8487987b5c0808b7fefaa573042c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:43:15 -0500 Subject: [PATCH 07/21] Bump braintree from 4.21.0 to 4.22.0 (#1079) Bumps [braintree](https://github.com/braintree/braintree_ruby) from 4.21.0 to 4.22.0. - [Changelog](https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md) - [Commits](https://github.com/braintree/braintree_ruby/compare/4.21.0...4.22.0) --- updated-dependencies: - dependency-name: braintree dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0eaa23eb..b61e9355 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -92,7 +92,7 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) bindex (0.8.1) - braintree (4.21.0) + braintree (4.22.0) builder (>= 3.2.4) rexml (>= 3.1.9) builder (3.3.0) @@ -231,7 +231,7 @@ GEM regexp_parser (2.9.2) reline (0.5.9) io-console (~> 0.5) - rexml (3.3.7) + rexml (3.3.8) rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) From 1a21821b7827cd2ac8cc54c62adb12aeeaa1a515 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:53:55 -0500 Subject: [PATCH 08/21] Bump stripe from 12.5.0 to 12.6.0 (#1078) Bumps [stripe](https://github.com/stripe/stripe-ruby) from 12.5.0 to 12.6.0. - [Release notes](https://github.com/stripe/stripe-ruby/releases) - [Changelog](https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md) - [Commits](https://github.com/stripe/stripe-ruby/compare/v12.5.0...v12.6.0) --- updated-dependencies: - dependency-name: stripe dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index afc89d40..e98d9350 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" gem "paddle", "~> 2.4" -gem "stripe", "~> 12.0" +gem "stripe", "~> 12.6" gem "prawn" gem "receipts" diff --git a/Gemfile.lock b/Gemfile.lock index b61e9355..2eb8c91e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -277,7 +277,7 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) - stripe (12.5.0) + stripe (12.6.0) thor (1.3.2) timeout (0.4.1) ttfunk (1.8.0) @@ -333,7 +333,7 @@ DEPENDENCIES sqlite3 standard stimulus-rails - stripe (~> 12.0) + stripe (~> 12.6) turbo-rails vcr web-console From 0ec83743d3fe4070f70d60b200e48f9a0c54c9e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:55:27 -0500 Subject: [PATCH 09/21] Bump pg from 1.5.7 to 1.5.8 (#1077) Bumps [pg](https://github.com/ged/ruby-pg) from 1.5.7 to 1.5.8. - [Changelog](https://github.com/ged/ruby-pg/blob/master/History.md) - [Commits](https://github.com/ged/ruby-pg/compare/v1.5.7...v1.5.8) --- updated-dependencies: - dependency-name: pg dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2eb8c91e..4fc19d0c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -171,7 +171,7 @@ GEM ast (~> 2.4.1) racc pdf-core (0.10.0) - pg (1.5.7) + pg (1.5.8) prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) From 039a6809156481f6bcc7d808a5efc42a3712626d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:55:45 -0500 Subject: [PATCH 10/21] Bump net-imap from 0.4.15 to 0.4.16 (#1076) Bumps [net-imap](https://github.com/ruby/net-imap) from 0.4.15 to 0.4.16. - [Release notes](https://github.com/ruby/net-imap/releases) - [Commits](https://github.com/ruby/net-imap/compare/v0.4.15...v0.4.16) --- updated-dependencies: - dependency-name: net-imap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4fc19d0c..a6e427f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -147,7 +147,7 @@ GEM mysql2 (0.5.6) net-http (0.4.1) uri - net-imap (0.4.15) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) From e3bf7912a09f42f8bd0e82d4522ef86177608cd0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:55:53 -0500 Subject: [PATCH 11/21] Bump webrick from 1.8.1 to 1.8.2 (#1072) Bumps [webrick](https://github.com/ruby/webrick) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/ruby/webrick/releases) - [Commits](https://github.com/ruby/webrick/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: webrick dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a6e427f5..73dc3b46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -302,7 +302,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) + webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) From 1ff893f4038840070c4bca55e22cf4014e6b5043 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:56:04 -0500 Subject: [PATCH 12/21] Bump appraisal from `c83f837` to `24feeea` (#1073) Bumps [appraisal](https://github.com/thoughtbot/appraisal) from `c83f837` to `24feeea`. - [Release notes](https://github.com/thoughtbot/appraisal/releases) - [Commits](https://github.com/thoughtbot/appraisal/compare/c83f8376d8f1024d999433010cf81948d56b937e...24feeea4c5c1d2e7a5f95d053da61858c6bfb2b1) --- updated-dependencies: - dependency-name: appraisal dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 73dc3b46..d6a412de 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/appraisal.git - revision: c83f8376d8f1024d999433010cf81948d56b937e + revision: 24feeea4c5c1d2e7a5f95d053da61858c6bfb2b1 specs: appraisal (2.5.0) bundler From 2dfe9e0c9ca62bcc71853bdcf1674c4c58ac5316 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:02:10 -0500 Subject: [PATCH 13/21] Bump paddle from 2.5.1 to 2.6.0 (#1074) Bumps [paddle](https://github.com/deanpcmad/paddle) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/deanpcmad/paddle/releases) - [Commits](https://github.com/deanpcmad/paddle/compare/v2.5.1...v2.6.0) --- updated-dependencies: - dependency-name: paddle dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index e98d9350..672b7204 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" -gem "paddle", "~> 2.4" +gem "paddle", "~> 2.6" gem "stripe", "~> 12.6" gem "prawn" diff --git a/Gemfile.lock b/Gemfile.lock index d6a412de..2505e98e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -164,8 +164,10 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - paddle (2.5.1) - faraday (~> 2.0) + ostruct (0.6.0) + paddle (2.6.0) + faraday (~> 2.11.0) + ostruct (~> 0.6.0) parallel (1.26.3) parser (3.3.5.0) ast (~> 2.4.1) @@ -323,7 +325,7 @@ DEPENDENCIES net-imap net-pop net-smtp - paddle (~> 2.4) + paddle (~> 2.6) pay! pg prawn From d649ef63e4d3e9b34e48ac5e2711dd37248b7887 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:02:18 -0500 Subject: [PATCH 14/21] Bump turbo-rails from 2.0.6 to 2.0.10 (#1075) Bumps [turbo-rails](https://github.com/hotwired/turbo-rails) from 2.0.6 to 2.0.10. - [Release notes](https://github.com/hotwired/turbo-rails/releases) - [Commits](https://github.com/hotwired/turbo-rails/compare/v2.0.6...v2.0.10) --- updated-dependencies: - dependency-name: turbo-rails dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2505e98e..aed2928b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -113,14 +113,14 @@ GEM globalid (1.2.1) activesupport (>= 6.1) hashdiff (1.1.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.7.2) @@ -231,7 +231,7 @@ GEM prawn (>= 1.3.0, < 3.0.0) prawn-table (~> 0.2.1) regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.10) io-console (~> 0.5) rexml (3.3.8) rubocop (1.65.1) @@ -284,9 +284,8 @@ GEM timeout (0.4.1) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbo-rails (2.0.6) + turbo-rails (2.0.10) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) From 7bc6060a9aedb0d590f86c1d686ae885ed1e0a0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:36:40 -0500 Subject: [PATCH 15/21] Bump webmock from 3.23.1 to 3.24.0 (#1082) Bumps [webmock](https://github.com/bblimke/webmock) from 3.23.1 to 3.24.0. - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/compare/v3.23.1...v3.24.0) --- updated-dependencies: - dependency-name: webmock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index aed2928b..10e6b9af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -299,7 +299,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) From dee8f39c5c2ca2942cf78b52943141766fb3d6f5 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Wed, 2 Oct 2024 09:38:30 -0500 Subject: [PATCH 16/21] Replace OpenStruct with InheritableOptions Closes #1081 Co-authored-by: Jatin Goyal --- app/models/pay/braintree/subscription.rb | 4 ++-- app/models/pay/webhook.rb | 2 +- test/models/pay/webhook_test.rb | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/models/pay/braintree/subscription.rb b/app/models/pay/braintree/subscription.rb index c08841cd..df3d4129 100644 --- a/app/models/pay/braintree/subscription.rb +++ b/app/models/pay/braintree/subscription.rb @@ -191,7 +191,7 @@ def switching_to_monthly_plan?(current_plan, plan) def discount_for_switching_to_monthly(current_plan, plan) cycles = (money_remaining_on_yearly_plan(current_plan) / plan.price).floor - OpenStruct.new( + ActiveSupport::InheritableOptions.new( amount: plan.price, number_of_billing_cycles: cycles ) @@ -209,7 +209,7 @@ def discount_for_switching_to_yearly(amount: 0) end end - OpenStruct.new(amount: amount, number_of_billing_cycles: 1) + ActiveSupport::InheritableOptions.new(amount: amount, number_of_billing_cycles: 1) end def swap_across_frequencies(plan) diff --git a/app/models/pay/webhook.rb b/app/models/pay/webhook.rb index f1a32669..fc4023ff 100644 --- a/app/models/pay/webhook.rb +++ b/app/models/pay/webhook.rb @@ -32,7 +32,7 @@ def rehydrated_event def to_recursive_ostruct(obj) if obj.is_a?(Hash) - OpenStruct.new(obj.map { |key, val| [key, to_recursive_ostruct(val)] }.to_h) + ActiveSupport::InheritableOptions.new(obj.map { |key, val| [key.to_sym, to_recursive_ostruct(val)] }.to_h) elsif obj.is_a?(Array) obj.map { |o| to_recursive_ostruct(o) } else # Assumed to be a primitive value diff --git a/test/models/pay/webhook_test.rb b/test/models/pay/webhook_test.rb index a750d857..790a2739 100644 --- a/test/models/pay/webhook_test.rb +++ b/test/models/pay/webhook_test.rb @@ -4,10 +4,15 @@ class Pay::Webhook::Test < ActiveSupport::TestCase test "rehydrates a Paddle Classic event" do pay_webhook = Pay::Webhook.create processor: :paddle_classic, event_type: :example, event: json_fixture("paddle_classic/subscription_payment_succeeded") event = pay_webhook.rehydrated_event - assert_equal OpenStruct, event.class assert_equal "visa", event.payment_method.card_type end + test "rehydrates a Paddle Billing event" do + pay_webhook = Pay::Webhook.create processor: :paddle_billing, event_type: :example, event: json_fixture("paddle_billing/subscription.created") + event = pay_webhook.rehydrated_event + assert_equal "month", event.billing_cycle.interval + end + test "rehydrates a Stripe event" do pay_webhook = Pay::Webhook.create processor: :stripe, event_type: :example, event: json_fixture("stripe/customer.updated") event = pay_webhook.rehydrated_event From 2a2eeb13fab40c99978cd2dac68c267f87998253 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Wed, 2 Oct 2024 10:06:47 -0500 Subject: [PATCH 17/21] Stripe v13 support --- Gemfile | 2 +- Gemfile.lock | 8 +- gemfiles/rails_6_1.gemfile | 4 +- gemfiles/rails_6_1.gemfile.lock | 35 ++-- gemfiles/rails_7.gemfile | 4 +- gemfiles/rails_7.gemfile.lock | 35 ++-- gemfiles/rails_7_1.gemfile | 4 +- gemfiles/rails_7_1.gemfile.lock | 41 ++--- gemfiles/rails_7_2.gemfile | 4 +- gemfiles/rails_7_2.gemfile.lock | 47 +++--- gemfiles/rails_main.gemfile | 4 +- gemfiles/rails_main.gemfile.lock | 157 +++++++++--------- lib/pay/stripe.rb | 2 +- .../stripe/webhooks/customer_updated_test.rb | 2 +- 14 files changed, 178 insertions(+), 171 deletions(-) diff --git a/Gemfile b/Gemfile index 672b7204..8b9d46c1 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" gem "paddle", "~> 2.6" -gem "stripe", "~> 12.6" +gem "stripe", "~> 13.0" gem "prawn" gem "receipts" diff --git a/Gemfile.lock b/Gemfile.lock index 10e6b9af..088cabad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -245,7 +245,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.2) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) @@ -279,7 +279,7 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) - stripe (12.6.0) + stripe (13.0.0) thor (1.3.2) timeout (0.4.1) ttfunk (1.8.0) @@ -289,7 +289,7 @@ GEM railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) uri (0.13.1) useragent (0.16.10) vcr (6.3.1) @@ -334,7 +334,7 @@ DEPENDENCIES sqlite3 standard stimulus-rails - stripe (~> 12.6) + stripe (~> 13.0) turbo-rails vcr web-console diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index 7a9a8851..d7e93715 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -9,8 +9,8 @@ gem "vcr" gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" -gem "paddle", "~> 2.4" -gem "stripe", "~> 12.0" +gem "paddle", "~> 2.6" +gem "stripe", "~> 13.0" gem "prawn" gem "receipts" gem "mysql2" diff --git a/gemfiles/rails_6_1.gemfile.lock b/gemfiles/rails_6_1.gemfile.lock index c1acdf6f..84814daa 100644 --- a/gemfiles/rails_6_1.gemfile.lock +++ b/gemfiles/rails_6_1.gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/appraisal.git - revision: c83f8376d8f1024d999433010cf81948d56b937e + revision: 24feeea4c5c1d2e7a5f95d053da61858c6bfb2b1 specs: appraisal (2.5.0) bundler @@ -81,7 +81,7 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) bindex (0.8.1) - braintree (4.21.0) + braintree (4.22.0) builder (>= 3.2.4) rexml (>= 3.1.9) builder (3.3.0) @@ -100,7 +100,7 @@ GEM globalid (1.2.1) activesupport (>= 6.1) hashdiff (1.1.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) @@ -130,7 +130,7 @@ GEM mysql2 (0.5.6) net-http (0.4.1) uri - net-imap (0.4.15) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) @@ -146,14 +146,16 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - paddle (2.5.1) - faraday (~> 2.0) + ostruct (0.6.0) + paddle (2.6.0) + faraday (~> 2.11.0) + ostruct (~> 0.6.0) parallel (1.26.3) parser (3.3.5.0) ast (~> 2.4.1) racc pdf-core (0.10.0) - pg (1.5.7) + pg (1.5.8) prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) @@ -161,7 +163,7 @@ GEM prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) public_suffix (6.0.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (2.2.9) @@ -201,7 +203,7 @@ GEM prawn (>= 1.3.0, < 3.0.0) prawn-table (~> 0.2.1) regexp_parser (2.9.2) - rexml (3.3.7) + rexml (3.3.8) rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -213,7 +215,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.2) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) @@ -244,18 +246,17 @@ GEM rubocop-performance (~> 1.21.0) stimulus-rails (1.3.4) railties (>= 6.0.0) - stripe (12.5.0) + stripe (13.0.0) thor (1.3.2) timeout (0.4.1) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbo-rails (2.0.6) + turbo-rails (2.0.10) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) uri (0.13.1) vcr (6.3.1) base64 @@ -264,7 +265,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -293,7 +294,7 @@ DEPENDENCIES net-imap net-pop net-smtp - paddle (~> 2.4) + paddle (~> 2.6) pay! pg prawn @@ -304,7 +305,7 @@ DEPENDENCIES sqlite3 (~> 1.4) standard stimulus-rails - stripe (~> 12.0) + stripe (~> 13.0) turbo-rails vcr web-console diff --git a/gemfiles/rails_7.gemfile b/gemfiles/rails_7.gemfile index d96eb3e8..1b5e20fb 100644 --- a/gemfiles/rails_7.gemfile +++ b/gemfiles/rails_7.gemfile @@ -9,8 +9,8 @@ gem "vcr" gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" -gem "paddle", "~> 2.4" -gem "stripe", "~> 12.0" +gem "paddle", "~> 2.6" +gem "stripe", "~> 13.0" gem "prawn" gem "receipts" gem "mysql2" diff --git a/gemfiles/rails_7.gemfile.lock b/gemfiles/rails_7.gemfile.lock index b913b9fc..1ac618b2 100644 --- a/gemfiles/rails_7.gemfile.lock +++ b/gemfiles/rails_7.gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/appraisal.git - revision: c83f8376d8f1024d999433010cf81948d56b937e + revision: 24feeea4c5c1d2e7a5f95d053da61858c6bfb2b1 specs: appraisal (2.5.0) bundler @@ -87,7 +87,7 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) bindex (0.8.1) - braintree (4.21.0) + braintree (4.22.0) builder (>= 3.2.4) rexml (>= 3.1.9) builder (3.3.0) @@ -106,7 +106,7 @@ GEM globalid (1.2.1) activesupport (>= 6.1) hashdiff (1.1.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) @@ -136,7 +136,7 @@ GEM mysql2 (0.5.6) net-http (0.4.1) uri - net-imap (0.4.15) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) @@ -152,14 +152,16 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - paddle (2.5.1) - faraday (~> 2.0) + ostruct (0.6.0) + paddle (2.6.0) + faraday (~> 2.11.0) + ostruct (~> 0.6.0) parallel (1.26.3) parser (3.3.5.0) ast (~> 2.4.1) racc pdf-core (0.10.0) - pg (1.5.7) + pg (1.5.8) prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) @@ -167,7 +169,7 @@ GEM prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) public_suffix (6.0.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (2.2.9) @@ -207,7 +209,7 @@ GEM prawn (>= 1.3.0, < 3.0.0) prawn-table (~> 0.2.1) regexp_parser (2.9.2) - rexml (3.3.7) + rexml (3.3.8) rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -219,7 +221,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.2) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) @@ -250,18 +252,17 @@ GEM rubocop-performance (~> 1.21.0) stimulus-rails (1.3.4) railties (>= 6.0.0) - stripe (12.5.0) + stripe (13.0.0) thor (1.3.2) timeout (0.4.1) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbo-rails (2.0.6) + turbo-rails (2.0.10) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) uri (0.13.1) vcr (6.3.1) base64 @@ -270,7 +271,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -299,7 +300,7 @@ DEPENDENCIES net-imap net-pop net-smtp - paddle (~> 2.4) + paddle (~> 2.6) pay! pg prawn @@ -310,7 +311,7 @@ DEPENDENCIES sqlite3 (~> 1.4) standard stimulus-rails - stripe (~> 12.0) + stripe (~> 13.0) turbo-rails vcr web-console diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile index 4ffc2ff4..75335575 100644 --- a/gemfiles/rails_7_1.gemfile +++ b/gemfiles/rails_7_1.gemfile @@ -9,8 +9,8 @@ gem "vcr" gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" -gem "paddle", "~> 2.4" -gem "stripe", "~> 12.0" +gem "paddle", "~> 2.6" +gem "stripe", "~> 13.0" gem "prawn" gem "receipts" gem "mysql2" diff --git a/gemfiles/rails_7_1.gemfile.lock b/gemfiles/rails_7_1.gemfile.lock index 31db494a..17a68352 100644 --- a/gemfiles/rails_7_1.gemfile.lock +++ b/gemfiles/rails_7_1.gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/appraisal.git - revision: c83f8376d8f1024d999433010cf81948d56b937e + revision: 24feeea4c5c1d2e7a5f95d053da61858c6bfb2b1 specs: appraisal (2.5.0) bundler @@ -96,7 +96,7 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) bindex (0.8.1) - braintree (4.21.0) + braintree (4.22.0) builder (>= 3.2.4) rexml (>= 3.1.9) builder (3.3.0) @@ -117,14 +117,14 @@ GEM globalid (1.2.1) activesupport (>= 6.1) hashdiff (1.1.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.7.2) @@ -151,7 +151,7 @@ GEM mysql2 (0.5.6) net-http (0.4.1) uri - net-imap (0.4.15) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) @@ -167,14 +167,16 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - paddle (2.5.1) - faraday (~> 2.0) + ostruct (0.6.0) + paddle (2.6.0) + faraday (~> 2.11.0) + ostruct (~> 0.6.0) parallel (1.26.3) parser (3.3.5.0) ast (~> 2.4.1) racc pdf-core (0.10.0) - pg (1.5.7) + pg (1.5.8) prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) @@ -184,7 +186,7 @@ GEM psych (5.1.2) stringio public_suffix (6.0.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (3.1.7) @@ -232,9 +234,9 @@ GEM prawn (>= 1.3.0, < 3.0.0) prawn-table (~> 0.2.1) regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.10) io-console (~> 0.5) - rexml (3.3.7) + rexml (3.3.8) rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -246,7 +248,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.2) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) @@ -278,18 +280,17 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) - stripe (12.5.0) + stripe (13.0.0) thor (1.3.2) timeout (0.4.1) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbo-rails (2.0.6) + turbo-rails (2.0.10) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) uri (0.13.1) vcr (6.3.1) base64 @@ -298,11 +299,11 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) + webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -325,7 +326,7 @@ DEPENDENCIES net-imap net-pop net-smtp - paddle (~> 2.4) + paddle (~> 2.6) pay! pg prawn @@ -336,7 +337,7 @@ DEPENDENCIES sqlite3 (~> 1.4) standard stimulus-rails - stripe (~> 12.0) + stripe (~> 13.0) turbo-rails vcr web-console diff --git a/gemfiles/rails_7_2.gemfile b/gemfiles/rails_7_2.gemfile index 851a39d8..3a9e5396 100644 --- a/gemfiles/rails_7_2.gemfile +++ b/gemfiles/rails_7_2.gemfile @@ -9,8 +9,8 @@ gem "vcr" gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" -gem "paddle", "~> 2.4" -gem "stripe", "~> 12.0" +gem "paddle", "~> 2.6" +gem "stripe", "~> 13.0" gem "prawn" gem "receipts" gem "mysql2" diff --git a/gemfiles/rails_7_2.gemfile.lock b/gemfiles/rails_7_2.gemfile.lock index 8e6ee849..d1315568 100644 --- a/gemfiles/rails_7_2.gemfile.lock +++ b/gemfiles/rails_7_2.gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/thoughtbot/appraisal.git - revision: c83f8376d8f1024d999433010cf81948d56b937e + revision: 24feeea4c5c1d2e7a5f95d053da61858c6bfb2b1 specs: appraisal (2.5.0) bundler @@ -92,7 +92,7 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) bindex (0.8.1) - braintree (4.21.0) + braintree (4.22.0) builder (>= 3.2.4) rexml (>= 3.1.9) builder (3.3.0) @@ -113,14 +113,14 @@ GEM globalid (1.2.1) activesupport (>= 6.1) hashdiff (1.1.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.7.2) @@ -146,7 +146,7 @@ GEM mysql2 (0.5.6) net-http (0.4.1) uri - net-imap (0.4.15) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) @@ -162,14 +162,16 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - paddle (2.5.1) - faraday (~> 2.0) + ostruct (0.6.0) + paddle (2.6.0) + faraday (~> 2.11.0) + ostruct (~> 0.6.0) parallel (1.26.3) parser (3.3.5.0) ast (~> 2.4.1) racc pdf-core (0.10.0) - pg (1.5.7) + pg (1.5.8) prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) @@ -179,7 +181,7 @@ GEM psych (5.1.2) stringio public_suffix (6.0.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (3.1.7) @@ -227,9 +229,9 @@ GEM prawn (>= 1.3.0, < 3.0.0) prawn-table (~> 0.2.1) regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.10) io-console (~> 0.5) - rexml (3.3.7) + rexml (3.3.8) rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -241,7 +243,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.2) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) @@ -256,9 +258,9 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (2.0.4-arm64-darwin) - sqlite3 (2.0.4-x86_64-darwin) - sqlite3 (2.0.4-x86_64-linux-gnu) + sqlite3 (2.1.0-arm64-darwin) + sqlite3 (2.1.0-x86_64-darwin) + sqlite3 (2.1.0-x86_64-linux-gnu) standard (1.40.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) @@ -274,18 +276,17 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) - stripe (12.5.0) + stripe (13.0.0) thor (1.3.2) timeout (0.4.1) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbo-rails (2.0.6) + turbo-rails (2.0.10) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) uri (0.13.1) useragent (0.16.10) vcr (6.3.1) @@ -295,11 +296,11 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) + webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -325,7 +326,7 @@ DEPENDENCIES net-imap net-pop net-smtp - paddle (~> 2.4) + paddle (~> 2.6) pay! pg prawn @@ -336,7 +337,7 @@ DEPENDENCIES sqlite3 (~> 2.0) standard stimulus-rails - stripe (~> 12.0) + stripe (~> 13.0) turbo-rails vcr web-console diff --git a/gemfiles/rails_main.gemfile b/gemfiles/rails_main.gemfile index 6eb0e1e9..30166755 100644 --- a/gemfiles/rails_main.gemfile +++ b/gemfiles/rails_main.gemfile @@ -9,8 +9,8 @@ gem "vcr" gem "webmock" gem "braintree", ">= 2.92.0" gem "lemonsqueezy", "~> 1.0" -gem "paddle", "~> 2.4" -gem "stripe", "~> 12.0" +gem "paddle", "~> 2.6" +gem "stripe", "~> 13.0" gem "prawn" gem "receipts" gem "mysql2" diff --git a/gemfiles/rails_main.gemfile.lock b/gemfiles/rails_main.gemfile.lock index c6f25158..5d585822 100644 --- a/gemfiles/rails_main.gemfile.lock +++ b/gemfiles/rails_main.gemfile.lock @@ -1,31 +1,31 @@ GIT remote: https://github.com/rails/rails.git - revision: 69c86f9606e490b24e8628dc47f34fbec6b321d1 + revision: 9e49ab24edb8e79503329a44974bbb9d8e047917 branch: main specs: - actioncable (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + actioncable (8.0.0.beta1) + actionpack (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activestorage (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + actionmailbox (8.0.0.beta1) + actionpack (= 8.0.0.beta1) + activejob (= 8.0.0.beta1) + activerecord (= 8.0.0.beta1) + activestorage (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) mail (>= 2.8.0) - actionmailer (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - actionview (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + actionmailer (8.0.0.beta1) + actionpack (= 8.0.0.beta1) + actionview (= 8.0.0.beta1) + activejob (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.0.alpha) - actionview (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + actionpack (8.0.0.beta1) + actionview (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -33,36 +33,37 @@ GIT rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activestorage (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + actiontext (8.0.0.beta1) + actionpack (= 8.0.0.beta1) + activerecord (= 8.0.0.beta1) + activestorage (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.0.alpha) - activesupport (= 8.0.0.alpha) + actionview (8.0.0.beta1) + activesupport (= 8.0.0.beta1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.0.alpha) - activesupport (= 8.0.0.alpha) + activejob (8.0.0.beta1) + activesupport (= 8.0.0.beta1) globalid (>= 0.3.6) - activemodel (8.0.0.alpha) - activesupport (= 8.0.0.alpha) - activerecord (8.0.0.alpha) - activemodel (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + activemodel (8.0.0.beta1) + activesupport (= 8.0.0.beta1) + activerecord (8.0.0.beta1) + activemodel (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) timeout (>= 0.4.0) - activestorage (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + activestorage (8.0.0.beta1) + actionpack (= 8.0.0.beta1) + activejob (= 8.0.0.beta1) + activerecord (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) marcel (~> 1.0) - activesupport (8.0.0.alpha) + activesupport (8.0.0.beta1) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -73,23 +74,23 @@ GIT securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - rails (8.0.0.alpha) - actioncable (= 8.0.0.alpha) - actionmailbox (= 8.0.0.alpha) - actionmailer (= 8.0.0.alpha) - actionpack (= 8.0.0.alpha) - actiontext (= 8.0.0.alpha) - actionview (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activemodel (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activestorage (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + rails (8.0.0.beta1) + actioncable (= 8.0.0.beta1) + actionmailbox (= 8.0.0.beta1) + actionmailer (= 8.0.0.beta1) + actionpack (= 8.0.0.beta1) + actiontext (= 8.0.0.beta1) + actionview (= 8.0.0.beta1) + activejob (= 8.0.0.beta1) + activemodel (= 8.0.0.beta1) + activerecord (= 8.0.0.beta1) + activestorage (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) bundler (>= 1.15.0) - railties (= 8.0.0.alpha) - railties (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) + railties (= 8.0.0.beta1) + railties (8.0.0.beta1) + actionpack (= 8.0.0.beta1) + activesupport (= 8.0.0.beta1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -98,7 +99,7 @@ GIT GIT remote: https://github.com/thoughtbot/appraisal.git - revision: c83f8376d8f1024d999433010cf81948d56b937e + revision: 24feeea4c5c1d2e7a5f95d053da61858c6bfb2b1 specs: appraisal (2.5.0) bundler @@ -118,9 +119,10 @@ GEM public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) base64 (0.2.0) + benchmark (0.3.0) bigdecimal (3.1.8) bindex (0.8.1) - braintree (4.21.0) + braintree (4.22.0) builder (>= 3.2.4) rexml (>= 3.1.9) builder (3.3.0) @@ -141,14 +143,14 @@ GEM globalid (1.2.1) activesupport (>= 6.1) hashdiff (1.1.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.7.2) @@ -174,7 +176,7 @@ GEM mysql2 (0.5.6) net-http (0.4.1) uri - net-imap (0.4.15) + net-imap (0.4.16) date net-protocol net-pop (0.1.2) @@ -190,14 +192,16 @@ GEM racc (~> 1.4) nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) - paddle (2.5.1) - faraday (~> 2.0) + ostruct (0.6.0) + paddle (2.6.0) + faraday (~> 2.11.0) + ostruct (~> 0.6.0) parallel (1.26.3) parser (3.3.5.0) ast (~> 2.4.1) racc pdf-core (0.10.0) - pg (1.5.7) + pg (1.5.8) prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) @@ -207,7 +211,7 @@ GEM psych (5.1.2) stringio public_suffix (6.0.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) rack (3.1.7) @@ -233,9 +237,9 @@ GEM prawn (>= 1.3.0, < 3.0.0) prawn-table (~> 0.2.1) regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.10) io-console (~> 0.5) - rexml (3.3.7) + rexml (3.3.8) rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -247,7 +251,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.2) + rubocop-ast (1.32.3) parser (>= 3.3.1.0) rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) @@ -262,9 +266,9 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (2.0.4-arm64-darwin) - sqlite3 (2.0.4-x86_64-darwin) - sqlite3 (2.0.4-x86_64-linux-gnu) + sqlite3 (2.1.0-arm64-darwin) + sqlite3 (2.1.0-x86_64-darwin) + sqlite3 (2.1.0-x86_64-linux-gnu) standard (1.40.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) @@ -280,18 +284,17 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.1) - stripe (12.5.0) + stripe (13.0.0) thor (1.3.2) timeout (0.4.1) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbo-rails (2.0.6) + turbo-rails (2.0.10) actionpack (>= 6.0.0) - activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) uri (0.13.1) useragent (0.16.10) vcr (6.3.1) @@ -301,11 +304,11 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) + webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -331,7 +334,7 @@ DEPENDENCIES net-imap net-pop net-smtp - paddle (~> 2.4) + paddle (~> 2.6) pay! pg prawn @@ -342,7 +345,7 @@ DEPENDENCIES sqlite3 (~> 2.0) standard stimulus-rails - stripe (~> 12.0) + stripe (~> 13.0) turbo-rails vcr web-console diff --git a/lib/pay/stripe.rb b/lib/pay/stripe.rb index f3469b1c..a16cef68 100644 --- a/lib/pay/stripe.rb +++ b/lib/pay/stripe.rb @@ -27,7 +27,7 @@ module Webhooks extend Env - REQUIRED_VERSION = "~> 12" + REQUIRED_VERSION = "~> 13" # A list of database model names that include Pay # Used for safely looking up models with client_reference_id diff --git a/test/pay/stripe/webhooks/customer_updated_test.rb b/test/pay/stripe/webhooks/customer_updated_test.rb index 11da759d..eb1a7993 100644 --- a/test/pay/stripe/webhooks/customer_updated_test.rb +++ b/test/pay/stripe/webhooks/customer_updated_test.rb @@ -22,7 +22,7 @@ class Pay::Stripe::Webhooks::CustomerUpdatedTest < ActiveSupport::TestCase test "stripe invoice credit balance is updated" do event = stripe_event("customer.updated") - Pay::Stripe::Customer.any_instance.expects(:api_record).returns(OpenStruct.new(invoice_credit_balance: Stripe::Util.convert_to_stripe_object(usd: 12345), invoice_settings: OpenStruct.new(default_payment_method: nil), currency: "usd")) + Pay::Stripe::Customer.any_instance.expects(:api_record).returns(ActiveSupport::InheritableOptions.new(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: OpenStruct.new(default_payment_method: nil), currency: "usd")) Pay::Stripe::Webhooks::CustomerUpdated.new.call(event) @pay_customer.reload assert_equal "usd", @pay_customer.currency From 398f9b7c35caa84a298c3bae1244f3a87f37f987 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Wed, 2 Oct 2024 10:11:36 -0500 Subject: [PATCH 18/21] Only test against Ruby 3.2+ --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fc20274..f2134fb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ['3.1', '3.2', '3.3'] + ruby: ['3.2', '3.3'] gemfile: - rails_6_1 - rails_7 @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ['3.1', '3.2', '3.3'] + ruby: ['3.2', '3.3'] gemfile: - rails_6_1 - rails_7 @@ -94,7 +94,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ['3.1', '3.2', '3.3'] + ruby: ['3.2', '3.3'] gemfile: - rails_6_1 - rails_7 From 190d50e09914d10119f79407f4c9b247607c44b8 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Wed, 2 Oct 2024 10:21:17 -0500 Subject: [PATCH 19/21] Remove OpenStruct --- test/pay/lemon_squeezy/webhooks_test.rb | 2 +- .../webhooks/subscription_cancelled_test.rb | 10 +++++----- .../webhooks/subscription_created_test.rb | 2 +- .../webhooks/subscription_payment_refunded_test.rb | 2 +- .../webhooks/subscription_payment_succeeded_test.rb | 2 +- .../webhooks/subscription_updated_test.rb | 2 +- test/pay/payment_test.rb | 2 +- .../stripe/webhooks/checkout_session_completed_test.rb | 2 +- test/pay/stripe/webhooks/customer_updated_test.rb | 4 ++-- .../pay/stripe/webhooks/payment_method_updated_test.rb | 4 ++-- test/test_helper.rb | 4 ++-- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/pay/lemon_squeezy/webhooks_test.rb b/test/pay/lemon_squeezy/webhooks_test.rb index 681e9e8f..1f791aa1 100644 --- a/test/pay/lemon_squeezy/webhooks_test.rb +++ b/test/pay/lemon_squeezy/webhooks_test.rb @@ -8,7 +8,7 @@ class Pay::LemonSqueezy::WebhooksTest < ActiveSupport::TestCase user = users(:none) user.set_payment_processor :lemon_squeezy, processor_id: event.customer_id - ::LemonSqueezy::Subscription.expects(:list).returns(OpenStruct.new({data: []})) + ::LemonSqueezy::Subscription.expects(:list).returns(ActiveSupport::InheritableOptions.new({data: []})) assert_difference "Pay::Charge.count" do Pay::LemonSqueezy::Webhooks::Order.new.call(event) diff --git a/test/pay/paddle_classic/webhooks/subscription_cancelled_test.rb b/test/pay/paddle_classic/webhooks/subscription_cancelled_test.rb index b77e24ae..bbc4c8ce 100644 --- a/test/pay/paddle_classic/webhooks/subscription_cancelled_test.rb +++ b/test/pay/paddle_classic/webhooks/subscription_cancelled_test.rb @@ -2,17 +2,17 @@ class Pay::PaddleClassic::Webhooks::SubscriptionCancelledTest < ActiveSupport::TestCase setup do - @data = OpenStruct.new json_fixture("paddle_classic/subscription_cancelled") + @data = paddle_classic_event("subscription_cancelled") @pay_customer = pay_customers(:paddle_classic) @pay_customer.update(processor_id: @data.user_id) end test "it sets ends_at on the subscription" do - @pay_customer.subscription.update!(processor_id: @data["subscription_id"]) + @pay_customer.subscription.update!(processor_id: @data.subscription_id) Pay::Subscription.any_instance.expects(:update!).with( status: :canceled, trial_ends_at: nil, - ends_at: Time.zone.parse(@data["cancellation_effective_date"]) + ends_at: Time.zone.parse(@data.cancellation_effective_date) ) Pay::PaddleClassic::Webhooks::SubscriptionCancelled.new.call(@data) end @@ -22,7 +22,7 @@ class Pay::PaddleClassic::Webhooks::SubscriptionCancelledTest < ActiveSupport::T @data = paddle_classic_event("subscription_cancelled", overrides: { cancellation_effective_date: 1.month.from_now.to_formatted_s(:db) }) - @pay_customer.subscription.update!(processor_id: @data["subscription_id"]) + @pay_customer.subscription.update!(processor_id: @data.subscription_id) Pay::Subscription.any_instance.expects(:update!).with( status: :active, trial_ends_at: nil, @@ -32,7 +32,7 @@ class Pay::PaddleClassic::Webhooks::SubscriptionCancelledTest < ActiveSupport::T end test "it sets trial_ends_at on subscription with trial" do - @pay_customer.subscription.update!(processor_id: @data["subscription_id"], trial_ends_at: 1.month.ago) + @pay_customer.subscription.update!(processor_id: @data.subscription_id, trial_ends_at: 1.month.ago) Pay::Subscription.any_instance.expects(:update!).with( status: :canceled, trial_ends_at: Time.zone.parse(@data["cancellation_effective_date"]), diff --git a/test/pay/paddle_classic/webhooks/subscription_created_test.rb b/test/pay/paddle_classic/webhooks/subscription_created_test.rb index 455892ec..b90da069 100644 --- a/test/pay/paddle_classic/webhooks/subscription_created_test.rb +++ b/test/pay/paddle_classic/webhooks/subscription_created_test.rb @@ -2,7 +2,7 @@ class Pay::PaddleClassic::Webhooks::SubscriptionCreatedTest < ActiveSupport::TestCase setup do - @data = OpenStruct.new json_fixture("paddle_classic/subscription_created") + @data = paddle_classic_event("subscription_created") @user = users(:paddle_classic) end diff --git a/test/pay/paddle_classic/webhooks/subscription_payment_refunded_test.rb b/test/pay/paddle_classic/webhooks/subscription_payment_refunded_test.rb index 6fd445d1..9d0ac7c2 100644 --- a/test/pay/paddle_classic/webhooks/subscription_payment_refunded_test.rb +++ b/test/pay/paddle_classic/webhooks/subscription_payment_refunded_test.rb @@ -2,7 +2,7 @@ class Pay::PaddleClassic::Webhooks::SubscriptionPaymentRefundedTest < ActiveSupport::TestCase setup do - @data = OpenStruct.new json_fixture("paddle_classic/subscription_payment_refunded") + @data = paddle_classic_event("subscription_payment_refunded") @pay_customer = pay_customers(:paddle_classic) @pay_customer.update(processor_id: @data.user_id) end diff --git a/test/pay/paddle_classic/webhooks/subscription_payment_succeeded_test.rb b/test/pay/paddle_classic/webhooks/subscription_payment_succeeded_test.rb index dbc3aa51..a63bd690 100644 --- a/test/pay/paddle_classic/webhooks/subscription_payment_succeeded_test.rb +++ b/test/pay/paddle_classic/webhooks/subscription_payment_succeeded_test.rb @@ -2,7 +2,7 @@ class Pay::PaddleClassic::Webhooks::SubscriptionPaymentSucceededTest < ActiveSupport::TestCase setup do - @data = OpenStruct.new json_fixture("paddle_classic/subscription_payment_succeeded") + @data = paddle_classic_event("subscription_payment_succeeded") @pay_customer = pay_customers(:paddle_classic) @pay_customer.update(processor_id: @data.user_id) end diff --git a/test/pay/paddle_classic/webhooks/subscription_updated_test.rb b/test/pay/paddle_classic/webhooks/subscription_updated_test.rb index a9f27185..203347ce 100644 --- a/test/pay/paddle_classic/webhooks/subscription_updated_test.rb +++ b/test/pay/paddle_classic/webhooks/subscription_updated_test.rb @@ -2,7 +2,7 @@ class Pay::PaddleClassic::Webhooks::SubscriptionUpdatedTest < ActiveSupport::TestCase setup do - @data = OpenStruct.new json_fixture("paddle_classic/subscription_updated") + @data = paddle_classic_event("subscription_updated") @pay_customer = pay_customers(:paddle_classic) @pay_customer.update(processor_id: @data.user_id) @pay_customer.subscription.update(processor_id: @data.subscription_id) diff --git a/test/pay/payment_test.rb b/test/pay/payment_test.rb index 9ebd113c..d6a6c119 100644 --- a/test/pay/payment_test.rb +++ b/test/pay/payment_test.rb @@ -2,7 +2,7 @@ class Pay::Payment::Test < ActiveSupport::TestCase test "amount_with_currency" do - fake_payment_intent = OpenStruct.new(amount: 12_34, currency: "usd") + fake_payment_intent = ActiveSupport::InheritableOptions.new(amount: 12_34, currency: "usd") assert_equal "$12.34", Pay::Payment.new(fake_payment_intent).amount_with_currency end end diff --git a/test/pay/stripe/webhooks/checkout_session_completed_test.rb b/test/pay/stripe/webhooks/checkout_session_completed_test.rb index 4e3c5847..f8b653e9 100644 --- a/test/pay/stripe/webhooks/checkout_session_completed_test.rb +++ b/test/pay/stripe/webhooks/checkout_session_completed_test.rb @@ -20,7 +20,7 @@ class Pay::Stripe::Webhooks::CheckoutSessionCompletedTest < ActiveSupport::TestC test "checkout session completed syncs latest charge" do event = stripe_event("checkout.session.completed", overrides: {"object" => {"payment_intent" => "pi_1234", "latest_charge" => "ch_1234", "subscription" => nil}}) - ::Stripe::PaymentIntent.expects(:retrieve).returns(OpenStruct.new(id: "pi_1234", latest_charge: OpenStruct.new(id: "ch_1234"))) + ::Stripe::PaymentIntent.expects(:retrieve).returns(::Stripe::PaymentIntent.construct_from(id: "pi_1234", latest_charge: ::Stripe::Charge.construct_from(id: "ch_1234"))) Pay::Stripe::Charge.expects(:sync) assert_no_difference "Pay::Customer.count" do Pay::Stripe::Webhooks::CheckoutSessionCompleted.new.call(event) diff --git a/test/pay/stripe/webhooks/customer_updated_test.rb b/test/pay/stripe/webhooks/customer_updated_test.rb index eb1a7993..c90fffbd 100644 --- a/test/pay/stripe/webhooks/customer_updated_test.rb +++ b/test/pay/stripe/webhooks/customer_updated_test.rb @@ -7,7 +7,7 @@ class Pay::Stripe::Webhooks::CustomerUpdatedTest < ActiveSupport::TestCase test "removes default payment method if default payment method set to null" do event = stripe_event("customer.updated") - Pay::Stripe::Customer.any_instance.expects(:api_record).returns(OpenStruct.new(invoice_settings: OpenStruct.new(default_payment_method: nil))) + Pay::Stripe::Customer.any_instance.expects(:api_record).returns(::Stripe::Customer.construct_from(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: ActiveSupport::InheritableOptions.new(default_payment_method: nil), currency: "usd")) assert_not_nil @pay_customer.default_payment_method Pay::Stripe::Webhooks::CustomerUpdated.new.call(event) @pay_customer.reload @@ -22,7 +22,7 @@ class Pay::Stripe::Webhooks::CustomerUpdatedTest < ActiveSupport::TestCase test "stripe invoice credit balance is updated" do event = stripe_event("customer.updated") - Pay::Stripe::Customer.any_instance.expects(:api_record).returns(ActiveSupport::InheritableOptions.new(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: OpenStruct.new(default_payment_method: nil), currency: "usd")) + Pay::Stripe::Customer.any_instance.expects(:api_record).returns(::Stripe::Customer.construct_from(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: ActiveSupport::InheritableOptions.new(default_payment_method: nil), currency: "usd")) Pay::Stripe::Webhooks::CustomerUpdated.new.call(event) @pay_customer.reload assert_equal "usd", @pay_customer.currency diff --git a/test/pay/stripe/webhooks/payment_method_updated_test.rb b/test/pay/stripe/webhooks/payment_method_updated_test.rb index 52a95144..25544b21 100644 --- a/test/pay/stripe/webhooks/payment_method_updated_test.rb +++ b/test/pay/stripe/webhooks/payment_method_updated_test.rb @@ -9,10 +9,10 @@ class Pay::Stripe::Webhooks::PaymentMethodUpdatedTest < ActiveSupport::TestCase payment_method = pay_payment_methods(:one) # Spoof Stripe PaymentMethod lookup - fake_payment_method = OpenStruct.new(id: payment_method.processor_id, customer: "cus_1234", type: "card", card: OpenStruct.new(brand: "Visa", last4: "4242", exp_month: "01", exp_year: "2034")) + fake_payment_method = ::Stripe::PaymentMethod.construct_from(id: payment_method.processor_id, customer: "cus_1234", type: "card", card: ActiveSupport::InheritableOptions.new(brand: "Visa", last4: "4242", exp_month: "01", exp_year: "2034")) ::Stripe::PaymentMethod.expects(:retrieve).returns(fake_payment_method) - fake_customer = OpenStruct.new(invoice_settings: OpenStruct.new(default_payment_method: nil)) + fake_customer = ::Stripe::Customer.construct_from(invoice_settings: ActiveSupport::InheritableOptions.new(default_payment_method: nil)) ::Stripe::Customer.expects(:retrieve).returns(fake_customer) assert_equal payment_method.exp_year, payment_method.exp_year diff --git a/test/test_helper.rb b/test/test_helper.rb index e0922163..be8795bf 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -68,11 +68,11 @@ def braintree_event(name) end def paddle_billing_event(name) - OpenStruct.new json_fixture("paddle_billing/#{name}") + ActiveSupport::InheritableOptions.new json_fixture("paddle_billing/#{name}").deep_symbolize_keys end def paddle_classic_event(name, overrides: {}) - OpenStruct.new json_fixture("paddle_classic/#{name}").deep_merge(overrides) + ActiveSupport::InheritableOptions.new json_fixture("paddle_classic/#{name}").deep_merge(overrides).deep_symbolize_keys end def stripe_event(name, overrides: {}) From c7025a0aed2455bba6953c37cde8e2a5972a696e Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Wed, 2 Oct 2024 10:28:03 -0500 Subject: [PATCH 20/21] Use Stripe Util to create objects --- test/pay/stripe/webhooks/customer_updated_test.rb | 4 ++-- test/pay/stripe/webhooks/payment_method_updated_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pay/stripe/webhooks/customer_updated_test.rb b/test/pay/stripe/webhooks/customer_updated_test.rb index c90fffbd..88aa713b 100644 --- a/test/pay/stripe/webhooks/customer_updated_test.rb +++ b/test/pay/stripe/webhooks/customer_updated_test.rb @@ -7,7 +7,7 @@ class Pay::Stripe::Webhooks::CustomerUpdatedTest < ActiveSupport::TestCase test "removes default payment method if default payment method set to null" do event = stripe_event("customer.updated") - Pay::Stripe::Customer.any_instance.expects(:api_record).returns(::Stripe::Customer.construct_from(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: ActiveSupport::InheritableOptions.new(default_payment_method: nil), currency: "usd")) + Pay::Stripe::Customer.any_instance.expects(:api_record).returns(::Stripe::Customer.construct_from(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: Stripe::Util.convert_to_stripe_object({default_payment_method: nil}), currency: "usd")) assert_not_nil @pay_customer.default_payment_method Pay::Stripe::Webhooks::CustomerUpdated.new.call(event) @pay_customer.reload @@ -22,7 +22,7 @@ class Pay::Stripe::Webhooks::CustomerUpdatedTest < ActiveSupport::TestCase test "stripe invoice credit balance is updated" do event = stripe_event("customer.updated") - Pay::Stripe::Customer.any_instance.expects(:api_record).returns(::Stripe::Customer.construct_from(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: ActiveSupport::InheritableOptions.new(default_payment_method: nil), currency: "usd")) + Pay::Stripe::Customer.any_instance.expects(:api_record).returns(::Stripe::Customer.construct_from(invoice_credit_balance: Stripe::Util.convert_to_stripe_object({usd: 12345}), invoice_settings: Stripe::Util.convert_to_stripe_object({default_payment_method: nil}), currency: "usd")) Pay::Stripe::Webhooks::CustomerUpdated.new.call(event) @pay_customer.reload assert_equal "usd", @pay_customer.currency diff --git a/test/pay/stripe/webhooks/payment_method_updated_test.rb b/test/pay/stripe/webhooks/payment_method_updated_test.rb index 25544b21..3cd4d3f2 100644 --- a/test/pay/stripe/webhooks/payment_method_updated_test.rb +++ b/test/pay/stripe/webhooks/payment_method_updated_test.rb @@ -9,10 +9,10 @@ class Pay::Stripe::Webhooks::PaymentMethodUpdatedTest < ActiveSupport::TestCase payment_method = pay_payment_methods(:one) # Spoof Stripe PaymentMethod lookup - fake_payment_method = ::Stripe::PaymentMethod.construct_from(id: payment_method.processor_id, customer: "cus_1234", type: "card", card: ActiveSupport::InheritableOptions.new(brand: "Visa", last4: "4242", exp_month: "01", exp_year: "2034")) + fake_payment_method = ::Stripe::PaymentMethod.construct_from(id: payment_method.processor_id, customer: "cus_1234", type: "card", card: Stripe::Util.convert_to_stripe_object({brand: "Visa", last4: "4242", exp_month: "01", exp_year: "2034"})) ::Stripe::PaymentMethod.expects(:retrieve).returns(fake_payment_method) - fake_customer = ::Stripe::Customer.construct_from(invoice_settings: ActiveSupport::InheritableOptions.new(default_payment_method: nil)) + fake_customer = ::Stripe::Customer.construct_from(invoice_settings: Stripe::Util.convert_to_stripe_object({default_payment_method: nil})) ::Stripe::Customer.expects(:retrieve).returns(fake_customer) assert_equal payment_method.exp_year, payment_method.exp_year From b604d0548874da64d5eb5d5ecff46f63a9751ae5 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Wed, 2 Oct 2024 10:32:18 -0500 Subject: [PATCH 21/21] Version bump --- CHANGELOG.md | 5 +++++ Gemfile.lock | 2 +- gemfiles/rails_6_1.gemfile.lock | 2 +- gemfiles/rails_7.gemfile.lock | 2 +- gemfiles/rails_7_1.gemfile.lock | 2 +- gemfiles/rails_7_2.gemfile.lock | 2 +- gemfiles/rails_main.gemfile.lock | 2 +- lib/pay/version.rb | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a10468..3748d15f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ### Unreleased +### 8.1.0 + +* Stripe v13 +* Remove OpenStruct dependency + ### 8.0.0 * [Breaking] Remove `pay_customer.payment_method_token` virtual attribute. Use `@pay_customer.update_payment_method(token)` instead. diff --git a/Gemfile.lock b/Gemfile.lock index 088cabad..d3f38345 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,7 +10,7 @@ GIT PATH remote: . specs: - pay (8.0.0) + pay (8.1.0) rails (>= 6.0.0) GEM diff --git a/gemfiles/rails_6_1.gemfile.lock b/gemfiles/rails_6_1.gemfile.lock index 84814daa..7487ecb4 100644 --- a/gemfiles/rails_6_1.gemfile.lock +++ b/gemfiles/rails_6_1.gemfile.lock @@ -10,7 +10,7 @@ GIT PATH remote: .. specs: - pay (8.0.0) + pay (8.1.0) rails (>= 6.0.0) GEM diff --git a/gemfiles/rails_7.gemfile.lock b/gemfiles/rails_7.gemfile.lock index 1ac618b2..684371b4 100644 --- a/gemfiles/rails_7.gemfile.lock +++ b/gemfiles/rails_7.gemfile.lock @@ -10,7 +10,7 @@ GIT PATH remote: .. specs: - pay (8.0.0) + pay (8.1.0) rails (>= 6.0.0) GEM diff --git a/gemfiles/rails_7_1.gemfile.lock b/gemfiles/rails_7_1.gemfile.lock index 17a68352..9f4bcee2 100644 --- a/gemfiles/rails_7_1.gemfile.lock +++ b/gemfiles/rails_7_1.gemfile.lock @@ -10,7 +10,7 @@ GIT PATH remote: .. specs: - pay (8.0.0) + pay (8.1.0) rails (>= 6.0.0) GEM diff --git a/gemfiles/rails_7_2.gemfile.lock b/gemfiles/rails_7_2.gemfile.lock index d1315568..c0c91a0e 100644 --- a/gemfiles/rails_7_2.gemfile.lock +++ b/gemfiles/rails_7_2.gemfile.lock @@ -10,7 +10,7 @@ GIT PATH remote: .. specs: - pay (8.0.0) + pay (8.1.0) rails (>= 6.0.0) GEM diff --git a/gemfiles/rails_main.gemfile.lock b/gemfiles/rails_main.gemfile.lock index 5d585822..e515d931 100644 --- a/gemfiles/rails_main.gemfile.lock +++ b/gemfiles/rails_main.gemfile.lock @@ -109,7 +109,7 @@ GIT PATH remote: .. specs: - pay (8.0.0) + pay (8.1.0) rails (>= 6.0.0) GEM diff --git a/lib/pay/version.rb b/lib/pay/version.rb index 229e904a..ef5fc7f0 100644 --- a/lib/pay/version.rb +++ b/lib/pay/version.rb @@ -1,3 +1,3 @@ module Pay - VERSION = "8.0.0" + VERSION = "8.1.0" end