portage-ucp 0.7.1 → 0.8.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: 826f590ea83ab80febf6e461f60d1eb580d7ebf460a419bafb81d0f713525e81
4
- data.tar.gz: eb98a54978daf0904de0121101e98e597a67cd38dabd7440dd3813449b384635
3
+ metadata.gz: 411d3c147d477882ffab11e8679a8c188735faaf34cf764feab94e0b209d14cf
4
+ data.tar.gz: 9687a224d4cce5c79a6c501e4583d0adab98283aaa166027d91eb79213f04831
5
5
  SHA512:
6
- metadata.gz: fcb26f95ac6d46b622f3495b945f76549d4c7525c25fbe0552c3485659395e35e1e0330fe212052f253ba79680d498e9de0b179d91c9bee17a4f2796ec33c50c
7
- data.tar.gz: 4726bf3de6e45993612ea7a2c4bfd57ef418ad1a7c1d1a17efdffa90d20991df0fe9f623548f81065383b31aa99fd7210c2512d7994f6521a4bb6cfcfc494c1c
6
+ metadata.gz: ee057628093a5cca7d1240fbf1a0d2ac9982563f86a080536fe2d3f42e17476809415622c8e8f670125e131ba17bd7f54d7c8320f9d5c33531c99942f7240785
7
+ data.tar.gz: 74db4f514c5c9d3d3f57e8537ada8a1dddb51d29f912bfb5682c7ff22c244d6055459bade3483472ddb31c3cadbb8aae97c46c88d1800b9dcae122d3a7045643
data/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ All notable changes to this project are documented here. Format loosely follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.0.0/); this project is
5
5
  pre-1.0, so APIs may still shift between minor versions.
6
6
 
7
+ ## [0.8.1] - 2026-09-22
8
+
9
+ - `Resolver`'s WooCommerce platform entry threads `payment_method`/
10
+ `billing_address` from `WOOCOMMERCE_PAYMENT_METHOD`/`WOOCOMMERCE_BILLING_ADDRESS`
11
+ through to `Adapter.new`. It previously built the client and adapter
12
+ without either, so `complete_checkout` failed with no gateway or address
13
+ configured even when both env vars were set — the resolver's `env:` map
14
+ simply never named them.
15
+
16
+ ## [0.8.0] - 2026-09-17
17
+
18
+ - **Breaking:** `Manifest#to_h` now emits the shape live UCP stores actually
19
+ serve (confirmed against Shopify's `2026-08-25` rollout) instead of the
20
+ flat one this gem invented: everything nests under a top-level `ucp`
21
+ object, `ucp_version` becomes `version`, and `capabilities` is keyed by
22
+ capability name (`{"dev.ucp.shopping.catalog" => [{version: ...}]}`)
23
+ rather than an array of `{name:, version:}` hashes. When a signer is
24
+ configured the signature still covers the manifest body and rides inside
25
+ the `ucp` object. Anything reading a Portage-served manifest by the old
26
+ top-level keys needs updating — `Rack::ManifestEndpoint`'s own
27
+ advertised-payment check and `skills/serve-via-ucp`'s `verify.sh` both
28
+ did, and are fixed here.
29
+
7
30
  ## [0.7.1] - 2026-09-16
8
31
 
9
32
  - No behavior change — 0.7.0 was built and pushed with `gem build` run from
@@ -31,24 +31,31 @@ module Portage
31
31
  @services = services
32
32
  end
33
33
 
34
+ # Nests everything under a "ucp" envelope, and keys `capabilities` by
35
+ # capability name (matching what live Shopify UCP rollouts — Casper,
36
+ # Allbirds, Glossier, and 34+ others — actually serve as of manifest
37
+ # "version": "2026-08-25"; see docs/well-known-ucp.md and
38
+ # portage-ucp-client's Client.discover, which this shape now matches).
34
39
  def to_h
35
- payload = {
36
- ucp_version: UCP_VERSION,
40
+ ucp = {
41
+ version: UCP_VERSION,
37
42
  business: @business,
38
43
  services: @services,
39
- capabilities: @registry.advertised(@adapter).map do |capability|
40
- { name: capability.name, version: capability.version }
41
- end,
44
+ capabilities: capability_hash,
42
45
  payment_handlers: @payment_handlers,
43
46
  signing_keys: @signing_keys
44
47
  }
45
- return payload unless @signer
48
+ ucp = ucp.merge(signature: sign(ucp)) if @signer
46
49
 
47
- payload.merge(signature: sign(payload))
50
+ { ucp: ucp }
48
51
  end
49
52
 
50
53
  private
51
54
 
55
+ def capability_hash
56
+ @registry.advertised(@adapter).to_h { |capability| [capability.name, [{ version: capability.version }]] }
57
+ end
58
+
52
59
  def sign(payload)
53
60
  canonical = JSON.generate(payload)
54
61
  { kid: @signer.kid, value: Base64.strict_encode64(@signer.sign(canonical)) }
@@ -32,7 +32,7 @@ module Portage
32
32
  def payment_handlers_over_plaintext?(payload, request)
33
33
  return false if @allow_insecure || request.ssl?
34
34
 
35
- !Array(payload[:payment_handlers]).empty?
35
+ !Array(payload.dig(:ucp, :payment_handlers)).empty?
36
36
  end
37
37
 
38
38
  def not_found
@@ -1,3 +1,5 @@
1
+ require "json"
2
+
1
3
  module Portage
2
4
  module Ucp
3
5
  # Shared platform-detection + adapter-building logic for anything that
@@ -39,14 +41,17 @@ module Portage
39
41
  namespace: "WooCommerce",
40
42
  markers: [/woocommerce/i, %r{wp-content/plugins/woocommerce}i],
41
43
  env: { site_url: "WOOCOMMERCE_SITE_URL", consumer_key: "WOOCOMMERCE_CONSUMER_KEY",
42
- consumer_secret: "WOOCOMMERCE_CONSUMER_SECRET", currency: "WOOCOMMERCE_CURRENCY" },
44
+ consumer_secret: "WOOCOMMERCE_CONSUMER_SECRET", currency: "WOOCOMMERCE_CURRENCY",
45
+ payment_method: "WOOCOMMERCE_PAYMENT_METHOD", billing_address: "WOOCOMMERCE_BILLING_ADDRESS" },
43
46
  required: %i[site_url consumer_key consumer_secret],
44
47
  build_client: lambda { |ns, env|
45
48
  ns::Client.new(site_url: env.fetch(:site_url), consumer_key: env.fetch(:consumer_key),
46
49
  consumer_secret: env.fetch(:consumer_secret))
47
50
  },
48
51
  build_adapter: lambda { |ns, client, env|
49
- ns::Adapter.new(client: client, site_url: env.fetch(:site_url), currency: env.fetch(:currency, "USD"))
52
+ ns::Adapter.new(client: client, site_url: env.fetch(:site_url), currency: env.fetch(:currency, "USD"),
53
+ payment_method: env[:payment_method],
54
+ billing_address: env[:billing_address] && JSON.parse(env[:billing_address]))
50
55
  }
51
56
  ),
52
57
  Platform.new(
@@ -1,5 +1,5 @@
1
1
  module Portage
2
2
  module Ucp
3
- VERSION = "0.7.1".freeze
3
+ VERSION = "0.8.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portage-ucp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.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-09-16 00:00:00.000000000 Z
11
+ date: 2026-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64