-
Notifications
You must be signed in to change notification settings - Fork 63
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
0 parents
commit c330bf4
Showing
208 changed files
with
33,220 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Install fast-glob | ||
run: npm install fast-glob | ||
|
||
- name: Display Node.js version | ||
run: node --version | ||
|
||
- name: npm release | ||
run: npx semantic-release --debug; |
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,26 @@ | ||
node_modules | ||
.bsb.lock | ||
.merlin | ||
.netlify | ||
lib/bs | ||
public/*.LICENSE.txt | ||
package-lock.json | ||
public/app.js | ||
public/app.css | ||
.DS_Store | ||
/dist/ | ||
**/*.bs.js | ||
|
||
# yarn | ||
.pnp.* | ||
.yarn/* | ||
yarn.lock | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
|
||
# Sentry Auth Token | ||
.env.sentry-build-plugin |
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,9 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //') | ||
|
||
if [[ $BRANCH_NAME != *"no branch"* ]] | ||
then | ||
npx --no -- commitlint --edit "${1}" | ||
fi |
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,41 @@ | ||
#!/bin/bash | ||
|
||
# Adding hooks to prepare commit message. | ||
# This hook triggers Jira input modules. | ||
# Helps in maintaining code compatblity. | ||
|
||
# JS Code Check | ||
echo "*****~~~~~ Checking ReScript Code ~~~~~~*****" | ||
if (! npm run re:build) | ||
then | ||
echo | ||
echo "*****~~~~~ ReScript Code Compilation Failed! ~~~~~*****" | ||
exit 1 | ||
fi | ||
echo "***** ReScript Code Compiled! *****" | ||
|
||
#Trailing Space Check | ||
echo "Evaluating for trailing spaces" | ||
|
||
find . -type f -name '.DS_Store' -exec rm {} + | ||
|
||
|
||
TRAIL_SRC=$(grep -r '[[:blank:]]$' src --exclude='*.bs.js' --exclude='*.resi') | ||
|
||
if [[ ! -z "$TRAIL_SRC" ]] | ||
then | ||
echo "$TRAIL_SRC" | ||
echo | ||
echo "!Please remove trailing spaces before commiting changes" | ||
echo "Usage of EditorConfig [https://editorconfig.org/#download] plugin is recommended for development " | ||
exit 1 | ||
fi | ||
|
||
echo "Done Evaluating" | ||
|
||
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //') | ||
|
||
if [[ $BRANCH_NAME != *"no branch"* ]] | ||
then | ||
exec < /dev/tty && node_modules/.bin/git-cz --hook || true | ||
fi |
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,3 @@ | ||
{ | ||
"editor.formatOnSave": true | ||
} |
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,3 @@ | ||
STATIC_DIR="./public" | ||
HYPERSWITCH_PUBLISHABLE_KEY="GET_THIS_FROM_DASHBOARD" | ||
HYPERSWITCH_SECRET_KEY="GET_THIS_FROM_DASHBOARD" |
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,27 @@ | ||
# Accept a payment examples in React for Payment Element | ||
|
||
## How to run locally | ||
|
||
This is the React client for the sample and runs independently of the server. | ||
Running a backend server is a requirement and a dependency for this React front-end to work. See the README in the root of the project for more details. | ||
|
||
To run the React client locally: | ||
|
||
1. Install dependencies | ||
|
||
From this directory run: | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
2. Start the react app | ||
|
||
```sh | ||
npm start | ||
``` | ||
|
||
This will start the react server running on localhost:4242. Note that the | ||
backend server runs on localhost:5252, but the React UI will be available at | ||
localhost:4242. API requests to your backend are proxied by the | ||
create-react-app server using the `proxy` setting in `./package.json`. |
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,55 @@ | ||
{ | ||
"name": "react-cra", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@juspay-tech/hyper-js": "^1.6.0", | ||
"@juspay-tech/hyperswitch-node": "^1.0.1", | ||
"@juspay-tech/react-hyper-js": "^1.0.2", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^12.1.5", | ||
"@testing-library/user-event": "^14.4.2", | ||
"body-parser": "^1.19.0", | ||
"dotenv": "^10.0.0", | ||
"express": "^4.17.1", | ||
"patch-package": "^8.0.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"react-router-dom": "^6.3.0", | ||
"react-scripts": "5.0.1", | ||
"web-vitals": "^2.1.4" | ||
}, | ||
"scripts": { | ||
"start": "concurrently \"npm run start-client\" \"npm run start-server\"", | ||
"start-client": "PORT=4242 react-scripts start", | ||
"start-server": "node server.js", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject", | ||
"format": "prettier --write \"**/*.{js,jsx}\"", | ||
"postinstall": "patch-package" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"proxy": "http://localhost:5252", | ||
"devDependencies": { | ||
"concurrently": "4.1.2", | ||
"prettier": "^2.7.1" | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Hyperswitch-React-Demo-App/patches/@juspay-tech+hyper-js+1.6.0.patch
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,14 @@ | ||
diff --git a/node_modules/@juspay-tech/hyper-js/index.js b/node_modules/@juspay-tech/hyper-js/index.js | ||
index 933e713..0722600 100644 | ||
--- a/node_modules/@juspay-tech/hyper-js/index.js | ||
+++ b/node_modules/@juspay-tech/hyper-js/index.js | ||
@@ -1 +1 @@ | ||
-var p=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var k=(r,n)=>{for(var e in n)p(r,e,{get:n[e],enumerable:!0})},W=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of M(n))!F.call(r,u)&&u!==e&&p(r,u,{get:()=>n[u],enumerable:!(t=J(n,u))||t.enumerable});return r};var H=r=>W(p({},"__esModule",{value:!0}),r);var x={};k(x,{loadHyper:()=>D,loadStripe:()=>j});module.exports=H(x);function d(r,n,e){for(var t=new Array(e),u=0,i=n;u<e;)t[u]=r[i],u=u+1|0,i=i+1|0;return t}function m(r,n){for(;;){var e=n,t=r,u=t.length,i=u===0?1:u,o=e.length,f=i-o|0;if(f===0)return t.apply(null,e);if(f>=0)return function(l,c){return function(_){return m(l,c.concat([_]))}}(t,e);n=d(e,i,-f|0),r=t.apply(null,d(e,0,i))}}function h(r,n,e,t){var u=r.length;if(u===3)return r(n,e,t);switch(u){case 1:return m(r(n),[e,t]);case 2:return m(r(n,e),[t]);case 3:return r(n,e,t);case 4:return function(i){return r(n,e,t,i)};case 5:return function(i,o){return r(n,e,t,i,o)};case 6:return function(i,o,f){return r(n,e,t,i,o,f)};case 7:return function(i,o,f,l){return r(n,e,t,i,o,f,l)};default:return m(r,[n,e,t])}}function a(r){return r===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:r.BS_PRIVATE_NESTED_SOME_NONE+1|0}:r}function s(r){if(!(r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return r;var n=r.BS_PRIVATE_NESTED_SOME_NONE;if(n!==0)return{BS_PRIVATE_NESTED_SOME_NONE:n-1|0}}function I(r,n){if(n in r)return a(r[n])}function O(r){for(var n={},e=r.length,t=0;t<e;++t){var u=r[t];n[u[0]]=u[1]}return n}function S(r){if(typeof r=="string")return r}function U(r){if(typeof r=="object"&&!Array.isArray(r)&&r!==null)return a(r)}var g=2147483647,E=-2147483648;function z(r){return r>g?g:r<E?E:Math.floor(r)}function w(r,n){return z(Math.random()*(n-r|0))+r|0}function b(r,n){if(r<=0)return[];for(var e=new Array(r),t=0;t<r;++t)e[t]=n;return e}function T(r,n){return r!==void 0?s(r):n}function R(r){var n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";return b(32,0).reduce(function(e,t){var u=w(0,n.length),i=n.charAt(u);return e+i},"")}function B(r){var n=r!==void 0?T(U(s(r)),{}):{},e=I(n,"env");if(e===void 0)return"";var t=S(s(e));return t!==void 0?t:""}function D(r,n){return new Promise(function(e,t){var u=R(void 0),i=Date.now(),o=B(n),f;switch(o){case"PROD":f="https://checkout.hyperswitch.io/v0/HyperLoader.js";break;case"SANDBOX":f="https://beta.hyperswitch.io/v1/HyperLoader.js";break;default:f=r.startsWith("pk_prd_")?"https://checkout.hyperswitch.io/v0/HyperLoader.js":"https://beta.hyperswitch.io/v1/HyperLoader.js"}var l=O([["sessionID",u],["timeStamp",String(i)]]);if(document.querySelectorAll('script[src="'+f+'"]').length===0){var c=document.createElement("script");c.src=f,c.onload=function(C){var A=window.Hyper;if(A!=null)return e(h(A,r,n,l))},c.onerror=function(C){t(C)},document.body.appendChild(c);return}console.warn("INTEGRATION WARNING: There is already an existing script tag for "+f+". Multiple additions of HyperLoader.js is not permitted, please add it on the top level only once.");var _=window.Hyper;if(_!=null)return e(h(_,r,n,l))})}function j(r,n){return console.warn("loadStripe is deprecated. Please use loadHyper instead."),D(r,n)} | ||
+var p=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var k=(r,n)=>{for(var e in n)p(r,e,{get:n[e],enumerable:!0})},W=(r,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of M(n))!F.call(r,u)&&u!==e&&p(r,u,{get:()=>n[u],enumerable:!(t=J(n,u))||t.enumerable});return r};var H=r=>W(p({},"__esModule",{value:!0}),r);var x={};k(x,{loadHyper:()=>D,loadStripe:()=>j});module.exports=H(x);function d(r,n,e){for(var t=new Array(e),u=0,i=n;u<e;)t[u]=r[i],u=u+1|0,i=i+1|0;return t}function m(r,n){for(;;){var e=n,t=r,u=t.length,i=u===0?1:u,o=e.length,f=i-o|0;if(f===0)return t.apply(null,e);if(f>=0)return function(l,c){return function(_){return m(l,c.concat([_]))}}(t,e);n=d(e,i,-f|0),r=t.apply(null,d(e,0,i))}}function h(r,n,e,t){var u=r.length;if(u===3)return r(n,e,t);switch(u){case 1:return m(r(n),[e,t]);case 2:return m(r(n,e),[t]);case 3:return r(n,e,t);case 4:return function(i){return r(n,e,t,i)};case 5:return function(i,o){return r(n,e,t,i,o)};case 6:return function(i,o,f){return r(n,e,t,i,o,f)};case 7:return function(i,o,f,l){return r(n,e,t,i,o,f,l)};default:return m(r,[n,e,t])}}function a(r){return r===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:r.BS_PRIVATE_NESTED_SOME_NONE+1|0}:r}function s(r){if(!(r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return r;var n=r.BS_PRIVATE_NESTED_SOME_NONE;if(n!==0)return{BS_PRIVATE_NESTED_SOME_NONE:n-1|0}}function I(r,n){if(n in r)return a(r[n])}function O(r){for(var n={},e=r.length,t=0;t<e;++t){var u=r[t];n[u[0]]=u[1]}return n}function S(r){if(typeof r=="string")return r}function U(r){if(typeof r=="object"&&!Array.isArray(r)&&r!==null)return a(r)}var g=2147483647,E=-2147483648;function z(r){return r>g?g:r<E?E:Math.floor(r)}function w(r,n){return z(Math.random()*(n-r|0))+r|0}function b(r,n){if(r<=0)return[];for(var e=new Array(r),t=0;t<r;++t)e[t]=n;return e}function T(r,n){return r!==void 0?s(r):n}function R(r){var n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";return b(32,0).reduce(function(e,t){var u=w(0,n.length),i=n.charAt(u);return e+i},"")}function B(r){var n=r!==void 0?T(U(s(r)),{}):{},e=I(n,"env");if(e===void 0)return"";var t=S(s(e));return t!==void 0?t:""}function D(r,n){return new Promise(function(e,t){var u=R(void 0),i=Date.now(),o=B(n),f;switch(o){case"PROD":f="http://localhost:9050/HyperLoader.js";break;case"SANDBOX":f="http://localhost:9050/HyperLoader.js";break;default:f=r.startsWith("pk_prd_")?"http://localhost:9050/HyperLoader.js":"http://localhost:9050/HyperLoader.js"}var l=O([["sessionID",u],["timeStamp",String(i)]]);if(document.querySelectorAll('script[src="'+f+'"]').length===0){var c=document.createElement("script");c.src=f,c.onload=function(C){var A=window.Hyper;if(A!=null)return e(h(A,r,n,l))},c.onerror=function(C){t(C)},document.body.appendChild(c);return}console.warn("INTEGRATION WARNING: There is already an existing script tag for "+f+". Multiple additions of HyperLoader.js is not permitted, please add it on the top level only once.");var _=window.Hyper;if(_!=null)return e(h(_,r,n,l))})}function j(r,n){return console.warn("loadStripe is deprecated. Please use loadHyper instead."),D(r,n)} | ||
diff --git a/node_modules/@juspay-tech/hyper-js/index.mjs b/node_modules/@juspay-tech/hyper-js/index.mjs | ||
index 2fa35c0..9ee0a2c 100644 | ||
--- a/node_modules/@juspay-tech/hyper-js/index.mjs | ||
+++ b/node_modules/@juspay-tech/hyper-js/index.mjs | ||
@@ -1 +1 @@ | ||
-function p(r,n,e){for(var t=new Array(e),i=0,u=n;i<e;)t[i]=r[u],i=i+1|0,u=u+1|0;return t}function m(r,n){for(;;){var e=n,t=r,i=t.length,u=i===0?1:i,o=e.length,f=u-o|0;if(f===0)return t.apply(null,e);if(f>=0)return function(l,c){return function(_){return m(l,c.concat([_]))}}(t,e);n=p(e,u,-f|0),r=t.apply(null,p(e,0,u))}}function d(r,n,e,t){var i=r.length;if(i===3)return r(n,e,t);switch(i){case 1:return m(r(n),[e,t]);case 2:return m(r(n,e),[t]);case 3:return r(n,e,t);case 4:return function(u){return r(n,e,t,u)};case 5:return function(u,o){return r(n,e,t,u,o)};case 6:return function(u,o,f){return r(n,e,t,u,o,f)};case 7:return function(u,o,f,l){return r(n,e,t,u,o,f,l)};default:return m(r,[n,e,t])}}function a(r){return r===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:r.BS_PRIVATE_NESTED_SOME_NONE+1|0}:r}function s(r){if(!(r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return r;var n=r.BS_PRIVATE_NESTED_SOME_NONE;if(n!==0)return{BS_PRIVATE_NESTED_SOME_NONE:n-1|0}}function A(r,n){if(n in r)return a(r[n])}function I(r){for(var n={},e=r.length,t=0;t<e;++t){var i=r[t];n[i[0]]=i[1]}return n}function N(r){if(typeof r=="string")return r}function S(r){if(typeof r=="object"&&!Array.isArray(r)&&r!==null)return a(r)}var y=2147483647,g=-2147483648;function M(r){return r>y?y:r<g?g:Math.floor(r)}function E(r,n){return M(Math.random()*(n-r|0))+r|0}function P(r,n){if(r<=0)return[];for(var e=new Array(r),t=0;t<r;++t)e[t]=n;return e}function b(r,n){return r!==void 0?s(r):n}function T(r){var n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";return P(32,0).reduce(function(e,t){var i=E(0,n.length),u=n.charAt(i);return e+u},"")}function R(r){var n=r!==void 0?b(S(s(r)),{}):{},e=A(n,"env");if(e===void 0)return"";var t=N(s(e));return t!==void 0?t:""}function V(r,n){return new Promise(function(e,t){var i=T(void 0),u=Date.now(),o=R(n),f;switch(o){case"PROD":f="https://checkout.hyperswitch.io/v0/HyperLoader.js";break;case"SANDBOX":f="https://beta.hyperswitch.io/v1/HyperLoader.js";break;default:f=r.startsWith("pk_prd_")?"https://checkout.hyperswitch.io/v0/HyperLoader.js":"https://beta.hyperswitch.io/v1/HyperLoader.js"}var l=I([["sessionID",i],["timeStamp",String(u)]]);if(document.querySelectorAll('script[src="'+f+'"]').length===0){var c=document.createElement("script");c.src=f,c.onload=function(w){var C=window.Hyper;if(C!=null)return e(d(C,r,n,l))},c.onerror=function(w){t(w)},document.body.appendChild(c);return}console.warn("INTEGRATION WARNING: There is already an existing script tag for "+f+". Multiple additions of HyperLoader.js is not permitted, please add it on the top level only once.");var _=window.Hyper;if(_!=null)return e(d(_,r,n,l))})}function K(r,n){return console.warn("loadStripe is deprecated. Please use loadHyper instead."),V(r,n)}export{V as loadHyper,K as loadStripe}; | ||
+function p(r,n,e){for(var t=new Array(e),i=0,u=n;i<e;)t[i]=r[u],i=i+1|0,u=u+1|0;return t}function m(r,n){for(;;){var e=n,t=r,i=t.length,u=i===0?1:i,o=e.length,f=u-o|0;if(f===0)return t.apply(null,e);if(f>=0)return function(l,c){return function(_){return m(l,c.concat([_]))}}(t,e);n=p(e,u,-f|0),r=t.apply(null,p(e,0,u))}}function d(r,n,e,t){var i=r.length;if(i===3)return r(n,e,t);switch(i){case 1:return m(r(n),[e,t]);case 2:return m(r(n,e),[t]);case 3:return r(n,e,t);case 4:return function(u){return r(n,e,t,u)};case 5:return function(u,o){return r(n,e,t,u,o)};case 6:return function(u,o,f){return r(n,e,t,u,o,f)};case 7:return function(u,o,f,l){return r(n,e,t,u,o,f,l)};default:return m(r,[n,e,t])}}function a(r){return r===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:r.BS_PRIVATE_NESTED_SOME_NONE+1|0}:r}function s(r){if(!(r!==null&&r.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return r;var n=r.BS_PRIVATE_NESTED_SOME_NONE;if(n!==0)return{BS_PRIVATE_NESTED_SOME_NONE:n-1|0}}function A(r,n){if(n in r)return a(r[n])}function I(r){for(var n={},e=r.length,t=0;t<e;++t){var i=r[t];n[i[0]]=i[1]}return n}function N(r){if(typeof r=="string")return r}function S(r){if(typeof r=="object"&&!Array.isArray(r)&&r!==null)return a(r)}var y=2147483647,g=-2147483648;function M(r){return r>y?y:r<g?g:Math.floor(r)}function E(r,n){return M(Math.random()*(n-r|0))+r|0}function P(r,n){if(r<=0)return[];for(var e=new Array(r),t=0;t<r;++t)e[t]=n;return e}function b(r,n){return r!==void 0?s(r):n}function T(r){var n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";return P(32,0).reduce(function(e,t){var i=E(0,n.length),u=n.charAt(i);return e+u},"")}function R(r){var n=r!==void 0?b(S(s(r)),{}):{},e=A(n,"env");if(e===void 0)return"";var t=N(s(e));return t!==void 0?t:""}function V(r,n){return new Promise(function(e,t){var i=T(void 0),u=Date.now(),o=R(n),f;switch(o){case"PROD":f="http://localhost:9050/HyperLoader.js";break;case"SANDBOX":f="http://localhost:9050/HyperLoader.js";break;default:f=r.startsWith("pk_prd_")?"http://localhost:9050/HyperLoader.js":"http://localhost:9050/HyperLoader.js"}var l=I([["sessionID",i],["timeStamp",String(u)]]);if(document.querySelectorAll('script[src="'+f+'"]').length===0){var c=document.createElement("script");c.src=f,c.onload=function(w){var C=window.Hyper;if(C!=null)return e(d(C,r,n,l))},c.onerror=function(w){t(w)},document.body.appendChild(c);return}console.warn("INTEGRATION WARNING: There is already an existing script tag for "+f+". Multiple additions of HyperLoader.js is not permitted, please add it on the top level only once.");var _=window.Hyper;if(_!=null)return e(d(_,r,n,l))})}function K(r,n){return console.warn("loadStripe is deprecated. Please use loadHyper instead."),V(r,n)}export{V as loadHyper,K as loadStripe}; |
Binary file not shown.
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,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>React Hyperswitch Payment Element</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
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,46 @@ | ||
const express = require("express"); | ||
const app = express(); | ||
const { resolve } = require("path"); | ||
|
||
// Replace if using a different env file or config | ||
const env = require("dotenv").config({ path: "./.env" }); | ||
app.use(express.static(process.env.STATIC_DIR)); | ||
app.get("/", (req, res) => { | ||
const path = resolve(process.env.STATIC_DIR + "/index.html"); | ||
res.sendFile(path); | ||
}); | ||
|
||
// replace the test api key with your hyperswitch api key | ||
const hyper = require("@juspay-tech/hyperswitch-node")( | ||
process.env.HYPERSWITCH_SECRET_KEY | ||
); | ||
|
||
app.get("/config", (req, res) => { | ||
res.send({ | ||
publishableKey: process.env.HYPERSWITCH_PUBLISHABLE_KEY, | ||
}); | ||
}); | ||
|
||
app.post("/create-payment-intent", async (req, res) => { | ||
try { | ||
const paymentIntent = await hyper.paymentIntents.create({ | ||
currency: "USD", | ||
amount: 2999, | ||
}); | ||
|
||
// Send publishable key and PaymentIntent details to client | ||
res.send({ | ||
clientSecret: paymentIntent.client_secret, | ||
}); | ||
} catch (err) { | ||
return res.status(400).send({ | ||
error: { | ||
message: err.message, | ||
}, | ||
}); | ||
} | ||
}); | ||
|
||
app.listen(5252, () => | ||
console.log(`Node server listening at http://localhost:5252`) | ||
); |
Oops, something went wrong.