Skip to content

Commit

Permalink
Merge pull request #115 from NavinPayPal/main
Browse files Browse the repository at this point in the history
Adding changes to create Codespaces for Save Payment Method
  • Loading branch information
NavinPayPal committed Feb 20, 2024
2 parents 6419cb9 + a2074e9 commit dd359b8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .devcontainer/advanced-integration-v1/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"customizations": {
"vscode": {
"extensions": ["vsls-contrib.codetour"],
"extensions": ["vsls-contrib.codetour","PayPal.vscode-paypal"],
"settings": {
"git.openRepositoryInParentFolders": "always"
}
Expand Down
40 changes: 40 additions & 0 deletions .devcontainer/save-payment-method/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For more details, see https://aka.ms/devcontainer.json.
{
"name": "PayPal Save Payment Method",
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/save-payment-method",
// Use 'onCreateCommand' to run commands when creating the container.
"onCreateCommand": "bash ../.devcontainer/save-payment-method/welcome-message.sh",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
// Use 'postAttachCommand' to run commands when attaching to the container.
"postAttachCommand": {
"Start server": "npm start"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8888],
"portsAttributes": {
"8888": {
"label": "Preview of Save Payment Method Flow",
"onAutoForward": "openBrowserOnce"
}
},
"secrets": {
"PAYPAL_CLIENT_ID": {
"description": "Sandbox client ID of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
},
"PAYPAL_CLIENT_SECRET": {
"description": "Sandbox secret of the application.",
"documentationUrl": "https://developer.paypal.com/dashboard/applications/sandbox"
}
},
"customizations": {
"vscode": {
"extensions": ["vsls-contrib.codetour","PayPal.vscode-paypal"],
"settings": {
"git.openRepositoryInParentFolders": "always"
}
}
}
}
23 changes: 23 additions & 0 deletions .devcontainer/save-payment-method/welcome-message.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

set -e

WELCOME_MESSAGE="
πŸ‘‹ Welcome to the \"PayPal Save Payment Method Integration Example\"
πŸ› οΈ Your environment is fully setup with all the required software.
πŸš€ 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."

ALTERNATE_WELCOME_MESSAGE="
πŸ‘‹ Welcome to the \"PayPal Save Payment Method Integration Example\"
πŸ› οΈ Your environment is fully setup with all the required software.
πŸš€ The checkout page will automatically open in the browser after the server is started."

if [ -n "$PAYPAL_CLIENT_ID" ] && [ -n "$PAYPAL_CLIENT_SECRET" ]; then
WELCOME_MESSAGE="${ALTERNATE_WELCOME_MESSAGE}"
fi

sudo bash -c "echo \"${WELCOME_MESSAGE}\" > /usr/local/etc/vscode-dev-containers/first-run-notice.txt"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ PayPal codespaces require a client ID and client secret for your app.
| 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)|
| 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)|
| 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)|
| 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)|

### Learn more

Expand Down

0 comments on commit dd359b8

Please sign in to comment.