-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cffb948
commit b164684
Showing
13 changed files
with
199 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,41 +5,81 @@ | |
<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> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | ||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> | ||
<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%'; | ||
var __VITE_PROCESSOR_URL__ = !'%VITE_PROCESSOR_URL%'.startsWith('%') && '%VITE_PROCESSOR_URL%'; | ||
</script> | ||
<script src="./session.js"></script> | ||
<script src="../dev-utils/session.js"></script> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module"> | ||
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: connectorUrl, | ||
sessionId: sessionId, | ||
config: { | ||
|
||
}, | ||
onComplete: ({ isSuccess, paymentReference }) => { | ||
console.log('onComplete', { isSuccess, paymentReference }); | ||
}, | ||
}); | ||
|
||
connector.createComponent('card', { | ||
config: {}, | ||
}) | ||
.then(e => e.mount('#card-component')); | ||
|
||
</script> | ||
|
||
<div id="card-component"></div> | ||
<main role="main"> | ||
|
||
<section class="jumbotron text-center"> | ||
<div class="container"> | ||
<form action="/action_page.php"> | ||
<div class="text-center mb-4"> | ||
<h1 class="h3 mb-3 font-weight-normal">Dev Site</h1> | ||
<p>Use this site for development purposes</p> | ||
</div> | ||
<div class="form-group"> | ||
<label for="cartId">Cart ID:</label> | ||
<input type="text" class="form-control" id="cartId"> | ||
</div> | ||
<button id="createCheckout" class="btn btn-lg btn-primary btn-block" type="submit">Create checkout</button> | ||
</form> | ||
</div> | ||
</section> | ||
|
||
<div class="album py-5 bg-light"> | ||
<div class="container"> | ||
|
||
<script type="module"> | ||
import { Enabler } from '/src/main.ts'; | ||
|
||
document.getElementById('createCheckout').addEventListener('click', async (event) => { | ||
event.preventDefault(); | ||
const cartId = document.getElementById('cartId').value; | ||
const sessionId = await getSessionId(cartId); | ||
const processorUrl = "https://service-ce9d8088-b10c-42df-8eb1-63f1fde80093.europe-west1.gcp.preview.commercetools.app"; | ||
|
||
const enabler = new Enabler({ | ||
processorUrl: __VITE_PROCESSOR_URL__, | ||
sessionId: sessionId, | ||
config: { | ||
|
||
}, | ||
onComplete: ({ isSuccess, paymentReference }) => { | ||
console.log('onComplete', { isSuccess, paymentReference }); | ||
}, | ||
}); | ||
|
||
enabler.createComponent('card', { | ||
config: {}, | ||
}) | ||
.then(e => e.mount('#card-component')); | ||
}); | ||
|
||
</script> | ||
|
||
<div id="card-component"></div> | ||
</div> | ||
</div> | ||
|
||
</main> | ||
|
||
|
||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Use this folder to include static assets |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { MockPaymentConnector } from './payment-connector/mockPaymentConnector'; | ||
import { MockPaymentEnabler } from './payment-enabler/mockPaymentEnabler'; | ||
|
||
export { MockPaymentConnector as Connector }; | ||
export { MockPaymentEnabler as Enabler }; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.