Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Danybranch #7

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Usare IntelliSense per informazioni sui possibili attributi.
// Al passaggio del mouse vengono visualizzate le descrizioni degli attributi esistenti.
// Per altre informazioni, visitare: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [


{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/advanced-integration/server.js"
}
]
}
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM docker/whalesay:latest
LABEL Name=googlepay Version=0.0.1
RUN apt-get -y update && apt-get install -y fortunes
CMD ["sh", "-c", "/usr/games/fortune -a | cowsay"]
5 changes: 0 additions & 5 deletions advanced-integration/.env.example

This file was deleted.

2 changes: 1 addition & 1 deletion advanced-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"dotenv": "^16.0.0",
"dotenv": "^16.4.5",
"ejs": "^3.1.6",
"express": "^4.17.3",
"node-fetch": "^3.2.1"
Expand Down
9 changes: 6 additions & 3 deletions advanced-integration/server.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import "dotenv/config";
import express from "express";
import * as paypal from "./paypal-api.js";
//require('dotenv').config(); //dani 25 giu
const {PORT = 8888} = process.env;

const app = express();
app.set("view engine", "ejs");
app.set("view engine", "ejs"); //if "view engine" is not set "ejs" is the default
app.use(express.static("public"));

// render checkout page with client id & unique client token
app.get("/", async (req, res) => {
const clientId = process.env.PAYPAL_CLIENT_ID, merchantId = process.env.PAYPAL_MERCHANT_ID;
const clientId = process.env.PAYPAL_CLIENT_ID
const merchantId = process.env.PAYPAL_MERCHANT_ID; //testare
const clientSecret = process.env.PAYPAL_CLIENT_SECRET;
const mymerchantId = process.env.PAYPAL_MERCHANT_ID;
try {
if (!clientId || !merchantId || !clientSecret){
if (!clientId || !mymerchantId || !clientSecret){
throw new Error("Client Id or App Secret or Merchant Id is missing.");
}
const clientToken = await paypal.generateClientToken();
Expand Down
2 changes: 1 addition & 1 deletion advanced-integration/views/checkout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script src="https://pay.google.com/gp/p/js/pay.js"></script>
<!-- Include PayPal SDK Script with components=googlepay for Custom Googlepay Component-->
<script
src="https://www.paypal.com/sdk/js?components=googlepay&client-id=<%= clientId %>&merchant-id=<%= merchantId %>"
src="https://www.paypal.com/sdk/js?components=googlepay&client-id=<%= clientId %>&merchant-id=<%= mymerchantId %>"
data-client-token="<%= clientToken %>" data-partner-attribution-id="GOOGLEPAY"
></script>

Expand Down
8 changes: 8 additions & 0 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.4'

services:
googlepay:
image: googlepay
build:
context: .
dockerfile: ./Dockerfile
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.4'

services:
googlepay:
image: googlepay
build:
context: .
dockerfile: ./Dockerfile