Skip to content

Commit f240e26

Browse files
committed
Add codespaces example for hosted fields v1 changes
1 parent 5a3ea22 commit f240e26

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "PayPal Advanced Integration (v1)",
4+
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/advanced-integration/v1",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash ../../.devcontainer/advanced-integration-v1/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+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
WELCOME_MESSAGE="
6+
👋 Welcome to the \"PayPal Advanced Checkout Integration Example\"
7+
8+
🛠️ Your environment is fully setup with all the required software.
9+
10+
🚀 Once you rename the \".env.example\" file to \".env\" and update \"PAYPAL_CLIENT_ID\" and \"PAYPAL_CLIENT_SECRET\", the checkout page will automatically open in the browser after the server is restarted."
11+
12+
ALTERNATE_WELCOME_MESSAGE="
13+
👋 Welcome to the \"PayPal Advanced Checkout Integration Example\"
14+
15+
🛠️ Your environment is fully setup with all the required software.
16+
17+
🚀 The checkout page will automatically open in the browser after the server is started."
18+
19+
if [ -n "$PAYPAL_CLIENT_ID" ] && [ -n "$PAYPAL_CLIENT_SECRET" ]; then
20+
WELCOME_MESSAGE="${ALTERNATE_WELCOME_MESSAGE}"
21+
fi
22+
23+
sudo bash -c "echo \"${WELCOME_MESSAGE}\" > /usr/local/etc/vscode-dev-containers/first-run-notice.txt"

0 commit comments

Comments
 (0)