@porulle/adapter-shopify 0.88.0 → 0.89.0
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.d.ts +6 -0
- package/dist/index.js +2 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/index.ts +8 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export interface ShopifyConnectorOptions {
|
|
|
15
15
|
* code exercised by a test is the code that runs. There is no mock flag inside this adapter.
|
|
16
16
|
*/
|
|
17
17
|
shopOrigin?: (shopDomain: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Payment gateway name written on the `SALE` transaction in `orderCreate` (shown in Shopify's
|
|
20
|
+
* order timeline as "payment was processed on <name>" and on refunds). Defaults to `"porulle"`.
|
|
21
|
+
* Does not change `sourceName` or `sourceIdentifier`, which the duplicate guard looks orders up by.
|
|
22
|
+
*/
|
|
23
|
+
paymentGateway?: string;
|
|
18
24
|
}
|
|
19
25
|
export declare const INVENTORY_QUERY = "query PorulleInventoryPage($after: String) {\n productVariants(first: 250, after: $after, sortKey: ID) { pageInfo { hasNextPage endCursor } nodes { legacyResourceId inventoryQuantity } }\n}";
|
|
20
26
|
export declare const VARIANT_INVENTORY_QUERY = "query PorulleVariantInventory($ids: [ID!]!) {\n nodes(ids: $ids) { ... on ProductVariant { legacyResourceId inventoryQuantity } }\n}";
|
package/dist/index.js
CHANGED
|
@@ -197,6 +197,7 @@ function validBase64Hmac(secret, body, signature) {
|
|
|
197
197
|
const credentialsRequired = { code: "SHOPIFY_CREDENTIALS_REQUIRED", message: "The store holds no Shopify access token; it must be reconnected.", retriable: false };
|
|
198
198
|
export function shopifyConnector(options) {
|
|
199
199
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
200
|
+
const paymentGateway = options.paymentGateway?.trim() || SOURCE_NAME;
|
|
200
201
|
const origin = (shopDomain) => options.shopOrigin?.(shopDomain) ?? `https://${shopDomain}`;
|
|
201
202
|
const target = (store) => {
|
|
202
203
|
const credentials = parseShopifyCredentials(store.credentials);
|
|
@@ -354,7 +355,7 @@ export function shopifyConnector(options) {
|
|
|
354
355
|
...(slice.shipping ? { shippingLines: [{ title: slice.shipping.title, priceSet: money(slice.shipping.amount, slice.currency) }] } : {}),
|
|
355
356
|
// The shopper's discount as a fixed amount off the items, so the store's total is what was paid.
|
|
356
357
|
...(slice.discount ? { discountCode: { itemFixedDiscountCode: { code: slice.discount.code, amountSet: money(slice.discount.amount, slice.currency) } } } : {}),
|
|
357
|
-
transactions: [{ kind: "SALE", status: "SUCCESS", gateway:
|
|
358
|
+
transactions: [{ kind: "SALE", status: "SUCCESS", gateway: paymentGateway, amountSet: money(slice.grandTotal, slice.currency) }],
|
|
358
359
|
},
|
|
359
360
|
options: { inventoryBehaviour: "DECREMENT_OBEYING_POLICY", sendReceipt: false, sendFulfillmentReceipt: false },
|
|
360
361
|
}, orderCreateSchema);
|