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

feat: ACH Bank Debit #134

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 13 additions & 7 deletions server.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove these changes. Not required on main.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ app.use(cors());
app.use(express.static('./dist'));
app.use(express.json());

require('dotenv').config({path: './.env'});
require('dotenv').config({ path: './.env' });

try {
var hyper = require('@juspay-tech/hyperswitch-node')(
Expand All @@ -18,12 +18,18 @@ try {

app.get('/create-payment-intent', async (req, res) => {
try {
var paymentIntent = await hyper.paymentIntents.create({
amount: 2999,
currency: 'USD',
});
var paymentIntent = await hyper.paymentIntents.create(
{
amount: 6540,
currency: 'USD',

customer_id: 'StripeCustomer',


profile_id: process.env.HYPERSWITCH_PROFILE_ID,
});


// Send publishable key and PaymentIntent details to client
res.send({
publishableKey: process.env.HYPERSWITCH_PUBLISHABLE_KEY,
clientSecret: paymentIntent.client_secret,
Expand All @@ -47,7 +53,7 @@ app.get('/create-ephemeral-key', async (req, res) => {
'Content-Type': 'application/json',
'api-key': process.env.HYPERSWITCH_SECRET_KEY,
},
body: JSON.stringify({customer_id: "hyperswitch_sdk_demo_id"}),
body: JSON.stringify({ customer_id: "hyperswitch_sdk_demo_id" }),
},
);
const ephemeralKey = await response.json();
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/AllPaymentHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@ let useRedirectHook = () => {
~errorCallback,
~processor=body,
)
responseCallback(
~paymentStatus=LoadingContext.ProcessingPayments(None),
~status={status, message: "", code: "", type_: ""},
)
}
| statusVal =>
logger(
Expand Down
14 changes: 14 additions & 0 deletions src/hooks/PMListModifier.res
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ let useListModifier = () => {
/>,
})
: None
| BANK_DEBIT(achDebitVal) =>
let fields =
redirectionList
->Array.find(l => l.name == achDebitVal.payment_method_type)
->Option.getOr(Types.defaultRedirectType)

Some({
name: fields.text,
componentHoc: (~isScreenFocus, ~setConfirmButtonDataRef) =>
<Redirect
isScreenFocus redirectProp=BANK_DEBIT(achDebitVal) fields setConfirmButtonDataRef
/>,
})

| CRYPTO(cryptoVal) =>
let fields =
redirectionList
Expand Down
2 changes: 2 additions & 0 deletions src/icons/Icon.res
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ let camera = `<svg viewBox="0 0 18 16" xmlns="http://www.w3.org/2000/svg"><path
let addwithcircle = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none"><path d="M12.7269 7.95376H7.96335V12.7152C7.96335 13.2416 7.53248 13.6663 7.01185 13.6663C6.48522 13.6663 6.06034 13.2357 6.06034 12.7152V7.95376H1.28484C0.75822 7.95376 0.333332 7.52308 0.333332 7.00267C0.333332 6.47627 0.764204 6.05157 1.28484 6.05157H6.04837V1.28411C6.04837 0.757712 6.47924 0.333008 6.99988 0.333008C7.5265 0.333008 7.95139 0.763694 7.95139 1.28411V6.04558H12.7149C13.2415 6.04558 13.6664 6.47627 13.6664 6.99668C13.6784 7.52906 13.2475 7.95376 12.7269 7.95376Z" fill="#006AA8"/></svg>`
let checkboxclicked = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><path d="M15.9982 0H2.00179C0.904036 0 0 0.904036 0 2.00179V15.9982C0 17.104 0.904036 18 2.00179 18H15.9982C17.096 18 18 17.104 18 15.9982V2.00179C18 0.904036 17.104 0 15.9982 0ZM7.70852 13.2861C7.32108 13.6735 6.69148 13.6735 6.29596 13.2861L2.70404 9.69417C2.31659 9.30673 2.31659 8.67713 2.70404 8.28161C3.09148 7.89417 3.72108 7.89417 4.11659 8.28161L6.99821 11.1632L13.8834 4.2861C14.2709 3.89865 14.9004 3.89865 15.296 4.2861C15.6834 4.67354 15.6834 5.30314 15.296 5.69865L7.70852 13.2861Z"/></svg>`
let checkboxnotclicked = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><path d="M14.9973 15.9982H3.00269C2.45381 15.9982 2.00179 15.5462 2.00179 14.9973V3.00269C2.00179 2.45381 2.45381 2.00179 3.00269 2.00179H15.0054C15.5543 2.00179 16.0063 2.45381 16.0063 3.00269V15.0054C15.9982 15.5462 15.5462 15.9982 14.9973 15.9982ZM15.9982 0H2.00179C0.904036 0 0 0.904036 0 2.00179V15.9982C0 17.104 0.904036 18 2.00179 18H15.9982C17.096 18 18 17.104 18 15.9982V2.00179C18 0.904036 17.104 0 15.9982 0Z"/></svg>`
let achBankDebit = `<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.0465 16.4272L16.2641 12.2096C15.588 14.1823 14.0192 15.7511 12.0465 16.4272Z" stroke="#006DF9" stroke-width="1.5"/><mask id="path-2-inside-1_5340_6223" fill="white"><path d="M6.5 16.7881C4 15.5381 2.25 13.0381 2.25 10.0381C2.25 5.91309 5.625 2.53809 9.75 2.53809C12.75 2.53809 15.375 4.28809 16.625 6.91309"/></mask><path d="M7.17082 15.4464C5.13224 14.4272 3.75 12.4195 3.75 10.0381H0.75C0.75 13.6567 2.86776 16.649 5.82918 18.1297L7.17082 15.4464ZM3.75 10.0381C3.75 6.74151 6.45343 4.03809 9.75 4.03809V1.03809C4.79657 1.03809 0.75 5.08466 0.75 10.0381H3.75ZM9.75 4.03809C12.1492 4.03809 14.2597 5.43496 15.2707 7.55799L17.9793 6.26819C16.4903 3.14122 13.3508 1.03809 9.75 1.03809V4.03809Z" fill="#006DF9" mask="url(#path-2-inside-1_5340_6223)"/><mask id="path-4-inside-2_5340_6223" fill="white"><path d="M13.5 3.53811C15.5 2.28811 17.125 1.91311 17.75 2.53811C18.875 3.66311 16.375 8.16311 12.125 12.4131C7.87503 16.6631 3.37502 19.2881 2.25002 18.0381C1.62502 17.4131 2.00002 15.7881 3.25002 13.7881"/></mask><path d="M2.25002 18.0381L3.36497 17.0347L3.33858 17.0053L3.31068 16.9774L2.25002 18.0381ZM14.295 4.81011C15.2151 4.23508 15.9651 3.91661 16.4825 3.79552C17.1067 3.64943 16.9599 3.86931 16.6894 3.59877L18.8107 1.47745C17.9151 0.581912 16.6434 0.676791 15.7988 0.874453C14.8475 1.09711 13.785 1.59114 12.705 2.26611L14.295 4.81011ZM16.6894 3.59877C16.3947 3.30413 16.5976 3.09549 16.4786 3.63498C16.3813 4.07621 16.1197 4.72987 15.6473 5.56565C14.7132 7.21826 13.1173 9.29954 11.0644 11.3524L13.1857 13.4738C15.3828 11.2767 17.1618 8.98296 18.259 7.04182C18.8022 6.08072 19.2203 5.13282 19.4082 4.28108C19.5744 3.52761 19.6678 2.33459 18.8107 1.47745L16.6894 3.59877ZM11.0644 11.3524C9.00506 13.4118 6.92123 15.0389 5.26901 15.9871C4.43197 16.4675 3.78688 16.7263 3.35959 16.8167C2.8532 16.9238 3.08636 16.7251 3.36497 17.0347L1.13508 19.0416C1.97619 19.9761 3.19373 19.9181 3.9803 19.7517C4.84598 19.5687 5.80245 19.1399 6.76229 18.5891C8.70382 17.4748 10.995 15.6645 13.1857 13.4738L11.0644 11.3524ZM3.31068 16.9774C3.58122 17.248 3.36134 17.3948 3.50743 16.7706C3.62852 16.2532 3.947 15.5031 4.52202 14.5831L1.97803 12.9931C1.30305 14.0731 0.809027 15.1355 0.586367 16.0869C0.388705 16.9315 0.293826 18.2032 1.18936 19.0988L3.31068 16.9774Z" fill="#006DF9" mask="url(#path-4-inside-2_5340_6223)"/></svg>`

type uri = {
uri: string,
Expand Down Expand Up @@ -96,6 +97,7 @@ let make = (
| "checkboxclicked" => checkboxclicked
| "checkboxnotclicked" => checkboxnotclicked
| "open banking" => openBanking
| "bank debit" => achBankDebit
| _ => ""
}
localName == ""
Expand Down
Loading