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

chore(enabler): fixing build and start issues #6

Closed
wants to merge 5 commits into from
Closed
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
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ name: CI
on: [push]

jobs:
build-enabler:
name: Build the application for enabler
runs-on: ubuntu-latest
env:
CTP_REGION: ${{ secrets.CTP_REGION }}
defaults:
run:
working-directory: enabler
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: '16.x'

- name: Install modules
run: npm ci

build-processor:
name: Build the application for processor
Expand Down
9 changes: 8 additions & 1 deletion connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ deployAs:
- key: CTP_API_URL
description: Commercetools API URL
- key: CTP_SESSION_URL
description: Session API URL
description: Session API URL
- name: enabler
applicationType: service
endpoint: /enabler
configuration:
securedConfiguration:
- key: CTP_REGION
description: Region of Commercetools project
6 changes: 6 additions & 0 deletions enabler/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Local testing environment variables
VITE_ADMIN_CLIENT_ID=[client-id]
VITE_ADMIN_CLIENT_SECRET=[client-secret]
VITE_ADMIN_SCOPE=manage_project:commercetools-checkout
VITE_REGION=europe-west1.gcp
VITE_CART_ID=[cart-id]
24 changes: 24 additions & 0 deletions enabler/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
7 changes: 7 additions & 0 deletions enabler/decs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module "@adyen/adyen-web"
declare module "@adyen/adyen-web/dist/types/components/ApplePay"
declare module "@adyen/adyen-web/dist/types/components/GooglePay"
declare module "@adyen/adyen-web/dist/types/core"
declare module "@adyen/adyen-web/dist/types/core/core"
declare module "@adyen/adyen-web/dist/types/components/Redirect/Redirect"
declare module "@adyen/adyen-web/dist/types/core/types"
73 changes: 73 additions & 0 deletions enabler/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
<script>
var __VITE_ADMIN_CLIENT_ID__ = !'%VITE_ADMIN_CLIENT_ID%'.startsWith('%') && '%VITE_ADMIN_CLIENT_ID%';
var __VITE_ADMIN_CLIENT_SECRET__ = !'%VITE_ADMIN_CLIENT_SECRET%'.startsWith('%') && '%VITE_ADMIN_CLIENT_SECRET%';
var __VITE_ADMIN_SCOPE__ = !'%VITE_ADMIN_SCOPE%'.startsWith('%') && '%VITE_ADMIN_SCOPE%';
var __VITE_REGION__ = !'%VITE_REGION%'.startsWith('%') && '%VITE_REGION%';
var __VITE_CART_ID__ = !'%VITE_CART_ID%'.startsWith('%') && '%VITE_CART_ID%';
</script>
<script src="./session.js"></script>
</head>
<body>
<div id="app"></div>
<script type="module">
import { Connector } from '/enabler/src/main.ts';

const sessionId = await getSessionId();

const connector = new Connector({
connectorUrl: "http://0.0.0.0:5000",
sessionId: sessionId,
config: {

},
onComplete: ({ isSuccess, paymentReference }) => {
console.log('onComplete', { isSuccess, paymentReference });
},
});

connector.createComponent('dropin', {
config: {},
})
.then(e => e.mount('#adyen-dropin-component'));

connector.createComponent('card', {
config: {},
})
.then(e => e.mount('#adyen-card-component'));

connector.createComponent('ideal', {
config: {showPayButton: false},
})
.then(e => e.mount('#adyen-ideal-component'));

connector.createComponent('googlepay', {})
.then(e => e.mount('#adyen-googlepay-component'));
</script>

<div class="container-md p-3 border m-3">
<div class="container-md p-3 border m-3">
<h5>Adyen dropin component:</h5>
<div id="adyen-dropin-component"></div>
</div>
<div class="container-md p-3 border m-3">
<h5>Adyen card component:</h5>
<div id="adyen-card-component"></div>
</div>
<div class="container-md p-3 border m-3">
<h5>Ideal component:</h5>
<div id="adyen-ideal-component"></div>
</div>
<div class="container-md p-3 border m-3">
<h5>Googlepay component:</h5>
<div id="adyen-googlepay-component"></div>
</div>
</div>
</body>
</html>
Loading
Loading