Skip to content

Commit

Permalink
feat(enabler): Mock card component
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjcamposct committed Feb 7, 2024
1 parent 1d61a2a commit a8b4c0a
Show file tree
Hide file tree
Showing 25 changed files with 1,437 additions and 404 deletions.
13 changes: 13 additions & 0 deletions enabler/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
VITE_ADMIN_CLIENT_ID=IYg3zsamDxEtBVhN0GXPfSyz
VITE_ADMIN_CLIENT_SECRET=Ti5_ciOUgU76hu0hq75shf0V3Fg4Oean
VITE_ADMIN_SCOPE=manage_project:commercetools-checkout
VITE_REGION=europe-west1.gcp
VITE_CART_ID=f49ea44e-a189-4f9f-b17f-b09f29da49c9



# VITE_ADMIN_CLIENT_ID=u3YNvD_OUzwpIx1HkVmDyz95
# VITE_ADMIN_CLIENT_SECRET=EYmPN7oAmwkTXe29owPPCkys_4V4924B
# VITE_ADMIN_SCOPE=manage_project:juanjcampos
# VITE_REGION=europe-west1.gcp

8 changes: 1 addition & 7 deletions enabler/decs.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
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"
declare module '*.scss';
38 changes: 5 additions & 33 deletions enabler/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
<body>
<div id="app"></div>
<script type="module">
import { Connector } from '/enabler/src/main.ts';
import { Connector } from '/src/main.ts';

const sessionId = await getSessionId();
const connectorUrl = "https://service-ce9d8088-b10c-42df-8eb1-63f1fde80093.europe-west1.gcp.preview.commercetools.app";

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

Expand All @@ -32,42 +33,13 @@
},
});

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'));
.then(e => e.mount('#card-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>
<div id="card-component"></div>
</body>
</html>
196 changes: 196 additions & 0 deletions enabler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion enabler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"http-server": "^14.1.1"
},
"devDependencies": {
"@adyen/adyen-web": "5.51.0",
"@types/node": "^20.11.0",
"sass": "^1.70.0",
"typescript": "5.2.2",
"vite": "5.0.12",
"vite-plugin-css-injected-by-js": "3.3.0"
Expand Down
10 changes: 10 additions & 0 deletions enabler/src/FakeSdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export class FakeSdk {
private environment: string;
constructor({ environment }) {
this.environment = environment;
console.log('FakeSdk constructor', this.environment);
}
init(opts: any) {
console.log('FakeSdk init', opts);
}
}
Loading

0 comments on commit a8b4c0a

Please sign in to comment.