Skip to content

Commit bb8bab4

Browse files
authored
Respect exit codes in CI and format json (#73)
1 parent 9c9ed82 commit bb8bab4

File tree

4 files changed

+91
-92
lines changed

4 files changed

+91
-92
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
11
// For more details, see https://aka.ms/devcontainer.json.
22
{
3-
"name": "PayPal Advanced Integration",
4-
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
5-
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration",
6-
// Use 'onCreateCommand' to run commands when creating the container.
7-
"onCreateCommand": "bash ../.devcontainer/advanced-integration/welcome-message.sh",
8-
// Use 'postCreateCommand' to run commands after the container is created.
9-
"postCreateCommand": "npm install",
10-
// Use 'postAttachCommand' to run commands when attaching to the container.
11-
"postAttachCommand": {
12-
"Start server": "npm start"
13-
},
14-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
"forwardPorts": [
16-
8888
17-
],
18-
"portsAttributes": {
19-
"8888": {
20-
"label": "Preview of Advanced Checkout Flow",
21-
"onAutoForward": "openBrowserOnce"
22-
}
23-
},
24-
"secrets": {
25-
"PAYPAL_CLIENT_ID": {
26-
"description": "Sandbox client ID of the application.",
27-
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
28-
},
29-
"PAYPAL_CLIENT_SECRET": {
30-
"description": "Sandbox secret of the application.",
31-
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
32-
}
33-
},
34-
"customizations": {
35-
"vscode": {
36-
"extensions": [
37-
"vsls-contrib.codetour"
38-
],
39-
"settings": {
40-
"git.openRepositoryInParentFolders": "always"
41-
}
42-
}
43-
}
44-
}
3+
"name": "PayPal Advanced Integration",
4+
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash ../.devcontainer/advanced-integration/welcome-message.sh",
8+
// Use 'postCreateCommand' to run commands after the container is created.
9+
"postCreateCommand": "npm install",
10+
// Use 'postAttachCommand' to run commands when attaching to the container.
11+
"postAttachCommand": {
12+
"Start server": "npm start"
13+
},
14+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15+
"forwardPorts": [8888],
16+
"portsAttributes": {
17+
"8888": {
18+
"label": "Preview of Advanced Checkout Flow",
19+
"onAutoForward": "openBrowserOnce"
20+
}
21+
},
22+
"secrets": {
23+
"PAYPAL_CLIENT_ID": {
24+
"description": "Sandbox client ID of the application.",
25+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
26+
},
27+
"PAYPAL_CLIENT_SECRET": {
28+
"description": "Sandbox secret of the application.",
29+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
30+
}
31+
},
32+
"customizations": {
33+
"vscode": {
34+
"extensions": ["vsls-contrib.codetour"],
35+
"settings": {
36+
"git.openRepositoryInParentFolders": "always"
37+
}
38+
}
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
11
// For more details, see https://aka.ms/devcontainer.json.
22
{
3-
"name": "PayPal Standard Integration",
4-
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
5-
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/standard-integration",
6-
// Use 'onCreateCommand' to run commands when creating the container.
7-
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
8-
// Use 'postCreateCommand' to run commands after the container is created.
9-
"postCreateCommand": "npm install",
10-
// Use 'postAttachCommand' to run commands when attaching to the container.
11-
"postAttachCommand": {
12-
"Start server": "npm start"
13-
},
14-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
"forwardPorts": [
16-
8888
17-
],
18-
"portsAttributes": {
19-
"8888": {
20-
"label": "Preview of Standard Checkout Flow",
21-
"onAutoForward": "openBrowserOnce"
22-
}
23-
},
24-
"secrets": {
25-
"PAYPAL_CLIENT_ID": {
26-
"description": "Sandbox client ID of the application.",
27-
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
28-
},
29-
"PAYPAL_CLIENT_SECRET": {
30-
"description": "Sandbox secret of the application.",
31-
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
32-
}
33-
},
34-
"customizations": {
35-
"vscode": {
36-
"extensions": [
37-
"vsls-contrib.codetour"
38-
],
39-
"settings": {
40-
"git.openRepositoryInParentFolders": "always"
41-
}
42-
}
43-
}
44-
}
3+
"name": "PayPal Standard Integration",
4+
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/standard-integration",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
8+
// Use 'postCreateCommand' to run commands after the container is created.
9+
"postCreateCommand": "npm install",
10+
// Use 'postAttachCommand' to run commands when attaching to the container.
11+
"postAttachCommand": {
12+
"Start server": "npm start"
13+
},
14+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15+
"forwardPorts": [8888],
16+
"portsAttributes": {
17+
"8888": {
18+
"label": "Preview of Standard Checkout Flow",
19+
"onAutoForward": "openBrowserOnce"
20+
}
21+
},
22+
"secrets": {
23+
"PAYPAL_CLIENT_ID": {
24+
"description": "Sandbox client ID of the application.",
25+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
26+
},
27+
"PAYPAL_CLIENT_SECRET": {
28+
"description": "Sandbox secret of the application.",
29+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
30+
}
31+
},
32+
"customizations": {
33+
"vscode": {
34+
"extensions": ["vsls-contrib.codetour"],
35+
"settings": {
36+
"git.openRepositoryInParentFolders": "always"
37+
}
38+
}
39+
}
40+
}

.github/workflows/validate.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ jobs:
2121
node-version: 18
2222

2323
- name: 🧹 Check code formatting with Prettier
24-
run: find . -name package.json -maxdepth 2 -type f -execdir npm run format:check ';'
24+
run: >
25+
find . -name package.json -maxdepth 2 -type f | while read -r file; do
26+
directory=$(dirname "$file")
27+
cd "$directory" && npm run format:check && cd -
28+
done
2529
26-
- name: 👕 Lint Node.js code with ESLint
27-
run: find . -name package.json -maxdepth 2 -type f -execdir npm run lint ';'
30+
- name: 👕 Lint code with ESLint
31+
run: >
32+
find . -name package.json -maxdepth 2 -type f | while read -r file; do
33+
directory=$(dirname "$file")
34+
cd "$directory" && npm run lint && cd -
35+
done

advanced-integration/client/app.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async function onApproveCallback(data, actions) {
9696
}
9797
}
9898

99-
paypal
99+
window.paypal
100100
.Buttons({
101101
createOrder: createOrderCallback,
102102
onApprove: onApproveCallback,
@@ -110,9 +110,9 @@ function resultMessage(message) {
110110
}
111111

112112
// If this returns false or the card fields aren't visible, see Step #1.
113-
if (paypal.HostedFields.isEligible()) {
113+
if (window.paypal.HostedFields.isEligible()) {
114114
// Renders card fields
115-
paypal.HostedFields.render({
115+
window.paypal.HostedFields.render({
116116
// Call your server to set up the transaction
117117
createOrder: createOrderCallback,
118118
styles: {
@@ -172,10 +172,9 @@ if (paypal.HostedFields.isEligible()) {
172172
return onApproveCallback(data);
173173
})
174174
.catch((orderData) => {
175-
const { links, ...errorMessageData } = orderData;
176175
resultMessage(
177176
`Sorry, your transaction could not be processed...<br><br>${JSON.stringify(
178-
errorMessageData,
177+
orderData,
179178
)}`,
180179
);
181180
});

0 commit comments

Comments
 (0)