Skip to content

Commit ee0e6ce

Browse files
author
Umar Nafeez Abdul Phatip
committed
Adding devcontianer files for Ruby and Python for module Advanced and Standard Integration
1 parent 31e8d0e commit ee0e6ce

File tree

19 files changed

+614
-8
lines changed

19 files changed

+614
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "advanced-integration-v2/html/python",
4+
"image": "mcr.microsoft.com/devcontainers/python:3.12",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash .devcontainer/advanced-integration-v2-html-python/welcome-message.sh",
8+
// Use 'postCreateCommand' to run commands after the container is created.
9+
"postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create",
10+
// Use 'postAttachCommand' to run commands when attaching to the container.
11+
"postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach",
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
"forwardPorts": [3000, 8080],
14+
"portsAttributes": {
15+
"8080": {
16+
"label": "Preview of Advanced Checkout Flow"
17+
},
18+
"3000": {
19+
"label": "HTML",
20+
"onAutoForward": "openBrowserOnce"
21+
}
22+
},
23+
"secrets": {
24+
"PAYPAL_CLIENT_ID": {
25+
"description": "Sandbox client ID of the application.",
26+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
27+
},
28+
"PAYPAL_CLIENT_SECRET": {
29+
"description": "Sandbox secret of the application.",
30+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
31+
}
32+
},
33+
"containerEnv": {
34+
"VISIBLE_FOLDER_SERVER": "python",
35+
"VISIBLE_FOLDER_CLIENT": "html",
36+
"VISIBLE_FOLDER_PROJECT": "advanced-integration",
37+
"VISIBLE_FOLDER_VERSION": "v2"
38+
},
39+
"customizations": {
40+
"vscode": {
41+
"extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"],
42+
"settings": {
43+
"git.openRepositoryInParentFolders": "always"
44+
}
45+
}
46+
},
47+
"features": {
48+
"ghcr.io/devcontainers/features/node:1": {
49+
"version": "lts"
50+
}
51+
}
52+
}
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"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "advanced-integration-v2/html/ruby",
4+
"image": "mcr.microsoft.com/devcontainers/ruby:3.3",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash .devcontainer/advanced-integration-v2-html-ruby/welcome-message.sh",
8+
// Use 'postCreateCommand' to run commands after the container is created.
9+
"postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create",
10+
// Use 'postAttachCommand' to run commands when attaching to the container.
11+
"postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach",
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
"forwardPorts": [3000, 8080],
14+
"portsAttributes": {
15+
"8080": {
16+
"label": "Preview of Advanced Checkout Flow"
17+
},
18+
"3000": {
19+
"label": "HTML",
20+
"onAutoForward": "openBrowserOnce"
21+
}
22+
},
23+
"secrets": {
24+
"PAYPAL_CLIENT_ID": {
25+
"description": "Sandbox client ID of the application.",
26+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
27+
},
28+
"PAYPAL_CLIENT_SECRET": {
29+
"description": "Sandbox secret of the application.",
30+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
31+
}
32+
},
33+
"containerEnv": {
34+
"VISIBLE_FOLDER_SERVER": "ruby",
35+
"VISIBLE_FOLDER_CLIENT": "html",
36+
"VISIBLE_FOLDER_PROJECT": "advanced-integration",
37+
"VISIBLE_FOLDER_VERSION": "v2"
38+
},
39+
"customizations": {
40+
"vscode": {
41+
"extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"],
42+
"settings": {
43+
"git.openRepositoryInParentFolders": "always"
44+
}
45+
}
46+
},
47+
"features": {
48+
"ghcr.io/devcontainers/features/node:1": {
49+
"version": "lts"
50+
}
51+
}
52+
}
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"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "advanced-integration-v2/react/python",
4+
"image": "mcr.microsoft.com/devcontainers/python:3.12",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash .devcontainer/advanced-integration-v2-react-python/welcome-message.sh",
8+
// Use 'postCreateCommand' to run commands after the container is created.
9+
"postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create",
10+
// Use 'postAttachCommand' to run commands when attaching to the container.
11+
"postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach",
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
"forwardPorts": [3000, 8080],
14+
"portsAttributes": {
15+
"8080": {
16+
"label": "Preview of Advanced Checkout Flow"
17+
},
18+
"3000": {
19+
"label": "React",
20+
"onAutoForward": "openBrowserOnce"
21+
}
22+
},
23+
"secrets": {
24+
"PAYPAL_CLIENT_ID": {
25+
"description": "Sandbox client ID of the application.",
26+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
27+
},
28+
"PAYPAL_CLIENT_SECRET": {
29+
"description": "Sandbox secret of the application.",
30+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
31+
}
32+
},
33+
"containerEnv": {
34+
"VISIBLE_FOLDER_SERVER": "python",
35+
"VISIBLE_FOLDER_CLIENT": "react",
36+
"VISIBLE_FOLDER_PROJECT": "advanced-integration",
37+
"VISIBLE_FOLDER_VERSION": "v2"
38+
},
39+
"customizations": {
40+
"vscode": {
41+
"extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"],
42+
"settings": {
43+
"git.openRepositoryInParentFolders": "always"
44+
}
45+
}
46+
},
47+
"features": {
48+
"ghcr.io/devcontainers/features/node:1": {
49+
"version": "lts"
50+
}
51+
}
52+
}
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"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "advanced-integration-v2/react/ruby",
4+
"image": "mcr.microsoft.com/devcontainers/ruby:3.3",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash .devcontainer/advanced-integration-v2-react-ruby/welcome-message.sh",
8+
// Use 'postCreateCommand' to run commands after the container is created.
9+
"postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create",
10+
// Use 'postAttachCommand' to run commands when attaching to the container.
11+
"postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach",
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
"forwardPorts": [3000, 8080],
14+
"portsAttributes": {
15+
"8080": {
16+
"label": "Preview of Advanced Checkout Flow"
17+
},
18+
"3000": {
19+
"label": "React",
20+
"onAutoForward": "openBrowserOnce"
21+
}
22+
},
23+
"secrets": {
24+
"PAYPAL_CLIENT_ID": {
25+
"description": "Sandbox client ID of the application.",
26+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
27+
},
28+
"PAYPAL_CLIENT_SECRET": {
29+
"description": "Sandbox secret of the application.",
30+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
31+
}
32+
},
33+
"containerEnv": {
34+
"VISIBLE_FOLDER_SERVER": "ruby",
35+
"VISIBLE_FOLDER_CLIENT": "react",
36+
"VISIBLE_FOLDER_PROJECT": "advanced-integration",
37+
"VISIBLE_FOLDER_VERSION": "v2"
38+
},
39+
"customizations": {
40+
"vscode": {
41+
"extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"],
42+
"settings": {
43+
"git.openRepositoryInParentFolders": "always"
44+
}
45+
}
46+
},
47+
"features": {
48+
"ghcr.io/devcontainers/features/node:1": {
49+
"version": "lts"
50+
}
51+
}
52+
}
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"

.devcontainer/post-commands.sh

+12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ setup_backend() {
3434
php)
3535
cd "$SERVER_DIR" && cd php && composer install
3636
;;
37+
python)
38+
cd "$SERVER_DIR" && cd python && python -m venv .venv && pip install -r requirements.txt
39+
;;
40+
ruby)
41+
cd "$SERVER_DIR" && cd ruby && bundle install
42+
;;
3743
*)
3844
echo "Unknown server: $VISIBLE_FOLDER_SERVER"
3945
exit 1
@@ -61,6 +67,12 @@ start_backend() {
6167
php)
6268
cd "$SERVER_DIR/php" && composer start
6369
;;
70+
python)
71+
cd "$SERVER_DIR" && cd python && flask --app server run --port 8080
72+
;;
73+
ruby)
74+
cd "$SERVER_DIR" && cd ruby && bundle exec ruby server.rb
75+
;;
6476
*)
6577
echo "Unknown server: $VISIBLE_FOLDER_SERVER"
6678
exit 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// For more details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "standard-integration/html/python",
4+
"image": "mcr.microsoft.com/devcontainers/python:3.12",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash .devcontainer/standard-integration-html-python/welcome-message.sh",
8+
// Use 'postCreateCommand' to run commands after the container is created.
9+
"postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create",
10+
// Use 'postAttachCommand' to run commands when attaching to the container.
11+
"postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach",
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
"forwardPorts": [3000, 8080],
14+
"portsAttributes": {
15+
"8080": {
16+
"label": "Preview of Standard Checkout Flow"
17+
},
18+
"3000": {
19+
"label": "HTML",
20+
"onAutoForward": "openBrowserOnce"
21+
}
22+
},
23+
"secrets": {
24+
"PAYPAL_CLIENT_ID": {
25+
"description": "Sandbox client ID of the application.",
26+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
27+
},
28+
"PAYPAL_CLIENT_SECRET": {
29+
"description": "Sandbox secret of the application.",
30+
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
31+
}
32+
},
33+
"containerEnv": {
34+
"VISIBLE_FOLDER_SERVER": "python",
35+
"VISIBLE_FOLDER_CLIENT": "html",
36+
"VISIBLE_FOLDER_PROJECT": "standard-integration"
37+
},
38+
"customizations": {
39+
"vscode": {
40+
"extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"],
41+
"settings": {
42+
"git.openRepositoryInParentFolders": "always"
43+
}
44+
}
45+
},
46+
"features": {
47+
"ghcr.io/devcontainers/features/node:1": {
48+
"version": "lts"
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)