UNPKG

@transferwise/approve-api-action-helpers

Version:

An http client that handles SCA protected requests gracefully

57 lines (56 loc) 2.18 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Approve API action demo</title> <link rel="stylesheet" href="styles.css"> <!-- For testing on IE11 --> <!--<script crossorigin="anonymous" src="https://polyfill-fastly.io/v3/polyfill.min.js?features=fetch%2CPromise"></script>--> <!-- Alternative 1: test with local build (reads from ../dist) --> <script src="main.js"></script> <!-- Alternative 2: download package from CDN --> <!-- <script src="https://unpkg.com/@transferwise/approve-api-action-helpers@latest/dist/main.js"></script> --> </head> <body> <div class="container"> <div class="container-inner"> <h1>Approve API action</h1> <p> This demo runs against mock backend. One time token that it returns is invalid. </p> <p> The test is successful when you see a message that the token was not found. </p> <form onsubmit="submitForm(event)" class="form"> <label class="radio-label"> <input type="radio" value="iframe" name="flow" checked> <span class="radio-label-text">Iframe</span> </label> <label class="radio-label"> <input type="radio" value="tab" name="flow"> <span class="radio-label-text">New tab</span> </label> <label class="radio-label"> <input type="radio" value="popup" name="flow"> <span class="radio-label-text">Popup</span> </label> <button type="submit"> TEST </button> </form> </div> </div> <script> function submitForm(event) { event.preventDefault(); var flow = document.querySelector('input[name="flow"]:checked').value; var config = { flow: flow, mode: twApproveApiActionHelpers.Mode.SANDBOX }; var request = twApproveApiActionHelpers.create(config); request('/api/authorised-endpoint'); return false; } </script> </body> </html>