@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porulle/adapter-shopify",
3
- "version": "0.88.0",
3
+ "version": "0.89.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "zod": "^4.6.7",
19
- "@porulle/core": "0.88.0"
19
+ "@porulle/core": "0.89.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^24.5.2",
package/src/index.ts CHANGED
@@ -43,6 +43,12 @@ export interface ShopifyConnectorOptions {
43
43
  * code exercised by a test is the code that runs. There is no mock flag inside this adapter.
44
44
  */
45
45
  shopOrigin?: (shopDomain: string) => string;
46
+ /**
47
+ * Payment gateway name written on the `SALE` transaction in `orderCreate` (shown in Shopify's
48
+ * order timeline as "payment was processed on <name>" and on refunds). Defaults to `"porulle"`.
49
+ * Does not change `sourceName` or `sourceIdentifier`, which the duplicate guard looks orders up by.
50
+ */
51
+ paymentGateway?: string;
46
52
  }
47
53
 
48
54
  export const INVENTORY_QUERY = `query PorulleInventoryPage($after: String) {
@@ -255,6 +261,7 @@ const credentialsRequired: ChannelConnectorError = { code: "SHOPIFY_CREDENTIALS_
255
261
 
256
262
  export function shopifyConnector(options: ShopifyConnectorOptions): ChannelConnector {
257
263
  const fetchImpl = options.fetchImpl ?? fetch;
264
+ const paymentGateway = options.paymentGateway?.trim() || SOURCE_NAME;
258
265
  const origin = (shopDomain: string): string => options.shopOrigin?.(shopDomain) ?? `https://${shopDomain}`;
259
266
  const target = (store: ChannelStore): ShopifyGraphqlTarget | undefined => {
260
267
  const credentials = parseShopifyCredentials(store.credentials);
@@ -397,7 +404,7 @@ export function shopifyConnector(options: ShopifyConnectorOptions): ChannelConne
397
404
  ...(slice.shipping ? { shippingLines: [{ title: slice.shipping.title, priceSet: money(slice.shipping.amount, slice.currency) }] } : {}),
398
405
  // The shopper's discount as a fixed amount off the items, so the store's total is what was paid.
399
406
  ...(slice.discount ? { discountCode: { itemFixedDiscountCode: { code: slice.discount.code, amountSet: money(slice.discount.amount, slice.currency) } } } : {}),
400
- transactions: [{ kind: "SALE", status: "SUCCESS", gateway: SOURCE_NAME, amountSet: money(slice.grandTotal, slice.currency) }],
407
+ transactions: [{ kind: "SALE", status: "SUCCESS", gateway: paymentGateway, amountSet: money(slice.grandTotal, slice.currency) }],
401
408
  },
402
409
  options: { inventoryBehaviour: "DECREMENT_OBEYING_POLICY", sendReceipt: false, sendFulfillmentReceipt: false },
403
410
  }, orderCreateSchema);