@porulle/adapter-woocommerce 0.74.1 → 0.74.2
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.
- package/dist/index.js +1 -1
- package/dist/orders.js +4 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -1
- package/src/orders.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/adapter-woocommerce",
|
|
3
|
-
"version": "0.74.
|
|
3
|
+
"version": "0.74.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"zod": "^4.1.11",
|
|
19
|
-
"@porulle/core": "0.74.
|
|
19
|
+
"@porulle/core": "0.74.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^24.5.2",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"vitest": "^3.2.4",
|
|
26
26
|
"esbuild": "0.25.12",
|
|
27
27
|
"miniflare": "4.20260722.1",
|
|
28
|
-
"@porulle/
|
|
29
|
-
"@porulle/
|
|
28
|
+
"@porulle/eslint-config": "0.1.0",
|
|
29
|
+
"@porulle/typescript-config": "0.1.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function wooConnector(options: WooConnectorOptions = {}): ChannelConnecto
|
|
|
60
60
|
async probeStore(input) {
|
|
61
61
|
const storeDomain = normalizeStoreDomain(input, { allowPrivateHosts: transport.allowPrivateHosts });
|
|
62
62
|
if (!storeDomain) {
|
|
63
|
-
const why =
|
|
63
|
+
const why = refusedStoreUrl(input);
|
|
64
64
|
return refused(why === "http" ? "WOO_STORE_NOT_HTTPS" : "WOO_INVALID_STORE_DOMAIN", why === "http"
|
|
65
65
|
? "Your store must be served over https (with a valid certificate) to connect."
|
|
66
66
|
: why === "private_host" ? "That address is not a public website." : `"${input}" is not a store address. Enter it like https://shop.example.com.`);
|
package/src/orders.ts
CHANGED
|
@@ -156,9 +156,10 @@ export async function pushOrder(client: WooClient, slice: ChannelOrderSlice, opt
|
|
|
156
156
|
const draftId = draft && typeof draft === "object" && "new_draft_order_id" in draft ? z.coerce.number().int().positive().safeParse(draft.new_draft_order_id) : undefined;
|
|
157
157
|
// A refusal can leave a checkout-draft behind; it is ours, so it goes.
|
|
158
158
|
if (draftId?.success) await client.send("DELETE", `/wc/v3/orders/${draftId.data}`, undefined, z.unknown(), { force: "true" });
|
|
159
|
-
// A 4xx is the store's answer. Anything else
|
|
160
|
-
// order: retriable, and the next
|
|
161
|
-
|
|
159
|
+
// A 4xx WooCommerce explained (its JSON error) is the store's answer. Anything else — a timeout,
|
|
160
|
+
// a 5xx, a firewall's page — may or may not have created the order: retriable, and the next
|
|
161
|
+
// attempt looks for it before creating anything.
|
|
162
|
+
const answered = error.status !== undefined && error.status >= 400 && error.status < 500 && error.body !== undefined;
|
|
162
163
|
return Err({ code: answered ? "WOO_ORDER_REJECTED" : error.code, message: answered ? `WooCommerce refused the order: ${error.message}` : `The store's answer to the order was lost (${error.message}); it is looked for before trying again.`, retriable: !answered });
|
|
163
164
|
}
|
|
164
165
|
const order = created.value;
|