washday-sdk 1.6.67 → 1.6.69
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/api/order/post.js +1 -0
- package/package.json +1 -1
- package/src/api/order/post.ts +2 -0
- package/src/api/order/put.ts +2 -0
- package/test/orders.orderIdFallbackBody.test.ts +49 -0
- package/test/sdk.publishWorkflow.test.ts +27 -0
- package/.github/workflows/bump-version-pr.yml +0 -58
- package/.github/workflows/publish-on-merge.yml +0 -35
package/dist/api/order/post.js
CHANGED
|
@@ -136,6 +136,7 @@ export const payAndCollect = function (params) {
|
|
|
136
136
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
137
137
|
};
|
|
138
138
|
return yield this.axiosInstance.post(PAY_AND_COLLECT(params.sequence, params.storeId), {
|
|
139
|
+
orderId: params.orderId,
|
|
139
140
|
paymentMethod: params.paymentMethod,
|
|
140
141
|
cashierBoxId: params.cashierBoxId,
|
|
141
142
|
amount: params.amount,
|
package/package.json
CHANGED
package/src/api/order/post.ts
CHANGED
|
@@ -138,6 +138,7 @@ export const setOrderUncollected = async function (this: WashdayClientInstance,
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
export const payAndCollect = async function (this: WashdayClientInstance, params: {
|
|
141
|
+
orderId?: string;
|
|
141
142
|
sequence: string;
|
|
142
143
|
storeId: string;
|
|
143
144
|
paymentMethod: string;
|
|
@@ -156,6 +157,7 @@ export const payAndCollect = async function (this: WashdayClientInstance, params
|
|
|
156
157
|
return await this.axiosInstance.post(
|
|
157
158
|
PAY_AND_COLLECT(params.sequence, params.storeId),
|
|
158
159
|
{
|
|
160
|
+
orderId: params.orderId,
|
|
159
161
|
paymentMethod: params.paymentMethod,
|
|
160
162
|
cashierBoxId: params.cashierBoxId,
|
|
161
163
|
amount: params.amount,
|
package/src/api/order/put.ts
CHANGED
|
@@ -36,6 +36,7 @@ export const updatePaymentLineById = async function (this: WashdayClientInstance
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export const setOrderCancelledBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
39
|
+
orderId?: string,
|
|
39
40
|
cancelledDateTime: string
|
|
40
41
|
}): Promise<any> {
|
|
41
42
|
try {
|
|
@@ -82,6 +83,7 @@ export const setOrderCleanedBySequence = async function (this: WashdayClientInst
|
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
export const setOrderCollectedBySequence = async function (this: WashdayClientInstance, sequence: string, storeId: string, data: {
|
|
86
|
+
orderId?: string,
|
|
85
87
|
collectedDateTime: string;
|
|
86
88
|
collectWithAmountDue?: boolean,
|
|
87
89
|
pinUserId?: string
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { payAndCollect } from "../src/api/order/post";
|
|
2
|
+
import { setOrderCancelledBySequence } from "../src/api/order/put";
|
|
3
|
+
|
|
4
|
+
describe("orders orderId body fallback", () => {
|
|
5
|
+
it("sends orderId in payAndCollect body while keeping sequence/store route", async () => {
|
|
6
|
+
const post = jest.fn().mockResolvedValue({ data: { ok: true } });
|
|
7
|
+
const client = {
|
|
8
|
+
apiToken: "token-123",
|
|
9
|
+
axiosInstance: { post },
|
|
10
|
+
} as any;
|
|
11
|
+
|
|
12
|
+
await payAndCollect.call(client, {
|
|
13
|
+
orderId: "order-1",
|
|
14
|
+
sequence: "4",
|
|
15
|
+
storeId: "store-1",
|
|
16
|
+
paymentMethod: "card",
|
|
17
|
+
amount: 25,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(post).toHaveBeenCalledWith(
|
|
21
|
+
"/api/v2/order/4/store-1/pay-and-collect",
|
|
22
|
+
expect.objectContaining({ orderId: "order-1" }),
|
|
23
|
+
{
|
|
24
|
+
headers: { Authorization: "Bearer token-123" },
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("sends orderId in setOrderCancelledBySequence body", async () => {
|
|
30
|
+
const put = jest.fn().mockResolvedValue({ data: { data: true } });
|
|
31
|
+
const client = {
|
|
32
|
+
apiToken: "token-123",
|
|
33
|
+
axiosInstance: { put },
|
|
34
|
+
} as any;
|
|
35
|
+
|
|
36
|
+
await setOrderCancelledBySequence.call(client, "4", "store-1", {
|
|
37
|
+
orderId: "order-1",
|
|
38
|
+
cancelledDateTime: "2026-06-05T00:00:00.000Z",
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(put).toHaveBeenCalledWith(
|
|
42
|
+
"api/order/4/store-1/cancelled",
|
|
43
|
+
expect.objectContaining({ orderId: "order-1" }),
|
|
44
|
+
{
|
|
45
|
+
headers: { Authorization: "Bearer token-123" },
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
const repoRoot = path.resolve(__dirname, "../../..");
|
|
5
|
+
const workflowPath = path.join(repoRoot, ".github/workflows/sdk-publish.yml");
|
|
6
|
+
|
|
7
|
+
describe("sdk publish workflow", () => {
|
|
8
|
+
it("is manually runnable and bumps patch before publishing", () => {
|
|
9
|
+
expect(fs.existsSync(workflowPath)).toBe(true);
|
|
10
|
+
|
|
11
|
+
const workflow = fs.readFileSync(workflowPath, "utf8");
|
|
12
|
+
|
|
13
|
+
expect(workflow).toContain("workflow_dispatch:");
|
|
14
|
+
expect(workflow).not.toContain("push:");
|
|
15
|
+
expect(workflow).toContain("contents: write");
|
|
16
|
+
expect(workflow).toContain("id-token: write");
|
|
17
|
+
expect(workflow).toContain("working-directory: packages/sdk");
|
|
18
|
+
expect(workflow).toContain("registry-url: https://registry.npmjs.org");
|
|
19
|
+
expect(workflow).toContain('npm view "$PACKAGE_NAME@$CURRENT_VERSION" version');
|
|
20
|
+
expect(workflow).toContain("npm version patch --no-git-tag-version");
|
|
21
|
+
expect(workflow).toContain("git commit -m \"chore(sdk): bump patch version for publish\"");
|
|
22
|
+
expect(workflow).toContain("git push origin HEAD:main");
|
|
23
|
+
expect(workflow).toContain("npm publish --access public --no-provenance");
|
|
24
|
+
expect(workflow).not.toContain("NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}");
|
|
25
|
+
expect(workflow).not.toContain('NPM_CONFIG_PROVENANCE: "false"');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
name: Bump Version on PR
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened, synchronize, reopened]
|
|
6
|
-
branches:
|
|
7
|
-
- main
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: write
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
bump-version:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
if: github.event.pull_request.base.ref == 'main'
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout repository
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
with:
|
|
20
|
-
ref: ${{ github.head_ref }}
|
|
21
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
|
-
|
|
23
|
-
- name: Use Node.js 24
|
|
24
|
-
uses: actions/setup-node@v4
|
|
25
|
-
with:
|
|
26
|
-
node-version: 24
|
|
27
|
-
|
|
28
|
-
- name: Configure git identity
|
|
29
|
-
run: |
|
|
30
|
-
git config --global user.name "washday-bot"
|
|
31
|
-
git config --global user.email "ci@washday.dev"
|
|
32
|
-
|
|
33
|
-
- name: Fetch main branch
|
|
34
|
-
run: git fetch origin main:main
|
|
35
|
-
|
|
36
|
-
- name: Check if version already bumped
|
|
37
|
-
id: check_version
|
|
38
|
-
run: |
|
|
39
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
40
|
-
git show main:package.json > /tmp/main-package.json
|
|
41
|
-
MAIN_VERSION=$(node -p "require('/tmp/main-package.json').version")
|
|
42
|
-
echo "Current PR version: $CURRENT_VERSION"
|
|
43
|
-
echo "Main branch version: $MAIN_VERSION"
|
|
44
|
-
if [ "$CURRENT_VERSION" != "$MAIN_VERSION" ]; then
|
|
45
|
-
echo "already_bumped=true" >> $GITHUB_OUTPUT
|
|
46
|
-
echo "✅ Version already bumped in this PR"
|
|
47
|
-
else
|
|
48
|
-
echo "already_bumped=false" >> $GITHUB_OUTPUT
|
|
49
|
-
echo "⚠️ Version needs bumping"
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
- name: Bump version patch
|
|
53
|
-
if: steps.check_version.outputs.already_bumped == 'false'
|
|
54
|
-
run: |
|
|
55
|
-
npm version patch --no-git-tag-version
|
|
56
|
-
git add package.json package-lock.json
|
|
57
|
-
git commit -m "chore: bump version [skip ci]"
|
|
58
|
-
git push origin ${{ github.head_ref }}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
name: Publish SDK on Merge
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
id-token: write # Required for OIDC
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
publish:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
environment: publish
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Use Node.js 24
|
|
21
|
-
uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: 24
|
|
24
|
-
|
|
25
|
-
- name: Install dependencies
|
|
26
|
-
run: npm ci
|
|
27
|
-
|
|
28
|
-
- name: Clear NODE_AUTH_TOKEN for OIDC
|
|
29
|
-
run: |
|
|
30
|
-
unset NODE_AUTH_TOKEN || true
|
|
31
|
-
|
|
32
|
-
- name: Build and publish
|
|
33
|
-
run: npm run build && npm publish --access public --no-provenance --verbose
|
|
34
|
-
env:
|
|
35
|
-
NODE_AUTH_TOKEN: ""
|