spree-paypal_platform 5.1.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3002d47c7c53f6eb690a9dbd4717e47983e47083feac8a359369378c8435d24f
4
- data.tar.gz: 5b4e7e078632cd6dc4e7e2796edc696bc543c4cfd7360b3a721064fc2114b62e
3
+ metadata.gz: 963337c6ac7e3f41915fa04edad216c40f021ae69957c16c60a6d503596b9d5f
4
+ data.tar.gz: fab2c096c3f02d758cf1e90d1019e06184601fb74d9176ea0b52e8ce3a6f52ed
5
5
  SHA512:
6
- metadata.gz: 0c8a5d07fa468eb3a275844b667ac07be8c8d5dd5878518ceb649fe0743a977a3b7b00335cb6cb885bc2d90c0d86695bbbdf3cee9eb34d0303fe2eddaeb9901e
7
- data.tar.gz: a45636029c6e2888067299a8e9900f533ca6959eb79d005ca8e44187de359ca42af68d350ccbc39fa890bb285b179694479ca4812bbc795d9b3427fae6be68d8
6
+ metadata.gz: b003f28202908c38acf93ab895835bae013d893da184c451df9e2b3ca98ee70d8c8c8dcf4f7497abe1dc62cf00760414a607a036282d4af9675111ac8b73ba40
7
+ data.tar.gz: 605032f390401d9aaf2de1a33d54a6555ddb6b56c274c594836889a36eeb4bcd21d9299a4342398b7b012b53f812806bf73ac7710b24916a8b8d9de4dc82973c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## 5.1.1
6
+
7
+ One migration: create `spree_paypal_platform_orders`. Removed the leftover
8
+ checkout-table / STI rewrite / rename migrations from 5.1.0.
9
+
5
10
  ## 5.1.0
6
11
 
7
12
  Full internal rename to `Spree::PaypalPlatform`.
data/README.md CHANGED
@@ -70,26 +70,6 @@ https://<store>/api/v3/webhooks/payments/<prefixed-payment-method-id>
70
70
  `Spree::PaypalPlatform::PaymentSources::ApplePay`.
71
71
  4. Safari + HTTPS only.
72
72
 
73
- ## Coming from `spree_paypal_checkout`
74
-
75
- Existing `spree_payment_methods.type` rows may still store
76
- `SpreePaypalCheckout::Gateway` or `Spree::PaypalCheckout::Gateway`. The
77
- install generator copies a rewrite migration that updates those STI strings
78
- to `Spree::PaypalPlatform::Gateway` and renames
79
- `spree_paypal_checkout_orders` → `spree_paypal_platform_orders`.
80
-
81
- ```ruby
82
- # before
83
- gem 'spree_paypal_checkout', github: 'aypex-io/spree_paypal_checkout', branch: 'tongkat-fitness'
84
-
85
- # after
86
- gem 'spree-paypal_platform'
87
- ```
88
-
89
- Storefront `resolveGatewayId` should map `paypal_platform` /
90
- `Spree::PaypalPlatform::Gateway`. Keep the old `paypal_checkout` /
91
- `SpreePaypalCheckout::Gateway` keys until the STI rewrite has run.
92
-
93
73
  ## Developing
94
74
 
95
75
  ```bash
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateSpreePaypalCheckoutOrders < ActiveRecord::Migration[7.2]
3
+ class CreateSpreePaypalPlatformOrders < ActiveRecord::Migration[7.2]
4
4
  def change
5
- create_table :spree_paypal_checkout_orders do |t|
5
+ create_table :spree_paypal_platform_orders do |t|
6
6
  t.references :order, null: false
7
7
  t.references :payment_method, null: false
8
8
  t.string :paypal_id, null: false
@@ -17,6 +17,7 @@ class CreateSpreePaypalCheckoutOrders < ActiveRecord::Migration[7.2]
17
17
  t.timestamps
18
18
  end
19
19
 
20
- add_index :spree_paypal_checkout_orders, %i[order_id paypal_id], unique: true
20
+ add_index :spree_paypal_platform_orders, %i[order_id paypal_id], unique: true
21
+ add_index :spree_paypal_platform_orders, :paypal_id, unique: true
21
22
  end
22
23
  end
@@ -3,6 +3,6 @@
3
3
  module Spree
4
4
  module PaypalPlatform
5
5
  # Major version tracks Spree's major version: 5.x supports Spree 5.x.
6
- VERSION = '5.1.0'
6
+ VERSION = '5.1.1'
7
7
  end
8
8
  end
@@ -23,20 +23,10 @@ module Spree
23
23
  ##
24
24
  # STI type names that count as this gem's gateway.
25
25
  #
26
- # Includes historical strings from the official `spree_paypal_checkout`
27
- # gem and the short-lived `Spree::PaypalCheckout` name so existing
28
- # payment-method rows keep matching before the rewrite migration runs.
29
- #
30
26
  # @return [Array<String>]
31
27
  #
32
28
  def self.gateway_type_names
33
- (
34
- [
35
- Gateway.name,
36
- 'Spree::PaypalCheckout::Gateway',
37
- 'SpreePaypalCheckout::Gateway'
38
- ] + Gateway.descendants.map(&:name)
39
- ).uniq
29
+ ([Gateway.name] + Gateway.descendants.map(&:name)).uniq
40
30
  end
41
31
  end
42
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree-paypal_platform
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aypex
@@ -139,10 +139,7 @@ files:
139
139
  - app/views/spree/admin/payments/source_forms/_spree_paypal_platform.html.erb
140
140
  - app/views/spree/payment_sources/_paypal_platform.html.erb
141
141
  - config/initializers/spree.rb
142
- - db/migrate/20250528095719_create_spree_paypal_checkout_orders.rb
143
- - db/migrate/20260817120000_rewrite_spree_paypal_checkout_sti_types.rb
144
- - db/migrate/20260817130000_add_unique_index_on_paypal_checkout_order_paypal_id.rb
145
- - db/migrate/20260817140000_rename_paypal_checkout_orders_to_paypal_platform.rb
142
+ - db/migrate/20250528095719_create_spree_paypal_platform_orders.rb
146
143
  - lib/generators/spree/paypal_platform/install/install_generator.rb
147
144
  - lib/spree-paypal_platform.rb
148
145
  - lib/spree/paypal_platform.rb
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RewriteSpreePaypalCheckoutStiTypes < ActiveRecord::Migration[7.2]
4
- # Hosts coming from the official / forked `spree_paypal_platform` gem store
5
- # `SpreePaypalCheckout::Gateway` (and `…::PaymentSources::Paypal`) in STI
6
- # type columns. The new gem aliases those constants, so checkout keeps
7
- # working before this migration runs; rewriting the strings makes the
8
- # alias optional for the next deploy.
9
- LEGACY_TO_CURRENT = {
10
- 'SpreePaypalCheckout::Gateway' => 'Spree::PaypalPlatform::Gateway',
11
- 'SpreePaypalCheckout::PaymentSources::Paypal' => 'Spree::PaypalPlatform::PaymentSources::Paypal',
12
- 'SpreePaypalCheckout::Order' => 'Spree::PaypalPlatform::Order'
13
- }.freeze
14
-
15
- def up
16
- rewrite_column(:spree_payment_methods, :type)
17
- rewrite_column(:spree_payment_sources, :type) if column_exists?(:spree_payment_sources, :type)
18
- end
19
-
20
- def down
21
- rewrite_column(:spree_payment_methods, :type, LEGACY_TO_CURRENT.invert)
22
- rewrite_column(:spree_payment_sources, :type, LEGACY_TO_CURRENT.invert) if column_exists?(:spree_payment_sources, :type)
23
- end
24
-
25
- private
26
-
27
- def rewrite_column(table, column, mapping = LEGACY_TO_CURRENT)
28
- mapping.each do |from, to|
29
- reversible_update = "UPDATE #{table} SET #{column} = #{quote(to)} WHERE #{column} = #{quote(from)}"
30
- execute reversible_update
31
- end
32
- end
33
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddUniqueIndexOnPaypalCheckoutOrderPaypalId < ActiveRecord::Migration[7.2]
4
- def change
5
- add_index :spree_paypal_checkout_orders, :paypal_id, unique: true
6
- end
7
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RenamePaypalCheckoutOrdersToPaypalPlatform < ActiveRecord::Migration[7.2]
4
- LEGACY_TO_CURRENT = {
5
- 'SpreePaypalCheckout::Gateway' => 'Spree::PaypalPlatform::Gateway',
6
- 'SpreePaypalCheckout::PaymentSources::Paypal' => 'Spree::PaypalPlatform::PaymentSources::Paypal',
7
- 'SpreePaypalCheckout::Order' => 'Spree::PaypalPlatform::Order',
8
- 'Spree::PaypalCheckout::Gateway' => 'Spree::PaypalPlatform::Gateway',
9
- 'Spree::PaypalCheckout::PaymentSources::Paypal' => 'Spree::PaypalPlatform::PaymentSources::Paypal',
10
- 'Spree::PaypalCheckout::PaymentSources::ApplePay' => 'Spree::PaypalPlatform::PaymentSources::ApplePay',
11
- 'Spree::PaypalCheckout::PaymentSources::Card' => 'Spree::PaypalPlatform::PaymentSources::Card',
12
- 'Spree::PaypalCheckout::Order' => 'Spree::PaypalPlatform::Order'
13
- }.freeze
14
-
15
- def up
16
- if table_exists?(:spree_paypal_checkout_orders) && !table_exists?(:spree_paypal_platform_orders)
17
- rename_table :spree_paypal_checkout_orders, :spree_paypal_platform_orders
18
- end
19
-
20
- rewrite_column(:spree_payment_methods, :type)
21
- rewrite_column(:spree_payment_sources, :type) if column_exists?(:spree_payment_sources, :type)
22
- end
23
-
24
- def down
25
- if table_exists?(:spree_paypal_platform_orders) && !table_exists?(:spree_paypal_checkout_orders)
26
- rename_table :spree_paypal_platform_orders, :spree_paypal_checkout_orders
27
- end
28
-
29
- rewrite_column(:spree_payment_methods, :type, invert_mapping)
30
- rewrite_column(:spree_payment_sources, :type, invert_mapping) if column_exists?(:spree_payment_sources, :type)
31
- end
32
-
33
- private
34
-
35
- def invert_mapping
36
- {
37
- 'Spree::PaypalPlatform::Gateway' => 'SpreePaypalCheckout::Gateway',
38
- 'Spree::PaypalPlatform::PaymentSources::Paypal' => 'SpreePaypalCheckout::PaymentSources::Paypal',
39
- 'Spree::PaypalPlatform::Order' => 'SpreePaypalCheckout::Order'
40
- }
41
- end
42
-
43
- def rewrite_column(table, column, mapping = LEGACY_TO_CURRENT)
44
- mapping.each do |from, to|
45
- execute "UPDATE #{table} SET #{column} = #{quote(to)} WHERE #{column} = #{quote(from)}"
46
- end
47
- end
48
- end