@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/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ export function wooConnector(options = {}) {
|
|
|
38
38
|
async probeStore(input) {
|
|
39
39
|
const storeDomain = normalizeStoreDomain(input, { allowPrivateHosts: transport.allowPrivateHosts });
|
|
40
40
|
if (!storeDomain) {
|
|
41
|
-
const why =
|
|
41
|
+
const why = refusedStoreUrl(input);
|
|
42
42
|
return refused(why === "http" ? "WOO_STORE_NOT_HTTPS" : "WOO_INVALID_STORE_DOMAIN", why === "http"
|
|
43
43
|
? "Your store must be served over https (with a valid certificate) to connect."
|
|
44
44
|
: why === "private_host" ? "That address is not a public website." : `"${input}" is not a store address. Enter it like https://shop.example.com.`);
|
package/dist/orders.js
CHANGED
|
@@ -142,9 +142,10 @@ export async function pushOrder(client, slice, options) {
|
|
|
142
142
|
// A refusal can leave a checkout-draft behind; it is ours, so it goes.
|
|
143
143
|
if (draftId?.success)
|
|
144
144
|
await client.send("DELETE", `/wc/v3/orders/${draftId.data}`, undefined, z.unknown(), { force: "true" });
|
|
145
|
-
// A 4xx is the store's answer. Anything else
|
|
146
|
-
// order: retriable, and the next
|
|
147
|
-
|
|
145
|
+
// A 4xx WooCommerce explained (its JSON error) is the store's answer. Anything else — a timeout,
|
|
146
|
+
// a 5xx, a firewall's page — may or may not have created the order: retriable, and the next
|
|
147
|
+
// attempt looks for it before creating anything.
|
|
148
|
+
const answered = error.status !== undefined && error.status >= 400 && error.status < 500 && error.body !== undefined;
|
|
148
149
|
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 });
|
|
149
150
|
}
|
|
150
151
|
const order = created.value;
|