Skip to content

Commit

Permalink
feat: normal mandate changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritish Budhiraja committed Apr 19, 2024
1 parent 63a54aa commit 1b748a8
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 39 deletions.
8 changes: 4 additions & 4 deletions Hyperswitch-React-Demo-App/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
STATIC_DIR=./dist
HYPERSWITCH_PUBLISHABLE_KEY=
HYPERSWITCH_SECRET_KEY=
HYPERSWITCH_SERVER_URL=
HYPERSWITCH_CLIENT_URL=
HYPERSWITCH_PUBLISHABLE_KEY="pk_snd_3b33cd9404234113804aa1accaabe22f"
HYPERSWITCH_SECRET_KEY="snd_c691ade6995743bd88c166ba509ff5da"
HYPERSWITCH_SERVER_URL="https://sandbox.hyperswitch.io"
HYPERSWITCH_CLIENT_URL="http://localhost:9050"

17 changes: 13 additions & 4 deletions Hyperswitch-React-Demo-App/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ app.get("/create-payment-intent", async (req, res) => {
try {
var paymentIntent;
const request = {
currency: "USD",
amount: 2999,
currency: "EUR",
amount: 0,
order_details: [
{
product_name: "Apple iphone 15",
Expand All @@ -60,7 +60,16 @@ app.get("/create-payment-intent", async (req, res) => {
customer_id: "hyperswitch_sdk_demo_id",
email: "[email protected]",
description: "Hello this is description",
// allowed_payment_method_types:["sofort"],
profile_id: "pro_E6k4XxWE3fVzTIYDMzJa",
setup_future_usage: "off_session",
// mandate_data: {
// mandate_type: {
// single_use: {
// amount: 4000,
// currency: "USD",
// },
// },
// },
shipping: {
address: {
state: "zsaasdas",
Expand Down Expand Up @@ -96,7 +105,7 @@ app.get("/create-payment-intent", async (req, res) => {
city: "San Fransico",
state: "California",
zip: "94122",
country: "US",
country: "PT",
first_name: "joseph",
last_name: "Doe",
},
Expand Down
19 changes: 17 additions & 2 deletions Hyperswitch-React-Demo-App/src/CheckoutForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PaymentElement } from "@juspay-tech/react-hyper-js";
import Cart from "./Cart";
import { useState, useEffect } from "react";
import { useHyper, useElements } from "@juspay-tech/react-hyper-js";
import { useHyper, useWidgets } from "@juspay-tech/react-hyper-js";
import { useNavigate } from "react-router-dom";
import "./App.css";
import "./index";
Expand All @@ -10,7 +10,7 @@ import Completion from "./Completion";

export default function CheckoutForm() {
const hyper = useHyper();
const elements = useElements();
const elements = useWidgets();
const navigate = useNavigate();
const [isSuccess, setSucces] = useState(false);

Expand Down Expand Up @@ -104,6 +104,21 @@ export default function CheckoutForm() {
height: 55,
},
},
// displaySavedPaymentMethodsCheckbox: false,
// displaySavedPaymentMethods: true,
// paymentMethodsHeaderText: "1ssttttt csdnjdnjcnsdjcds",
// savedPaymentMethodsHeaderText: "Saveddd",
business: {
name: "dscsndjkndsjnsc",
},
showCardFormByDefault: false,
sdkHandleConfirmPayment: {
handleConfirm: true,
buttonText: "SDK Pay Now",
confirmParams: {
return_url: "http://localhost:9060/",
},
},
};

return (
Expand Down
1 change: 1 addition & 0 deletions Hyperswitch-React-Demo-App/src/Payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function Payment() {
clientSecret,
appearance: {
labels: "floating",
theme: "brutal",
},
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/SavedMethods.res
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ let make = (
useSubmitPaymentData(submitCallback)

let conditionsForShowingSaveCardCheckbox = React.useMemo(() => {
!isGuestCustomer && list.payment_type !== SETUP_MANDATE && displaySavedPaymentMethodsCheckbox
!isGuestCustomer && list.payment_type === NEW_MANDATE && displaySavedPaymentMethodsCheckbox
}, (isGuestCustomer, list.payment_type, displaySavedPaymentMethodsCheckbox))

<div className="flex flex-col overflow-auto h-auto no-scrollbar animate-slowShow">
Expand Down
57 changes: 29 additions & 28 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,23 @@ module.exports = (publicPath = "auto") => {
clean: true,
publicPath: `${repoPublicPath}/`,
},
optimization: {
sideEffects: true,
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: false,
},
},
}),
// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
// `...`,
// new CssMinimizerPlugin(),
],
},
// TODO - Can be commented
// optimization: {
// sideEffects: true,
// minimize: true,
// minimizer: [
// new TerserPlugin({
// terserOptions: {
// compress: {
// drop_console: false,
// },
// },
// }),
// // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
// // `...`,
// // new CssMinimizerPlugin(),
// ],
// },
plugins: [
new MiniCssExtractPlugin(),
new CopyPlugin({
Expand Down Expand Up @@ -155,18 +156,18 @@ module.exports = (publicPath = "auto") => {
// new webpack.HTMLInjectPlugin({
// publicPath: JSON.stringify(repoVersion),
// }),
sentryWebpackPlugin({
org: "sentry",
project: "hyperswitch-react-sdk",
authToken: process.env.SENTRY_AUTH_TOKEN,
url: process.env.SENTRY_URL,
release: {
name: "0.2",
uploadLegacySourcemaps: {
paths: ["dist"],
},
},
}),
// sentryWebpackPlugin({
// org: "sentry",
// project: "hyperswitch-react-sdk",
// authToken: process.env.SENTRY_AUTH_TOKEN,
// url: process.env.SENTRY_URL,
// release: {
// name: "0.2",
// uploadLegacySourcemaps: {
// paths: ["dist"],
// },
// },
// }),
],
module: {
rules: [
Expand Down

0 comments on commit 1b748a8

Please sign in to comment.