portage-ucp-wix 0.2.0 → 0.2.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: 79452444be07103e4ebdba0dbeeff8c9630b4426517a5a6bc2ec8b8b59707ec4
4
- data.tar.gz: d9310f2080e2096246652049432fb8d438c417e49490cb9beb564d17a2280525
3
+ metadata.gz: e232026a38a73d2177d1d337dee00934ffcd58ef577465d24e4f8fd9cfe1ce70
4
+ data.tar.gz: 487492f801bcbc909bf3feb5c4fe65af467aa08e1df12d4ff65cdc047992c32f
5
5
  SHA512:
6
- metadata.gz: 995a049509e4cf8e8742d5bd3a57ee904baa020af7d2ab3dc527cd5afc56bed457805185142d0a8ae37dd14e25bb30a22e698d836c3282a5ba749029e2bee4dd
7
- data.tar.gz: 21eb08965eb0cf7d1bc191bafe8cf6bce832add7269c90f1d580919561fa79f79c79a91ee289a7b96e6358659d3c2b4b246ecd14fb2e4e50098ae1ab39771c79
6
+ metadata.gz: 81af4efe47521a00aeef3d612f4fda10ca293a5b0b60b094f23dcc9e7bfa604dde4938140ca8d77a35ed2a66b004ef2a3fdf8f9525133206633768d27c4e086b
7
+ data.tar.gz: f4cdbb3d878fa9a9fc78412e142fcae847112a23fb7811c918c06230bbdd527d86d196138e19d76231292d2b33d1e07712639bb4eadf892b9c1bb5b095b97fb0
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ pre-1.0, so APIs may still shift between minor versions.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.1] - 2026-10-07
10
+
11
+ - **Fixed: a checkout the shopper paid for in the browser now reads as `completed` from a new process.** Status lived only in the creating process, so `portage orders reconcile` always saw `incomplete`. `#get_checkout` now runs Search Orders filtered on `checkoutId` and `status: APPROVED` (Wix's paid, or zero-total/offline, state) and reports `completed` with the `order` confirmation when it finds one, rebuilding the checkout from that order if the checkout itself comes back empty. No order, or a failed search, keeps `incomplete`. Needs `portage-ucp` 0.13.0 for the `CheckoutState` platform hook, so the gem now requires `portage-ucp` `~> 0.13`. Patch-level.
12
+
9
13
  ## [0.2.0] - 2026-10-05
10
14
 
11
15
  - **Removed `Mapper.money`.** It was a one-line pass-through to `Support::Amounts.money` that nothing in the gem called. It is a public module function, so this is **breaking** for any caller using it directly; minor-level for a pre-1.0 gem.
@@ -39,8 +39,9 @@ module Portage
39
39
  # natively, so §9a dedup comes from Support::Idempotency's in-process
40
40
  # table.
41
41
  include Portage::Ucp::Support::Idempotency
42
- # Wix Checkout has no confirmed native status field, so status is
43
- # tracked adapter-side via Support::CheckoutState. Only the status
42
+ # Wix Checkout has no lifecycle status enum (only a `completed`
43
+ # flag), so status is tracked adapter-side via Support::CheckoutState,
44
+ # with #platform_checkout_order as its fallback. Only the status
44
45
  # half is used here: unlike Shopify and WooCommerce, a Wix Order
45
46
  # carries its originating `checkoutId` natively (see #get_order).
46
47
  include Portage::Ucp::Support::CheckoutState
@@ -107,7 +108,9 @@ module Portage
107
108
 
108
109
  def get_checkout(checkout_id:)
109
110
  node = fetch_checkout_node(checkout_id)
110
- node && Mapper.checkout(node, status: checkout_status(checkout_id))
111
+ return checkout_from_platform_order(checkout_id) unless node
112
+
113
+ Mapper.checkout(node, status: checkout_status(checkout_id), order: checkout_order(checkout_id))
111
114
  end
112
115
 
113
116
  # Full replacement, same rationale as #update_cart.
@@ -147,6 +150,22 @@ module Portage
147
150
 
148
151
  private
149
152
 
153
+ # Support::CheckoutState's platform hook. A Wix Checkout's own
154
+ # `completed` flag turns true once "an order was successfully created
155
+ # from this checkout" and paid for (unless the total is 0), and the
156
+ # Order carries `checkoutId`, a filterable Search Orders field
157
+ # (https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/search-orders).
158
+ # Searching for that order directly answers both "did it complete?"
159
+ # and "which order?" in one call. `status: APPROVED` is Wix's "online
160
+ # payment is received" (or zero-total/offline) state; Search Orders
161
+ # never returns INITIALIZED orders anyway, and PENDING/REJECTED/
162
+ # CANCELED stay out.
163
+ def platform_checkout_order(checkout_id)
164
+ body = { search: { filter: { checkoutId: checkout_id, status: "APPROVED" }, cursorPaging: { limit: 1 } } }
165
+ node = @client.post("/ecom/v1/orders/search", body).dig("orders", 0)
166
+ node && Mapper.order(node)
167
+ end
168
+
150
169
  def fetch_cart_node(cart_id)
151
170
  @client.get("/ecom/v1/carts/#{cart_id}")["cart"]
152
171
  end
@@ -1,7 +1,7 @@
1
1
  module Portage
2
2
  module Ucp
3
3
  module Wix
4
- VERSION = "0.2.0".freeze
4
+ VERSION = "0.2.1".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portage-ucp-wix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Whitbread
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-05 00:00:00.000000000 Z
11
+ date: 2026-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: portage-ucp
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.8'
19
+ version: '0.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.8'
26
+ version: '0.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement