From 098addc10ece5cd057cd32cec123ae1fb925c5d0 Mon Sep 17 00:00:00 2001 From: Louis Low Date: Wed, 18 Sep 2024 18:15:03 +0800 Subject: [PATCH 1/3] add client & server implementation in codespace --- .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 57 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 57 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .devcontainer/post-commands.sh | 104 +++++++++++++ .../devcontainer.json | 55 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 55 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 55 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 55 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 56 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 55 +++++++ .../welcome-message.sh | 23 +++ .../devcontainer.json | 55 +++++++ .../welcome-message.sh | 23 +++ .devcontainer/update_settings.sh | 140 ++++++++++++++++++ .gitignore | 4 + 35 files changed, 1508 insertions(+) create mode 100644 .devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-html-dotnet/welcome-message.sh create mode 100644 .devcontainer/advanced-integration-v2-html-java/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-html-java/welcome-message.sh create mode 100644 .devcontainer/advanced-integration-v2-html-node/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-html-node/welcome-message.sh create mode 100644 .devcontainer/advanced-integration-v2-html-php/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-html-php/welcome-message.sh create mode 100644 .devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-react-dotnet/welcome-message.sh create mode 100644 .devcontainer/advanced-integration-v2-react-java/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-react-java/welcome-message.sh create mode 100644 .devcontainer/advanced-integration-v2-react-node/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-react-node/welcome-message.sh create mode 100644 .devcontainer/advanced-integration-v2-react-php/devcontainer.json create mode 100644 .devcontainer/advanced-integration-v2-react-php/welcome-message.sh create mode 100755 .devcontainer/post-commands.sh create mode 100644 .devcontainer/standard-integration-html-dotnet/devcontainer.json create mode 100644 .devcontainer/standard-integration-html-dotnet/welcome-message.sh create mode 100644 .devcontainer/standard-integration-html-java/devcontainer.json create mode 100644 .devcontainer/standard-integration-html-java/welcome-message.sh create mode 100644 .devcontainer/standard-integration-html-node/devcontainer.json create mode 100644 .devcontainer/standard-integration-html-node/welcome-message.sh create mode 100644 .devcontainer/standard-integration-html-php/devcontainer.json create mode 100644 .devcontainer/standard-integration-html-php/welcome-message.sh create mode 100644 .devcontainer/standard-integration-react-dotnet/devcontainer.json create mode 100644 .devcontainer/standard-integration-react-dotnet/welcome-message.sh create mode 100644 .devcontainer/standard-integration-react-java/devcontainer.json create mode 100644 .devcontainer/standard-integration-react-java/welcome-message.sh create mode 100644 .devcontainer/standard-integration-react-node/devcontainer.json create mode 100644 .devcontainer/standard-integration-react-node/welcome-message.sh create mode 100644 .devcontainer/standard-integration-react-php/devcontainer.json create mode 100644 .devcontainer/standard-integration-react-php/welcome-message.sh create mode 100755 .devcontainer/update_settings.sh diff --git a/.devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json b/.devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json new file mode 100644 index 00000000..88c465f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - HTML + Dotnet", + "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-html-dotnet/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "HTML", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "dotnet", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "ms-dotnettools.csharp" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/advanced-integration-v2-html-dotnet/welcome-message.sh b/.devcontainer/advanced-integration-v2-html-dotnet/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-dotnet/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/advanced-integration-v2-html-java/devcontainer.json b/.devcontainer/advanced-integration-v2-html-java/devcontainer.json new file mode 100644 index 00000000..1d395202 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-java/devcontainer.json @@ -0,0 +1,57 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - HTML + Java", + "image": "mcr.microsoft.com/devcontainers/java:21", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-html-java/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "HTML", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "java", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "22", + "jdkDistro": "tem", + "installMaven": "true" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/advanced-integration-v2-html-java/welcome-message.sh b/.devcontainer/advanced-integration-v2-html-java/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-java/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/advanced-integration-v2-html-node/devcontainer.json b/.devcontainer/advanced-integration-v2-html-node/devcontainer.json new file mode 100644 index 00000000..a4f48d9f --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-node/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - HTML + Node", + "image": "mcr.microsoft.com/devcontainers/javascript-node:20", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-html-node/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "HTML", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "node", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "dbaeumer.vscode-eslint" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/advanced-integration-v2-html-node/welcome-message.sh b/.devcontainer/advanced-integration-v2-html-node/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-node/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/advanced-integration-v2-html-php/devcontainer.json b/.devcontainer/advanced-integration-v2-html-php/devcontainer.json new file mode 100644 index 00000000..72c8222f --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-php/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - HTML + PHP", + "image": "mcr.microsoft.com/devcontainers/php:8", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-html-php/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "HTML", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "php", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "xdebug.php-debug" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/advanced-integration-v2-html-php/welcome-message.sh b/.devcontainer/advanced-integration-v2-html-php/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-html-php/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json b/.devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json new file mode 100644 index 00000000..6728053f --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - React + Dotnet", + "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-react-dotnet/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "dotnet", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "ms-dotnettools.csharp" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/advanced-integration-v2-react-dotnet/welcome-message.sh b/.devcontainer/advanced-integration-v2-react-dotnet/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-dotnet/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/advanced-integration-v2-react-java/devcontainer.json b/.devcontainer/advanced-integration-v2-react-java/devcontainer.json new file mode 100644 index 00000000..5652a550 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-java/devcontainer.json @@ -0,0 +1,57 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - React + Java", + "image": "mcr.microsoft.com/devcontainers/java:21", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-react-java/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "java", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "22", + "jdkDistro": "tem", + "installMaven": "true" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/advanced-integration-v2-react-java/welcome-message.sh b/.devcontainer/advanced-integration-v2-react-java/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-java/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/advanced-integration-v2-react-node/devcontainer.json b/.devcontainer/advanced-integration-v2-react-node/devcontainer.json new file mode 100644 index 00000000..6ac4eb0f --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-node/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - React + Node", + "image": "mcr.microsoft.com/devcontainers/javascript-node:20", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-react-node/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "node", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "dbaeumer.vscode-eslint" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/advanced-integration-v2-react-node/welcome-message.sh b/.devcontainer/advanced-integration-v2-react-node/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-node/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/advanced-integration-v2-react-php/devcontainer.json b/.devcontainer/advanced-integration-v2-react-php/devcontainer.json new file mode 100644 index 00000000..c31367fe --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-php/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Advanced Integration (v2) - React + PHP", + "image": "mcr.microsoft.com/devcontainers/php:8", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/advanced-integration-v2-react-php/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Advanced Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "php", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "advanced-integration", + "VISIBLE_FOLDER_VERSION": "v2" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "xdebug.php-debug" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/advanced-integration-v2-react-php/welcome-message.sh b/.devcontainer/advanced-integration-v2-react-php/welcome-message.sh new file mode 100644 index 00000000..ae9a72f9 --- /dev/null +++ b/.devcontainer/advanced-integration-v2-react-php/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Advanced Checkout 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 Advanced Checkout 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" diff --git a/.devcontainer/post-commands.sh b/.devcontainer/post-commands.sh new file mode 100755 index 00000000..db59d951 --- /dev/null +++ b/.devcontainer/post-commands.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +WORKSPACE_DIR="$( cd "$SCRIPT_DIR/.." &> /dev/null && pwd )" + +VISIBLE_FOLDER_SERVER="${VISIBLE_FOLDER_SERVER}" +VISIBLE_FOLDER_CLIENT="${VISIBLE_FOLDER_CLIENT}" +VISIBLE_FOLDER_PROJECT="${VISIBLE_FOLDER_PROJECT}" +VISIBLE_FOLDER_VERSION="${VISIBLE_FOLDER_VERSION}" + +# Set up SERVER_DIR & CLIENT_DIR +if [ -z "$VISIBLE_FOLDER_VERSION" ]; then + SERVER_DIR="${WORKSPACE_DIR}/${VISIBLE_FOLDER_PROJECT}/server" + CLIENT_DIR="${WORKSPACE_DIR}/${VISIBLE_FOLDER_PROJECT}/client/${VISIBLE_FOLDER_CLIENT}" +else + SERVER_DIR="${WORKSPACE_DIR}/${VISIBLE_FOLDER_PROJECT}/${VISIBLE_FOLDER_VERSION}/server" + CLIENT_DIR="${WORKSPACE_DIR}/${VISIBLE_FOLDER_PROJECT}/${VISIBLE_FOLDER_VERSION}/client/${VISIBLE_FOLDER_CLIENT}/client" +fi + +# Backend setup functions +setup_backend() { + case "$VISIBLE_FOLDER_SERVER" in + node) + cd "$SERVER_DIR/node" && npm install + ;; + java) + cd "$SERVER_DIR" && touch java/.env && cd java && mvn clean install + ;; + dotnet) + cd "$SERVER_DIR/dotnet" && dotnet restore + ;; + php) + cd "$SERVER_DIR" && touch php/.env && cd php && composer install + ;; + *) + echo "Unknown server: $VISIBLE_FOLDER_SERVER" + exit 1 + ;; + esac +} + +# Frontend setup functions +setup_frontend() { + cd "$CLIENT_DIR" && npm install +} + +# Backend start functions +start_backend() { + case "$VISIBLE_FOLDER_SERVER" in + node) + cd "$SERVER_DIR/node" && npm start + ;; + java) + cd "$SERVER_DIR/java" && mvn spring-boot:run + ;; + dotnet) + cd "$SERVER_DIR/dotnet" && dotnet run + ;; + php) + cd "$SERVER_DIR/php" && composer start + ;; + *) + echo "Unknown server: $VISIBLE_FOLDER_SERVER" + exit 1 + ;; + esac +} + +# Frontend start functions +start_frontend() { + cd "$CLIENT_DIR" && npm run start --no-analytics +} + +# Post-create commands +post_create() { + echo "Running post-create commands..." + setup_backend + setup_frontend +} + +# Post-attach commands +post_attach() { + echo "Running post-attach commands..." + start_backend & + start_frontend +} + +# Main execution +case "$1" in + post-create) + post_create + ;; + post-attach) + post_attach + ;; + *) + echo "Usage: $0 {post-create|post-attach}" + exit 1 + ;; +esac + +exit 0 \ No newline at end of file diff --git a/.devcontainer/standard-integration-html-dotnet/devcontainer.json b/.devcontainer/standard-integration-html-dotnet/devcontainer.json new file mode 100644 index 00000000..c97cbb18 --- /dev/null +++ b/.devcontainer/standard-integration-html-dotnet/devcontainer.json @@ -0,0 +1,55 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - HTML + Dotnet", + "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-html-dotnet/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "HTML", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "dotnet", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "ms-dotnettools.csharp" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/standard-integration-html-dotnet/welcome-message.sh b/.devcontainer/standard-integration-html-dotnet/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-html-dotnet/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/standard-integration-html-java/devcontainer.json b/.devcontainer/standard-integration-html-java/devcontainer.json new file mode 100644 index 00000000..ae903e74 --- /dev/null +++ b/.devcontainer/standard-integration-html-java/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - HTML + Java", + "image": "mcr.microsoft.com/devcontainers/java:21", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-html-java/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "Html", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "java", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "22", + "jdkDistro": "tem", + "installMaven": "true" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/standard-integration-html-java/welcome-message.sh b/.devcontainer/standard-integration-html-java/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-html-java/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/standard-integration-html-node/devcontainer.json b/.devcontainer/standard-integration-html-node/devcontainer.json new file mode 100644 index 00000000..cc5c735c --- /dev/null +++ b/.devcontainer/standard-integration-html-node/devcontainer.json @@ -0,0 +1,55 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - HTML + Node", + "image": "mcr.microsoft.com/devcontainers/javascript-node:20", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-html-node/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "HTML", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "node", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "dbaeumer.vscode-eslint" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/standard-integration-html-node/welcome-message.sh b/.devcontainer/standard-integration-html-node/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-html-node/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/standard-integration-html-php/devcontainer.json b/.devcontainer/standard-integration-html-php/devcontainer.json new file mode 100644 index 00000000..0eb9ea3b --- /dev/null +++ b/.devcontainer/standard-integration-html-php/devcontainer.json @@ -0,0 +1,55 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - HTML + PHP", + "image": "mcr.microsoft.com/devcontainers/php:8", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-html-php/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "HTML", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "php", + "VISIBLE_FOLDER_CLIENT": "html", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "xdebug.php-debug" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/standard-integration-html-php/welcome-message.sh b/.devcontainer/standard-integration-html-php/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-html-php/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/standard-integration-react-dotnet/devcontainer.json b/.devcontainer/standard-integration-react-dotnet/devcontainer.json new file mode 100644 index 00000000..face336b --- /dev/null +++ b/.devcontainer/standard-integration-react-dotnet/devcontainer.json @@ -0,0 +1,55 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - React + Dotnet", + "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-react-dotnet/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "dotnet", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "ms-dotnettools.csharp" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/standard-integration-react-dotnet/welcome-message.sh b/.devcontainer/standard-integration-react-dotnet/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-react-dotnet/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/standard-integration-react-java/devcontainer.json b/.devcontainer/standard-integration-react-java/devcontainer.json new file mode 100644 index 00000000..69df286d --- /dev/null +++ b/.devcontainer/standard-integration-react-java/devcontainer.json @@ -0,0 +1,56 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - React + Java", + "image": "mcr.microsoft.com/devcontainers/java:21", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-react-java/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "java", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": ["vsls-contrib.codetour", "PayPal.vscode-paypal"], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "22", + "jdkDistro": "tem", + "installMaven": "true" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/standard-integration-react-java/welcome-message.sh b/.devcontainer/standard-integration-react-java/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-react-java/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/standard-integration-react-node/devcontainer.json b/.devcontainer/standard-integration-react-node/devcontainer.json new file mode 100644 index 00000000..f2bee56f --- /dev/null +++ b/.devcontainer/standard-integration-react-node/devcontainer.json @@ -0,0 +1,55 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - React + Node", + "image": "mcr.microsoft.com/devcontainers/javascript-node:20", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-react-node/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "node", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "dbaeumer.vscode-eslint" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} diff --git a/.devcontainer/standard-integration-react-node/welcome-message.sh b/.devcontainer/standard-integration-react-node/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-react-node/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/standard-integration-react-php/devcontainer.json b/.devcontainer/standard-integration-react-php/devcontainer.json new file mode 100644 index 00000000..ca2a55bf --- /dev/null +++ b/.devcontainer/standard-integration-react-php/devcontainer.json @@ -0,0 +1,55 @@ +// For more details, see https://aka.ms/devcontainer.json. +{ + "name": "PayPal Standard Integration - React + PHP", + "image": "mcr.microsoft.com/devcontainers/php:8", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'onCreateCommand' to run commands when creating the container. + "onCreateCommand": "bash .devcontainer/standard-integration-react-php/welcome-message.sh", + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "chmod +x .devcontainer/update_settings.sh && .devcontainer/update_settings.sh && chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-create", + // Use 'postAttachCommand' to run commands when attaching to the container. + "postAttachCommand": "chmod +x .devcontainer/post-commands.sh && .devcontainer/post-commands.sh post-attach", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 8080], + "portsAttributes": { + "8080": { + "label": "Preview of Standard Checkout Flow" + }, + "3000": { + "label": "React", + "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" + } + }, + "containerEnv": { + "VISIBLE_FOLDER_SERVER": "php", + "VISIBLE_FOLDER_CLIENT": "react", + "VISIBLE_FOLDER_PROJECT": "standard-integration" + }, + "customizations": { + "vscode": { + "extensions": [ + "vsls-contrib.codetour", + "PayPal.vscode-paypal", + "xdebug.php-debug" + ], + "settings": { + "git.openRepositoryInParentFolders": "always" + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + } +} \ No newline at end of file diff --git a/.devcontainer/standard-integration-react-php/welcome-message.sh b/.devcontainer/standard-integration-react-php/welcome-message.sh new file mode 100644 index 00000000..78cce216 --- /dev/null +++ b/.devcontainer/standard-integration-react-php/welcome-message.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +WELCOME_MESSAGE=" +👋 Welcome to the \"PayPal Standard Checkout 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 Standard Checkout 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" diff --git a/.devcontainer/update_settings.sh b/.devcontainer/update_settings.sh new file mode 100755 index 00000000..736b30ff --- /dev/null +++ b/.devcontainer/update_settings.sh @@ -0,0 +1,140 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +WORKSPACE_DIR="$( cd "$SCRIPT_DIR/.." &> /dev/null && pwd )" + +VISIBLE_FOLDER_SERVER="$VISIBLE_FOLDER_SERVER" +VISIBLE_FOLDER_CLIENT="$VISIBLE_FOLDER_CLIENT" +VISIBLE_FOLDER_PROJECT="$VISIBLE_FOLDER_PROJECT" +VISIBLE_FOLDER_VERSION="$VISIBLE_FOLDER_VERSION" + +DEVCONTAINER_WORKSPACE="$WORKSPACE_DIR/.devcontainer" +SETTINGS_FILE="$WORKSPACE_DIR/.vscode/settings.json" +PROJECT_WORKSPACE="$WORKSPACE_DIR/$VISIBLE_FOLDER_PROJECT" + + +if [ -z "$VISIBLE_FOLDER_CLIENT" ]; then + echo "Error: VISIBLE_FOLDER_CLIENT is not set, setting it to default" + VISIBLE_FOLDER_CLIENT="DEFAULT" +fi + +if [ -z "$VISIBLE_FOLDER_VERSION" ]; then + SERVER_WORKSPACE="$WORKSPACE_DIR/$VISIBLE_FOLDER_PROJECT/server" + CLIENT_WORKSPACE="$WORKSPACE_DIR/$VISIBLE_FOLDER_PROJECT/client" + VERSION_WORKSPACE="$PROJECT_WORKSPACE" + VISIBLE_FOLDER_DEVCONTAINER="$VISIBLE_FOLDER_PROJECT-$VISIBLE_FOLDER_CLIENT-$VISIBLE_FOLDER_SERVER" + PROJECT_DIR="$VISIBLE_FOLDER_PROJECT" +else + SERVER_WORKSPACE="$WORKSPACE_DIR/$VISIBLE_FOLDER_PROJECT/$VISIBLE_FOLDER_VERSION/server" + CLIENT_WORKSPACE="$WORKSPACE_DIR/$VISIBLE_FOLDER_PROJECT/$VISIBLE_FOLDER_VERSION/client" + VERSION_WORKSPACE="$PROJECT_WORKSPACE/$VISIBLE_FOLDER_VERSION" + VISIBLE_FOLDER_DEVCONTAINER="$VISIBLE_FOLDER_PROJECT-$VISIBLE_FOLDER_VERSION-$VISIBLE_FOLDER_CLIENT-$VISIBLE_FOLDER_SERVER" + PROJECT_DIR="$VISIBLE_FOLDER_PROJECT/$VISIBLE_FOLDER_VERSION" + +fi +echo "SERVER_WORKSPACE:$SERVER_WORKSPACE" +echo "CLIENT_WORKSPACE:$CLIENT_WORKSPACE" +echo "VISIBLE_FOLDER_DEVCONTAINER:$VISIBLE_FOLDER_DEVCONTAINER" +echo "PROJECT_WORKSPACE:$PROJECT_WORKSPACE" + + +echo "Workspace directory: $WORKSPACE_DIR" +echo "Server directory: $SERVER_WORKSPACE" +echo "Visible server folder: $VISIBLE_FOLDER_SERVER" +echo "Visible client folder: $VISIBLE_FOLDER_CLIENT" +echo "Visible project folder: $VISIBLE_FOLDER_PROJECT" +echo "Visible version: $VISIBLE_FOLDER_VERSION" +echo "Visible devcontainer: $DEVCONTAINER_WORKSPACE" +if [ ! -d "$SERVER_WORKSPACE" ]; then + echo "Error: Server directory not found at $SERVER_WORKSPACE" + exit 1 +fi + +if [ ! -d "$DEVCONTAINER_WORKSPACE" ]; then + echo "Error: .devcontainer directory not found at $DEVCONTAINER_WORKSPACE" + exit 1 +fi + +if [ -z "$VISIBLE_FOLDER_SERVER" ]; then + echo "Error: VISIBLE_FOLDER_SERVER is not set" + exit 1 +fi + +mkdir -p "$(dirname "$SETTINGS_FILE")" + +echo "{ + \"files.exclude\": {" > "$SETTINGS_FILE" + +first=true + +for dir in "$WORKSPACE_DIR"/*/ ; do + dir_name=$(basename "$dir") + if [ -d "$dir" ] && [ "$dir_name" != "$VISIBLE_FOLDER_PROJECT" ]; then + if [ "$first" = true ] ; then + first=false + else + echo "," >> "$SETTINGS_FILE" + fi + echo -n " \"**/$dir_name\": true" >> "$SETTINGS_FILE" + fi +done + +if [ -n "$VISIBLE_FOLDER_VERSION" ]; then + for dir in "$PROJECT_WORKSPACE"/*/ ; do + dir_name=$(basename "$dir") + if [ -d "$dir" ] && [ "$dir_name" != "$VISIBLE_FOLDER_VERSION" ]; then + if [ "$first" = true ] ; then + first=false + else + echo "," >> "$SETTINGS_FILE" + fi + echo -n " \"**/$VISIBLE_FOLDER_PROJECT/$dir_name\": true" >> "$SETTINGS_FILE" + fi + done +fi + +for dir in "$DEVCONTAINER_WORKSPACE"/*/ ; do + dir_name=$(basename "$dir") + if [ -d "$dir" ] && [ "$dir_name" != "$VISIBLE_FOLDER_DEVCONTAINER" ]; then + if [ "$first" = true ] ; then + first=false + else + echo "," >> "$SETTINGS_FILE" + fi + echo -n " \"**/.devcontainer/$dir_name\": true" >> "$SETTINGS_FILE" + fi +done + +for dir in "$SERVER_WORKSPACE"/*/ ; do + dir_name=$(basename "$dir") + if [ -d "$dir" ] && [ "$dir_name" != "$VISIBLE_FOLDER_SERVER" ]; then + if [ "$first" = true ] ; then + first=false + else + echo "," >> "$SETTINGS_FILE" + fi + echo -n " \"**/$PROJECT_DIR/server/$dir_name\": true" >> "$SETTINGS_FILE" + fi +done + +for dir in "$CLIENT_WORKSPACE"/*/ ; do + dir_name=$(basename "$dir") + if [ -d "$dir" ] && [ "$dir_name" != "$VISIBLE_FOLDER_CLIENT" ]; then + if [ "$first" = true ] ; then + first=false + else + echo "," >> "$SETTINGS_FILE" + fi + echo -n " \"**/$PROJECT_DIR/client/$dir_name\": true" >> "$SETTINGS_FILE" + fi +done + +echo " + } +}" >> "$SETTINGS_FILE" + +echo "VS Code settings updated to show only $VISIBLE_FOLDER_SERVER and $VISIBLE_FOLDER_CLIENT folder in server directory." +echo "Contents of $SETTINGS_FILE:" +cat "$SETTINGS_FILE" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5df6b051..b5925b9d 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,7 @@ dist # dotnet *.sln + +#Codespace +.vscode/settings.json +.devcontainer/update_settings.sh \ No newline at end of file From 1429c63ab9dbb3e5ea1dde50b4db0b1e827d7a65 Mon Sep 17 00:00:00 2001 From: Louis Low Date: Thu, 19 Sep 2024 00:57:59 +0800 Subject: [PATCH 2/3] add steps to run codespace in README.md --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index daf0636c..98fbede3 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,18 @@ These examples will ask you to run commands like `npm install` and `npm start`. You'll need a version of node >= 16 which can be downloaded from the [Node.js website](https://nodejs.org/en/download/). -## PayPal Codespaces +# Running on Codespaces +Follow below steps to use Codespaces. + +1) Click "New with options..." to open a page where you can choose the Dev container to run. +![image](https://github.com/user-attachments/assets/0d4bf202-0c94-42ec-aa2e-d8ccb6da9eb8) + +2) Choose the Dev container to run +![image](https://github.com/user-attachments/assets/b612467d-9fdc-4666-8dfa-0d99af6a2d39) + +3) Client ID and Client Secrets are required for running the application in codespace. +![image](https://github.com/user-attachments/assets/cbbc4521-aa43-403f-9243-e3c555e67f4a) -PayPal codespaces require a client ID and client secret for your app. ### Link to codespaces From b1aa4c83bfc2464926a142260a61d3d2090593b4 Mon Sep 17 00:00:00 2001 From: Louis Low Date: Thu, 19 Sep 2024 00:58:05 +0800 Subject: [PATCH 3/3] change name of devcontainers --- .../advanced-integration-v2-html-dotnet/devcontainer.json | 2 +- .../advanced-integration-v2-html-java/devcontainer.json | 2 +- .../advanced-integration-v2-html-node/devcontainer.json | 2 +- .../advanced-integration-v2-html-php/devcontainer.json | 2 +- .../advanced-integration-v2-react-dotnet/devcontainer.json | 2 +- .../advanced-integration-v2-react-java/devcontainer.json | 2 +- .../advanced-integration-v2-react-node/devcontainer.json | 2 +- .../advanced-integration-v2-react-php/devcontainer.json | 2 +- .../standard-integration-html-dotnet/devcontainer.json | 2 +- .devcontainer/standard-integration-html-java/devcontainer.json | 2 +- .devcontainer/standard-integration-html-node/devcontainer.json | 2 +- .devcontainer/standard-integration-html-php/devcontainer.json | 2 +- .../standard-integration-react-dotnet/devcontainer.json | 2 +- .devcontainer/standard-integration-react-java/devcontainer.json | 2 +- .devcontainer/standard-integration-react-node/devcontainer.json | 2 +- .devcontainer/standard-integration-react-php/devcontainer.json | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json b/.devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json index 88c465f9..d04cf42b 100644 --- a/.devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-html-dotnet/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - HTML + Dotnet", + "name": "advanced-integration/client-html/server-dotnet", "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/advanced-integration-v2-html-java/devcontainer.json b/.devcontainer/advanced-integration-v2-html-java/devcontainer.json index 1d395202..16915c08 100644 --- a/.devcontainer/advanced-integration-v2-html-java/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-html-java/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - HTML + Java", + "name": "advanced-integration/client-html/server-java", "image": "mcr.microsoft.com/devcontainers/java:21", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/advanced-integration-v2-html-node/devcontainer.json b/.devcontainer/advanced-integration-v2-html-node/devcontainer.json index a4f48d9f..efade83b 100644 --- a/.devcontainer/advanced-integration-v2-html-node/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-html-node/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - HTML + Node", + "name": "advanced-integration/client-html/server-node", "image": "mcr.microsoft.com/devcontainers/javascript-node:20", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/advanced-integration-v2-html-php/devcontainer.json b/.devcontainer/advanced-integration-v2-html-php/devcontainer.json index 72c8222f..477a6b79 100644 --- a/.devcontainer/advanced-integration-v2-html-php/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-html-php/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - HTML + PHP", + "name": "advanced-integration/client-html/server-php", "image": "mcr.microsoft.com/devcontainers/php:8", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json b/.devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json index 6728053f..f26a59f1 100644 --- a/.devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-react-dotnet/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - React + Dotnet", + "name": " advanced-integration/client-react/server-dotnet", "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/advanced-integration-v2-react-java/devcontainer.json b/.devcontainer/advanced-integration-v2-react-java/devcontainer.json index 5652a550..f0f9b3b7 100644 --- a/.devcontainer/advanced-integration-v2-react-java/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-react-java/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - React + Java", + "name": "advanced-integration/client-react/server-java", "image": "mcr.microsoft.com/devcontainers/java:21", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/advanced-integration-v2-react-node/devcontainer.json b/.devcontainer/advanced-integration-v2-react-node/devcontainer.json index 6ac4eb0f..c8a98975 100644 --- a/.devcontainer/advanced-integration-v2-react-node/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-react-node/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - React + Node", + "name": "advanced-integration/client-react/server-node", "image": "mcr.microsoft.com/devcontainers/javascript-node:20", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/advanced-integration-v2-react-php/devcontainer.json b/.devcontainer/advanced-integration-v2-react-php/devcontainer.json index c31367fe..34a91fb0 100644 --- a/.devcontainer/advanced-integration-v2-react-php/devcontainer.json +++ b/.devcontainer/advanced-integration-v2-react-php/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Advanced Integration (v2) - React + PHP", + "name": "advanced-integration/client-react/server-php", "image": "mcr.microsoft.com/devcontainers/php:8", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-html-dotnet/devcontainer.json b/.devcontainer/standard-integration-html-dotnet/devcontainer.json index c97cbb18..cfda05fb 100644 --- a/.devcontainer/standard-integration-html-dotnet/devcontainer.json +++ b/.devcontainer/standard-integration-html-dotnet/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - HTML + Dotnet", + "name": "standard-integration/client-html/server-dotnet", "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-html-java/devcontainer.json b/.devcontainer/standard-integration-html-java/devcontainer.json index ae903e74..84a59669 100644 --- a/.devcontainer/standard-integration-html-java/devcontainer.json +++ b/.devcontainer/standard-integration-html-java/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - HTML + Java", + "name": "standard-integration/client-html/server-java", "image": "mcr.microsoft.com/devcontainers/java:21", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-html-node/devcontainer.json b/.devcontainer/standard-integration-html-node/devcontainer.json index cc5c735c..2fc7df6d 100644 --- a/.devcontainer/standard-integration-html-node/devcontainer.json +++ b/.devcontainer/standard-integration-html-node/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - HTML + Node", + "name": "standard-integration/client-html/server-node", "image": "mcr.microsoft.com/devcontainers/javascript-node:20", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-html-php/devcontainer.json b/.devcontainer/standard-integration-html-php/devcontainer.json index 0eb9ea3b..8e219203 100644 --- a/.devcontainer/standard-integration-html-php/devcontainer.json +++ b/.devcontainer/standard-integration-html-php/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - HTML + PHP", + "name": "standard-integration/client-html/server-php", "image": "mcr.microsoft.com/devcontainers/php:8", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-react-dotnet/devcontainer.json b/.devcontainer/standard-integration-react-dotnet/devcontainer.json index face336b..919d294f 100644 --- a/.devcontainer/standard-integration-react-dotnet/devcontainer.json +++ b/.devcontainer/standard-integration-react-dotnet/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - React + Dotnet", + "name": "standard-integration/client-react/server-dotnet", "image": "mcr.microsoft.com/devcontainers/dotnet:8.0", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-react-java/devcontainer.json b/.devcontainer/standard-integration-react-java/devcontainer.json index 69df286d..5cdb28f2 100644 --- a/.devcontainer/standard-integration-react-java/devcontainer.json +++ b/.devcontainer/standard-integration-react-java/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - React + Java", + "name": "standard-integration/client-react/server-java", "image": "mcr.microsoft.com/devcontainers/java:21", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-react-node/devcontainer.json b/.devcontainer/standard-integration-react-node/devcontainer.json index f2bee56f..61e5d68c 100644 --- a/.devcontainer/standard-integration-react-node/devcontainer.json +++ b/.devcontainer/standard-integration-react-node/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - React + Node", + "name": "standard-integration/client-react/server-node", "image": "mcr.microsoft.com/devcontainers/javascript-node:20", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container. diff --git a/.devcontainer/standard-integration-react-php/devcontainer.json b/.devcontainer/standard-integration-react-php/devcontainer.json index ca2a55bf..e0af4870 100644 --- a/.devcontainer/standard-integration-react-php/devcontainer.json +++ b/.devcontainer/standard-integration-react-php/devcontainer.json @@ -1,6 +1,6 @@ // For more details, see https://aka.ms/devcontainer.json. { - "name": "PayPal Standard Integration - React + PHP", + "name": "standard-integration/client-react/server-php", "image": "mcr.microsoft.com/devcontainers/php:8", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", // Use 'onCreateCommand' to run commands when creating the container.