Skip to content

Commit dd359b8

Browse files
authored
Merge pull request #115 from NavinPayPal/main
Adding changes to create Codespaces for Save Payment Method
2 parents 6419cb9 + a2074e9 commit dd359b8

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

β€Ž.devcontainer/advanced-integration-v1/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"customizations": {
3333
"vscode": {
34-
"extensions": ["vsls-contrib.codetour"],
34+
"extensions": ["vsls-contrib.codetour","PayPal.vscode-paypal"],
3535
"settings": {
3636
"git.openRepositoryInParentFolders": "always"
3737
}
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 Save Payment Method",
4+
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/save-payment-method",
6+
// Use 'onCreateCommand' to run commands when creating the container.
7+
"onCreateCommand": "bash ../.devcontainer/save-payment-method/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 Save Payment Method 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","PayPal.vscode-paypal"],
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 Save Payment Method 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 Save Payment Method 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"

β€ŽREADME.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ PayPal codespaces require a client ID and client secret for your app.
5252
| Advanced Integration v2 | [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/paypal-examples/docs-examples?devcontainer_path=.devcontainer%2Fadvanced-integration-v2%2Fdevcontainer.json)|
5353
| Advanced Integration v1 | [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/paypal-examples/docs-examples?devcontainer_path=.devcontainer%2Fadvanced-integration-v1%2Fdevcontainer.json)|
5454
| Standard Integration | [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/paypal-examples/docs-examples?devcontainer_path=.devcontainer%2Fstandard-integration%2Fdevcontainer.json)|
55+
| Save Payment Method Integration | [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/paypal-examples/docs-examples?devcontainer_path=.devcontainer%2Fsave-payment-method%2Fdevcontainer.json)|
5556

5657
### Learn more
5758

0 commit comments

Comments
Β (0)