@sikka/hawa 0.0.94 → 0.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/styles.css +279 -211
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +18 -6
- package/rollup.config.js +14 -2
- package/src/blocks/Account/{UserProfileForm.js → UserProfileForm.tsx} +42 -41
- package/src/blocks/Account/UserSettingsForm.tsx +28 -0
- package/src/blocks/Account/index.ts +2 -0
- package/src/blocks/AuthForms/AppLanding.tsx +33 -0
- package/src/blocks/AuthForms/CodeConfirmation.tsx +59 -0
- package/src/blocks/AuthForms/{NewPasswordForm.js → NewPasswordForm.tsx} +49 -53
- package/src/blocks/AuthForms/{ResetPasswordForm.js → ResetPasswordForm.tsx} +35 -38
- package/src/blocks/AuthForms/{SignInForm.js → SignInForm.tsx} +73 -65
- package/src/blocks/AuthForms/SignInPhone.tsx +68 -0
- package/src/blocks/AuthForms/{SignUpForm.js → SignUpForm.tsx} +88 -82
- package/src/blocks/AuthForms/index.ts +7 -0
- package/src/blocks/Misc/NotFound.tsx +28 -0
- package/src/blocks/Misc/index.ts +1 -0
- package/src/blocks/Payment/ChargeWalletForm.tsx +70 -0
- package/src/blocks/Payment/{CheckoutForm.js → CheckoutForm.tsx} +82 -81
- package/src/blocks/Payment/Confirmation.tsx +96 -0
- package/src/blocks/Payment/{CreditCardForm.js → CreditCardForm.tsx} +48 -33
- package/src/blocks/Payment/PayWithWallet.tsx +29 -0
- package/src/blocks/Payment/{SelectPayment.js → SelectPayment.tsx} +33 -29
- package/src/blocks/Payment/{index.js → index.ts} +0 -0
- package/src/blocks/Pricing/{ComparingPlans.js → ComparingPlans.tsx} +51 -53
- package/src/blocks/Pricing/PricingPlans.tsx +72 -0
- package/src/blocks/Pricing/{index.js → index.ts} +0 -0
- package/src/blocks/{index.js → index.ts} +0 -0
- package/{countries.js → src/countries.ts} +245 -245
- package/src/elements/{AutoCompleteField.js → AutoCompleteField.tsx} +16 -9
- package/src/elements/{DragDropImages.js → DragDropImages.tsx} +78 -53
- package/src/elements/DraggableCard.tsx +29 -0
- package/src/elements/{HawaAccordian.js → HawaAccordian.tsx} +27 -23
- package/src/elements/HawaAdCard.tsx +48 -0
- package/src/elements/HawaAlert.tsx +30 -0
- package/src/elements/HawaButton.tsx +120 -0
- package/src/elements/HawaCheckbox.tsx +37 -0
- package/src/elements/HawaChip.tsx +12 -0
- package/src/elements/HawaColorPicker.tsx +38 -0
- package/src/elements/{HawaCopyrights.js → HawaCopyrights.tsx} +15 -8
- package/src/elements/HawaDrawer.tsx +84 -0
- package/src/elements/{HawaDrawerItem.js → HawaDrawerItem.tsx} +12 -7
- package/src/elements/{HawaItemCard.js → HawaItemCard.tsx} +35 -36
- package/src/elements/{HawaLogoButton.js → HawaLogoButton.tsx} +52 -56
- package/src/elements/HawaMenu.tsx +75 -0
- package/src/elements/{HawaModal.js → HawaModal.tsx} +30 -21
- package/src/elements/{HawaPanelTabs.js → HawaPanelTabs.tsx} +27 -27
- package/src/elements/HawaPhoneInput.tsx +112 -0
- package/src/elements/{HawaPricingCard.js → HawaPricingCard.tsx} +86 -47
- package/src/elements/HawaRadio.tsx +34 -0
- package/src/elements/HawaRange.tsx +47 -0
- package/src/elements/HawaSearchBar.tsx +9 -0
- package/src/elements/{HawaSelect.js → HawaSelect.tsx} +74 -31
- package/src/elements/HawaSettingsRow.tsx +56 -0
- package/src/elements/HawaSnackbar.tsx +73 -0
- package/src/elements/HawaSwitch.tsx +25 -0
- package/src/elements/{HawaTable.js → HawaTable.tsx} +33 -31
- package/src/elements/{HawaTabs.js → HawaTabs.tsx} +17 -12
- package/src/elements/HawaTextField.tsx +71 -0
- package/src/elements/HawaTooltip.tsx +35 -0
- package/src/elements/HawaTypography.tsx +11 -0
- package/src/elements/{TabPanel.js → TabPanel.tsx} +10 -5
- package/src/elements/{index.js → index.ts} +7 -4
- package/src/index.ts +3 -0
- package/src/layout/Box.tsx +5 -0
- package/src/layout/HawaBottomAppBar.tsx +54 -0
- package/src/layout/HawaContainer.tsx +24 -0
- package/src/layout/{HawaLayout.js → HawaLayout.tsx} +54 -49
- package/src/layout/{index.js → index.ts} +0 -0
- package/src/styles.css +279 -211
- package/src/{util.js → util.ts} +0 -0
- package/storybook-static/229.a3257e00.iframe.bundle.js +1 -0
- package/storybook-static/229.d6fb4f8f665962cef844.manager.bundle.js +1 -0
- package/storybook-static/295.67c251ec00675ab59b60.manager.bundle.js +1 -0
- package/storybook-static/51.786e9bbba427ee454dc0.manager.bundle.js +2 -0
- package/storybook-static/{0.1104ca18.iframe.bundle.js.LICENSE.txt → 51.786e9bbba427ee454dc0.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/51.acbbdb95.iframe.bundle.js +2 -0
- package/storybook-static/{0.cf71f8aa82edef0a7186.manager.bundle.js.LICENSE.txt → 51.acbbdb95.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/551.67cd309b0648b0a52636.manager.bundle.js +1 -0
- package/storybook-static/551.c82ea8f1.iframe.bundle.js +1 -0
- package/storybook-static/701.bcf1e718.iframe.bundle.js +1 -0
- package/storybook-static/733.8d2de9f8.iframe.bundle.js +2 -0
- package/storybook-static/{vendors~main.30019f92.iframe.bundle.js.LICENSE.txt → 733.8d2de9f8.iframe.bundle.js.LICENSE.txt} +0 -10
- package/storybook-static/767.2f9c96fa3338c8d16078.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.d13ba71108048897ea4a.manager.bundle.js.LICENSE.txt → 767.2f9c96fa3338c8d16078.manager.bundle.js.LICENSE.txt} +0 -10
- package/storybook-static/807.14b8bfa7.iframe.bundle.js +2 -0
- package/storybook-static/{5.5b799f3fbf64cec8e51a.manager.bundle.js.LICENSE.txt → 807.14b8bfa7.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/807.4f52b2d047c5e8c5872f.manager.bundle.js +2 -0
- package/storybook-static/{6.6023eba1.iframe.bundle.js.LICENSE.txt → 807.4f52b2d047c5e8c5872f.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/897.386c170cbd1467abc7ca.manager.bundle.js +2 -0
- package/storybook-static/{8.f9b98ef3e089be1a16d6.manager.bundle.js.LICENSE.txt → 897.386c170cbd1467abc7ca.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/897.d9a35fd0.iframe.bundle.js +2 -0
- package/storybook-static/{9.63a5cf7a.iframe.bundle.js.LICENSE.txt → 897.d9a35fd0.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/935.07c1b6ea.iframe.bundle.js +1 -0
- package/storybook-static/935.0b4e9c201c33f3e66e81.manager.bundle.js +1 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/main.051275cac7b0dc69501c.manager.bundle.js +1 -0
- package/storybook-static/main.71507dcb.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/runtime~main.25eae181fe0f96887a15.manager.bundle.js +1 -0
- package/storybook-static/runtime~main.4d0bf318.iframe.bundle.js +1 -0
- package/tailwind.config.js +16 -1
- package/tsconfig.json +25 -0
- package/src/blocks/Account/UserSettingsForm.js +0 -17
- package/src/blocks/Account/index.js +0 -2
- package/src/blocks/AuthForms/AppLanding.js +0 -40
- package/src/blocks/AuthForms/CodeConfirmation.js +0 -78
- package/src/blocks/AuthForms/SignInPhone.js +0 -38
- package/src/blocks/AuthForms/index.js +0 -7
- package/src/blocks/Misc/NotFound.js +0 -32
- package/src/blocks/Misc/index.js +0 -1
- package/src/blocks/Payment/ChargeWalletForm.js +0 -81
- package/src/blocks/Payment/Confirmation.js +0 -104
- package/src/blocks/Payment/Form/CForm.js +0 -316
- package/src/blocks/Payment/Form/Card.js +0 -242
- package/src/blocks/Payment/Form/PaymentMethod.js +0 -118
- package/src/blocks/Payment/Gateway/GooglePay.js +0 -251
- package/src/blocks/Payment/Gateway/Payfort.js +0 -90
- package/src/blocks/Payment/Gateway/Paypal.js +0 -138
- package/src/blocks/Payment/Gateway/Wallet.js +0 -148
- package/src/blocks/Payment/PayWithWallet.js +0 -20
- package/src/blocks/Pricing/PricingPlans.js +0 -88
- package/src/elements/DraggableCard.js +0 -24
- package/src/elements/HawaAlert.js +0 -41
- package/src/elements/HawaButton.js +0 -62
- package/src/elements/HawaCheckbox.js +0 -28
- package/src/elements/HawaChip.js +0 -9
- package/src/elements/HawaColorPicker.js +0 -57
- package/src/elements/HawaDrawer.js +0 -68
- package/src/elements/HawaMenu.js +0 -59
- package/src/elements/HawaPhoneInput.js +0 -106
- package/src/elements/HawaRadio.js +0 -31
- package/src/elements/HawaRange.js +0 -54
- package/src/elements/HawaSearchBar.js +0 -15
- package/src/elements/HawaSettingsRow.js +0 -34
- package/src/elements/HawaSnackbar.js +0 -44
- package/src/elements/HawaSwitch.js +0 -21
- package/src/elements/HawaTextField.js +0 -34
- package/src/elements/HawaTooltip.js +0 -19
- package/src/elements/HawaTypography.js +0 -5
- package/src/elements/PinInput.js +0 -141
- package/src/elements/SelectedField.js +0 -46
- package/src/index.js +0 -3
- package/src/layout/Box.js +0 -5
- package/src/layout/HawaAppLayout.js +0 -245
- package/src/layout/HawaAppLayout2.js +0 -254
- package/src/layout/HawaBottomAppBar.js +0 -76
- package/src/layout/HawaContainer.js +0 -8
- package/storybook-static/0.1104ca18.iframe.bundle.js +0 -3
- package/storybook-static/0.1104ca18.iframe.bundle.js.map +0 -1
- package/storybook-static/0.cf71f8aa82edef0a7186.manager.bundle.js +0 -2
- package/storybook-static/1.7e6ec5c45ae5b70c5149.manager.bundle.js +0 -1
- package/storybook-static/1.e3eafd38.iframe.bundle.js +0 -1
- package/storybook-static/2.3841b1a5.iframe.bundle.js +0 -1
- package/storybook-static/5.5b799f3fbf64cec8e51a.manager.bundle.js +0 -2
- package/storybook-static/6.6023eba1.iframe.bundle.js +0 -3
- package/storybook-static/6.6023eba1.iframe.bundle.js.map +0 -1
- package/storybook-static/6.b34ce31193a7fa1dd965.manager.bundle.js +0 -1
- package/storybook-static/7.632f8551.iframe.bundle.js +0 -1
- package/storybook-static/7.72879af713f755a7aa7e.manager.bundle.js +0 -1
- package/storybook-static/8.9a8f8b69.iframe.bundle.js +0 -1
- package/storybook-static/8.f9b98ef3e089be1a16d6.manager.bundle.js +0 -2
- package/storybook-static/9.1e1335092fade49cc986.manager.bundle.js +0 -1
- package/storybook-static/9.63a5cf7a.iframe.bundle.js +0 -3
- package/storybook-static/9.63a5cf7a.iframe.bundle.js.map +0 -1
- package/storybook-static/main.4bd27e4e7faa098302d1.manager.bundle.js +0 -1
- package/storybook-static/main.c9ced472.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.67ec6e92.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.a58df7ba92d01c5088d3.manager.bundle.js +0 -1
- package/storybook-static/vendors~main.30019f92.iframe.bundle.js +0 -3
- package/storybook-static/vendors~main.30019f92.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.d13ba71108048897ea4a.manager.bundle.js +0 -2
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import qs from "qs";
|
|
3
|
-
import { useRouter } from "next/router";
|
|
4
|
-
import { useState, useEffect } from "react";
|
|
5
|
-
import useTranslation from "next-translate/useTranslation";
|
|
6
|
-
import Script from "next/script";
|
|
7
|
-
|
|
8
|
-
const GooglePay = (props) => {
|
|
9
|
-
const transaction = props.currenttransactiongpay;
|
|
10
|
-
const router = useRouter();
|
|
11
|
-
console.log("transaction=", transaction);
|
|
12
|
-
const { t, lang } = useTranslation("common");
|
|
13
|
-
const [googlepayloaded, setGooglePayLoaded] = useState(false);
|
|
14
|
-
const [googlepay, setGooglePay] = useState(false);
|
|
15
|
-
const [braintreegatewayclient, setBraintreeGatewayClient] = useState(false);
|
|
16
|
-
const [braintreegatewaygooglepayment, setBraintreeGatewayGooglePayment] =
|
|
17
|
-
useState(false);
|
|
18
|
-
const [braintreegatewaydatacollector, setBraintreeGatewayDataCollector] =
|
|
19
|
-
useState(false);
|
|
20
|
-
|
|
21
|
-
let paymentsClient;
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (
|
|
25
|
-
!googlepayloaded &&
|
|
26
|
-
googlepay &&
|
|
27
|
-
braintreegatewaydatacollector &&
|
|
28
|
-
braintreegatewayclient &&
|
|
29
|
-
braintreegatewaygooglepayment
|
|
30
|
-
) {
|
|
31
|
-
console.log("okkkk");
|
|
32
|
-
onGooglePayLoaded();
|
|
33
|
-
}
|
|
34
|
-
}, [
|
|
35
|
-
googlepay,
|
|
36
|
-
braintreegatewayclient,
|
|
37
|
-
braintreegatewaygooglepayment,
|
|
38
|
-
braintreegatewaydatacollector,
|
|
39
|
-
googlepayloaded
|
|
40
|
-
]);
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Add a Google Pay purchase button alongside an existing checkout button
|
|
44
|
-
*
|
|
45
|
-
* @see {@link https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions|Button options}
|
|
46
|
-
* @see {@link https://developers.google.com/pay/api/web/guides/brand-guidelines|Google Pay brand guidelines}
|
|
47
|
-
*/
|
|
48
|
-
const addGooglePayButton = (googlePaymentInstance, clientInstance) => {
|
|
49
|
-
//ok
|
|
50
|
-
const button = paymentsClient.createButton({
|
|
51
|
-
onClick: (event) =>
|
|
52
|
-
onGooglePaymentButtonClicked(
|
|
53
|
-
event,
|
|
54
|
-
googlePaymentInstance,
|
|
55
|
-
clientInstance
|
|
56
|
-
),
|
|
57
|
-
buttonLocale: lang
|
|
58
|
-
});
|
|
59
|
-
document.getElementById("qawaim-googlepay").appendChild(button);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Show Google Pay payment sheet when Google Pay payment button is clicked
|
|
64
|
-
*/
|
|
65
|
-
const onGooglePaymentButtonClicked = (
|
|
66
|
-
event,
|
|
67
|
-
googlePaymentInstance,
|
|
68
|
-
clientInstance
|
|
69
|
-
) => {
|
|
70
|
-
let paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
71
|
-
merchantInfo: {
|
|
72
|
-
// @todo a merchant ID is available for a production environment after approval by Google
|
|
73
|
-
// See {@link https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist|Integration checklist}
|
|
74
|
-
merchantId: `${process.env.NEXT_PUBLIC_QAWAIM_GOOGLE_MERCHANT_ID}`,
|
|
75
|
-
merchantName: `${process.env.NEXT_PUBLIC_QAWAIM_GOOGLEPAY_MERCHANT_NAME}`
|
|
76
|
-
},
|
|
77
|
-
transactionInfo: {
|
|
78
|
-
displayItems: [
|
|
79
|
-
{
|
|
80
|
-
label: "Subtotal",
|
|
81
|
-
type: "SUBTOTAL",
|
|
82
|
-
price: `${transaction.amount}`
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
currencyCode: `${transaction.currency}`,
|
|
86
|
-
totalPriceStatus: "FINAL",
|
|
87
|
-
totalPrice: `${transaction.amount}`,
|
|
88
|
-
totalPriceLabel: "Total"
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// We recommend collecting billing address information, at minimum
|
|
93
|
-
// billing postal code, and passing that billing postal code with all
|
|
94
|
-
// Google Pay card transactions as a best practice.
|
|
95
|
-
// See all available options at https://developers.google.com/pay/api/web/reference/object
|
|
96
|
-
let cardPaymentMethod = paymentDataRequest.allowedPaymentMethods[0];
|
|
97
|
-
cardPaymentMethod.parameters.billingAddressRequired = true;
|
|
98
|
-
cardPaymentMethod.parameters.billingAddressParameters = {
|
|
99
|
-
format: "FULL",
|
|
100
|
-
phoneNumberRequired: true
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
paymentsClient
|
|
104
|
-
.loadPaymentData(paymentDataRequest)
|
|
105
|
-
.then(function (paymentData) {
|
|
106
|
-
googlePaymentInstance.parseResponse(
|
|
107
|
-
paymentData,
|
|
108
|
-
function (err, result) {
|
|
109
|
-
if (err) {
|
|
110
|
-
console.log(err);
|
|
111
|
-
// Handle parsing error
|
|
112
|
-
router.push("/payment/error");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Send result.nonce to your server
|
|
116
|
-
// result.type may be either "AndroidPayCard" or "PayPalAccount", and
|
|
117
|
-
// paymentData will contain the billingAddress for card payments
|
|
118
|
-
braintree.dataCollector.create(
|
|
119
|
-
{
|
|
120
|
-
client: clientInstance
|
|
121
|
-
},
|
|
122
|
-
async function (err, dataCollectorInstance) {
|
|
123
|
-
if (err) {
|
|
124
|
-
// Handle error in creation of data collector
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
// At this point, you should access the dataCollectorInstance.deviceData value and provide it
|
|
128
|
-
// to your server, e.g. by injecting it into your form as a hidden input.
|
|
129
|
-
let deviceData = dataCollectorInstance.deviceData;
|
|
130
|
-
const data = {
|
|
131
|
-
deviceDataClient: deviceData,
|
|
132
|
-
nonce: result.nonce,
|
|
133
|
-
billing_address: transaction.billing_address,
|
|
134
|
-
amount: `${transaction.amount}`,
|
|
135
|
-
currency: token.SelectedCurrency?.toUpperCase(),
|
|
136
|
-
transaction_id: `${transaction._id}`
|
|
137
|
-
};
|
|
138
|
-
let checkoutgpay = await axios.post(
|
|
139
|
-
`${process.env.NEXT_PUBLIC_QAWAIM_API_URL}/braintreegateway/googlepay`,
|
|
140
|
-
qs.stringify(data)
|
|
141
|
-
);
|
|
142
|
-
if (checkoutgpay.data.ok === true) {
|
|
143
|
-
router.push(`/confirmation/${transaction._id}`);
|
|
144
|
-
//setCurrentTransaction(checkoutInfo.data.data.transaction);
|
|
145
|
-
router.push(
|
|
146
|
-
`/confirmation/${checkoutgpay.data.data.transaction._id}`
|
|
147
|
-
);
|
|
148
|
-
} else {
|
|
149
|
-
router.push("/payment/error");
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
})
|
|
156
|
-
.catch(function (err) {
|
|
157
|
-
console.log(err);
|
|
158
|
-
router.push("/payment/error");
|
|
159
|
-
// Handle errors
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const onGooglePayLoaded = () => {
|
|
164
|
-
// Make sure to have https://pay.google.com/gp/p/js/pay.js loaded on your page
|
|
165
|
-
// You will need a button element on your page styled according to Google's brand guidelines
|
|
166
|
-
// https://developers.google.com/pay/api/web/guides/brand-guidelines
|
|
167
|
-
paymentsClient = new google.payments.api.PaymentsClient({
|
|
168
|
-
environment: process.env.NEXT_PUBLIC_QAWAIM_GOOGLEPAY_ENVIRONMENT // 'TEST' Or 'PRODUCTION'
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
setGooglePayLoaded(true);
|
|
172
|
-
|
|
173
|
-
braintree.client.create(
|
|
174
|
-
{
|
|
175
|
-
authorization: `${process.env.NEXT_PUBLIC_QAWAIM_BRAINTREE_TOKENIZATION_KEY}`
|
|
176
|
-
},
|
|
177
|
-
function (clientErr, clientInstance) {
|
|
178
|
-
console.log("clientErr=", clientErr);
|
|
179
|
-
console.log("clientInstance=", clientInstance);
|
|
180
|
-
braintree.googlePayment.create(
|
|
181
|
-
{
|
|
182
|
-
client: clientInstance,
|
|
183
|
-
googlePayVersion: 2,
|
|
184
|
-
googleMerchantId: `${process.env.NEXT_PUBLIC_QAWAIM_GOOGLE_MERCHANT_ID}` // Optional in sandbox; if set in sandbox, this value must be a valid production Google Merchant ID
|
|
185
|
-
},
|
|
186
|
-
function (googlePaymentErr, googlePaymentInstance) {
|
|
187
|
-
console.log("googlePaymentErr=", googlePaymentErr);
|
|
188
|
-
console.log("googlePaymentInstance=", googlePaymentInstance);
|
|
189
|
-
paymentsClient
|
|
190
|
-
.isReadyToPay({
|
|
191
|
-
// see https://developers.google.com/pay/api/web/reference/object#IsReadyToPayRequest
|
|
192
|
-
apiVersion: 2,
|
|
193
|
-
apiVersionMinor: 0,
|
|
194
|
-
allowedPaymentMethods:
|
|
195
|
-
googlePaymentInstance.createPaymentDataRequest()
|
|
196
|
-
.allowedPaymentMethods,
|
|
197
|
-
existingPaymentMethodRequired: true // Optional
|
|
198
|
-
})
|
|
199
|
-
.then(function (response) {
|
|
200
|
-
if (response.result) {
|
|
201
|
-
addGooglePayButton(googlePaymentInstance, clientInstance);
|
|
202
|
-
}
|
|
203
|
-
})
|
|
204
|
-
.catch(function (err) {
|
|
205
|
-
console.log(err);
|
|
206
|
-
router.push("/payment/error");
|
|
207
|
-
// Handle errors
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
// Set up other Braintree components
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
};
|
|
216
|
-
return (
|
|
217
|
-
<>
|
|
218
|
-
<Script
|
|
219
|
-
id="googlepay"
|
|
220
|
-
src="https://pay.google.com/gp/p/js/pay.js"
|
|
221
|
-
onLoad={() => {
|
|
222
|
-
setGooglePay(true);
|
|
223
|
-
}}
|
|
224
|
-
/>
|
|
225
|
-
<Script
|
|
226
|
-
id="braintreegateway-client"
|
|
227
|
-
src="https://js.braintreegateway.com/web/3.82.0/js/client.min.js"
|
|
228
|
-
onLoad={() => {
|
|
229
|
-
setBraintreeGatewayClient(true);
|
|
230
|
-
}}
|
|
231
|
-
/>
|
|
232
|
-
<Script
|
|
233
|
-
id="braintreegateway-data-collector"
|
|
234
|
-
src="https://js.braintreegateway.com/web/3.82.0/js/data-collector.min.js"
|
|
235
|
-
onLoad={() => {
|
|
236
|
-
setBraintreeGatewayDataCollector(true);
|
|
237
|
-
}}
|
|
238
|
-
/>
|
|
239
|
-
<Script
|
|
240
|
-
id="braintreegateway-google-payment"
|
|
241
|
-
src="https://js.braintreegateway.com/web/3.82.0/js/google-payment.min.js"
|
|
242
|
-
onLoad={() => {
|
|
243
|
-
setBraintreeGatewayGooglePayment(true);
|
|
244
|
-
}}
|
|
245
|
-
/>
|
|
246
|
-
<div id="qawaim-googlepay"></div>
|
|
247
|
-
</>
|
|
248
|
-
);
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export default GooglePay;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, memo, useCallback, useRef } from "react";
|
|
2
|
-
import CForm from "../Form/CForm";
|
|
3
|
-
import Card from "../Form/Card";
|
|
4
|
-
|
|
5
|
-
const initialState = {
|
|
6
|
-
cardNumber: "#### #### #### ####",
|
|
7
|
-
cardHolder: "FULL NAME",
|
|
8
|
-
cardMonth: "",
|
|
9
|
-
cardYear: "",
|
|
10
|
-
cardCvv: "",
|
|
11
|
-
isCardFlipped: false
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const Payfort = (props) => {
|
|
15
|
-
const [state, setState] = useState(initialState);
|
|
16
|
-
const [currentFocusedElm, setCurrentFocusedElm] = useState(null);
|
|
17
|
-
|
|
18
|
-
const updateStateValues = useCallback(
|
|
19
|
-
(keyName, value) => {
|
|
20
|
-
setState({
|
|
21
|
-
...state,
|
|
22
|
-
[keyName]: value || initialState[keyName]
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
[state]
|
|
26
|
-
);
|
|
27
|
-
// References for the Form Inputs used to focus corresponding inputs.
|
|
28
|
-
let formFieldsRefObj = {
|
|
29
|
-
cardNumber: useRef(),
|
|
30
|
-
cardHolder: useRef(),
|
|
31
|
-
cardDate: useRef(),
|
|
32
|
-
cardCvv: useRef()
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
let focusFormFieldByKey = useCallback((key) => {
|
|
36
|
-
formFieldsRefObj[key].current.focus();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// This are the references for the Card DIV elements.
|
|
40
|
-
let cardElementsRef = {
|
|
41
|
-
cardNumber: useRef(),
|
|
42
|
-
cardHolder: useRef(),
|
|
43
|
-
cardDate: useRef()
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
let onCardFormInputFocus = (_event, inputName) => {
|
|
47
|
-
const refByName = cardElementsRef[inputName];
|
|
48
|
-
setCurrentFocusedElm(refByName);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
let onCardInputBlur = useCallback(() => {
|
|
52
|
-
setCurrentFocusedElm(null);
|
|
53
|
-
}, []);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<CForm
|
|
57
|
-
cardNumber={state.cardNumber}
|
|
58
|
-
cardHolder={state.cardHolder}
|
|
59
|
-
cardMonth={state.cardMonth}
|
|
60
|
-
cardYear={state.cardYear}
|
|
61
|
-
cardCvv={state.cardCvv}
|
|
62
|
-
onUpdateState={updateStateValues}
|
|
63
|
-
cardNumberRef={formFieldsRefObj.cardNumber}
|
|
64
|
-
cardHolderRef={formFieldsRefObj.cardHolder}
|
|
65
|
-
cardDateRef={formFieldsRefObj.cardDate}
|
|
66
|
-
cardCvvRef={formFieldsRefObj.cardCvv}
|
|
67
|
-
onCardInputFocus={onCardFormInputFocus}
|
|
68
|
-
onCardInputBlur={onCardInputBlur}
|
|
69
|
-
handlePaymentPayfort={props.handlePaymentPayfort}
|
|
70
|
-
paymentMethod={props.paymentMethod}
|
|
71
|
-
register={props.register}
|
|
72
|
-
>
|
|
73
|
-
<Card
|
|
74
|
-
cardNumber={state.cardNumber}
|
|
75
|
-
cardHolder={state.cardHolder}
|
|
76
|
-
cardMonth={state.cardMonth}
|
|
77
|
-
cardYear={state.cardYear}
|
|
78
|
-
cardCvv={state.cardCvv}
|
|
79
|
-
isCardFlipped={state.isCardFlipped}
|
|
80
|
-
currentFocusedElm={currentFocusedElm}
|
|
81
|
-
onCardElementClick={focusFormFieldByKey}
|
|
82
|
-
cardNumberRef={cardElementsRef.cardNumber}
|
|
83
|
-
cardHolderRef={cardElementsRef.cardHolder}
|
|
84
|
-
cardDateRef={cardElementsRef.cardDate}
|
|
85
|
-
></Card>
|
|
86
|
-
</CForm>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export default Payfort;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import qs from "qs";
|
|
4
|
-
import {
|
|
5
|
-
PayPalButtons,
|
|
6
|
-
usePayPalScriptReducer,
|
|
7
|
-
PayPalScriptProvider
|
|
8
|
-
} from "@paypal/react-paypal-js";
|
|
9
|
-
|
|
10
|
-
// This values are the props in the UI
|
|
11
|
-
const currency = "USD";
|
|
12
|
-
const style = {
|
|
13
|
-
layout: "vertical",
|
|
14
|
-
color: "blue",
|
|
15
|
-
shape: "rect",
|
|
16
|
-
label: "paypal"
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Paypal = (props) => {
|
|
20
|
-
return (
|
|
21
|
-
<PayPalScriptProvider
|
|
22
|
-
deferLoading={true}
|
|
23
|
-
options={{
|
|
24
|
-
"client-id": `${process.env.NEXT_PUBLIC_PAYPAL_CLIENT_ID}`,
|
|
25
|
-
locale: lang === "ar" ? "ar_SA" : "en_US"
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<ButtonWrapper
|
|
29
|
-
currency={currency}
|
|
30
|
-
showSpinner={false}
|
|
31
|
-
amount={getFinalPricePaypal(
|
|
32
|
-
invoice.currency?.toLowerCase() == "sar"
|
|
33
|
-
? invoice.invoice_discount
|
|
34
|
-
: invoice.invoice_discount_usd
|
|
35
|
-
)}
|
|
36
|
-
lang={lang}
|
|
37
|
-
invoiceObject={invoiceObject}
|
|
38
|
-
router={router}
|
|
39
|
-
/>
|
|
40
|
-
</PayPalScriptProvider>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Custom component to wrap the PayPalButtons and handle currency changes
|
|
45
|
-
const ButtonWrapper = ({
|
|
46
|
-
amount,
|
|
47
|
-
currency,
|
|
48
|
-
showSpinner,
|
|
49
|
-
lang,
|
|
50
|
-
invoiceObject,
|
|
51
|
-
router
|
|
52
|
-
}) => {
|
|
53
|
-
// usePayPalScriptReducer can be use only inside children of PayPalScriptProviders
|
|
54
|
-
// This is the main reason to wrap the PayPalButtons in a new component
|
|
55
|
-
const [{ options, isPending }, dispatch] = usePayPalScriptReducer();
|
|
56
|
-
console.log("amount=", amount);
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
dispatch({
|
|
59
|
-
type: "resetOptions",
|
|
60
|
-
value: {
|
|
61
|
-
...options,
|
|
62
|
-
currency: currency
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}, [currency, showSpinner]);
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<div
|
|
69
|
-
style={{
|
|
70
|
-
padding: "10px",
|
|
71
|
-
marginTop: "10px",
|
|
72
|
-
fontSize: "17px",
|
|
73
|
-
width: "100%"
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
{showSpinner && isPending && <div className="spinner" />}
|
|
77
|
-
<PayPalButtons
|
|
78
|
-
style={style}
|
|
79
|
-
disabled={false}
|
|
80
|
-
//forceReRender={[amount, currency, style]}
|
|
81
|
-
fundingSource={undefined}
|
|
82
|
-
createOrder={(data, actions) => {
|
|
83
|
-
console.log("lang=", amount);
|
|
84
|
-
return actions.order
|
|
85
|
-
.create({
|
|
86
|
-
purchase_units: [
|
|
87
|
-
{
|
|
88
|
-
amount: {
|
|
89
|
-
currency_code: currency,
|
|
90
|
-
value: amount
|
|
91
|
-
},
|
|
92
|
-
reference_id: invoiceObject._id
|
|
93
|
-
/*items: [
|
|
94
|
-
name: ,
|
|
95
|
-
unit_amount: ,
|
|
96
|
-
tax: ,
|
|
97
|
-
quantity: ,
|
|
98
|
-
description: ,
|
|
99
|
-
]*/
|
|
100
|
-
}
|
|
101
|
-
],
|
|
102
|
-
application_context: {
|
|
103
|
-
locale: lang === "ar" ? "ar-SA" : "en-US"
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
.then((orderId) => {
|
|
107
|
-
// Your code here after create the order
|
|
108
|
-
return orderId;
|
|
109
|
-
});
|
|
110
|
-
}}
|
|
111
|
-
onApprove={async function (data, actions) {
|
|
112
|
-
return actions.order.capture().then(async function (details) {
|
|
113
|
-
console.log("data=", details);
|
|
114
|
-
details["language"] = lang;
|
|
115
|
-
let checkoutInfo = await axios.post(
|
|
116
|
-
`${process.env.NEXT_PUBLIC_SIKKA_API_URL}/paypal/payment/finalize`,
|
|
117
|
-
qs.stringify(details)
|
|
118
|
-
);
|
|
119
|
-
if (checkoutInfo.data?.ok === true) {
|
|
120
|
-
router.push({
|
|
121
|
-
pathname: "/confirmation/" + checkoutInfo.data.transaction._id
|
|
122
|
-
});
|
|
123
|
-
} else {
|
|
124
|
-
router.push({
|
|
125
|
-
pathname: "/payment/error/" + props.data.merchant_reference,
|
|
126
|
-
query: {
|
|
127
|
-
code: 74
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}}
|
|
133
|
-
/>
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export default Paypal;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// import useTranslation from "next-translate/useTranslation";
|
|
2
|
-
// import Grid from "@mui/material/Grid";
|
|
3
|
-
// import Paper from "@mui/material/Paper";
|
|
4
|
-
// import CircularProgress from "@mui/material/CircularProgress";
|
|
5
|
-
// import { makeStyles } from "@mui/material/styles";
|
|
6
|
-
|
|
7
|
-
// const useStyles = makeStyles((theme) => ({
|
|
8
|
-
// root: {
|
|
9
|
-
// flexGrow: 1
|
|
10
|
-
// },
|
|
11
|
-
// paper: {
|
|
12
|
-
// padding: theme.spacing(2),
|
|
13
|
-
// textAlign: "center",
|
|
14
|
-
// color: theme.palette.text.secondary
|
|
15
|
-
// }
|
|
16
|
-
// }));
|
|
17
|
-
|
|
18
|
-
// const Wallet = (props) => {
|
|
19
|
-
// const { t } = useTranslation("common");
|
|
20
|
-
// const classes = useStyles();
|
|
21
|
-
// return (
|
|
22
|
-
// <div className="block-pay-content" style={{ padding: 20 }}>
|
|
23
|
-
// <div key="Payment">
|
|
24
|
-
// <>
|
|
25
|
-
// <Grid
|
|
26
|
-
// container
|
|
27
|
-
// spacing={3}
|
|
28
|
-
// alignContent={"center"}
|
|
29
|
-
// alignItems={"center"}
|
|
30
|
-
// style={{ width: "100%", margin: 0 }}
|
|
31
|
-
// >
|
|
32
|
-
// <Grid item xs={4}>
|
|
33
|
-
// <Paper
|
|
34
|
-
// className={classes.paper}
|
|
35
|
-
// style={{
|
|
36
|
-
// boxShadow: "none",
|
|
37
|
-
// fontWeight: "bold"
|
|
38
|
-
// }}
|
|
39
|
-
// >
|
|
40
|
-
// {t("payment-made")} <br />
|
|
41
|
-
// {props.amount} {t(props.SelectedCurrency)}
|
|
42
|
-
// </Paper>
|
|
43
|
-
// </Grid>
|
|
44
|
-
// <Grid
|
|
45
|
-
// item
|
|
46
|
-
// style={{
|
|
47
|
-
// padding: 0,
|
|
48
|
-
// margin: "-5px"
|
|
49
|
-
// }}
|
|
50
|
-
// >
|
|
51
|
-
// <Paper
|
|
52
|
-
// className={classes.paper}
|
|
53
|
-
// style={{
|
|
54
|
-
// backgroundColor: "transparent",
|
|
55
|
-
// boxShadow: "none",
|
|
56
|
-
// fontSize: "18px",
|
|
57
|
-
// fontWeight: "bold",
|
|
58
|
-
// padding: 0
|
|
59
|
-
// }}
|
|
60
|
-
// >
|
|
61
|
-
// -
|
|
62
|
-
// </Paper>
|
|
63
|
-
// </Grid>
|
|
64
|
-
// <Grid item xs={4}>
|
|
65
|
-
// <Paper
|
|
66
|
-
// className={classes.paper}
|
|
67
|
-
// style={{
|
|
68
|
-
// boxShadow: "none",
|
|
69
|
-
// fontWeight: "bold"
|
|
70
|
-
// }}
|
|
71
|
-
// >
|
|
72
|
-
// {t("amount-in-wallet")} <br />
|
|
73
|
-
// {props.total_wallet.toFixed(2)} {t(props.SelectedCurrency)}
|
|
74
|
-
// </Paper>
|
|
75
|
-
// </Grid>
|
|
76
|
-
// <Grid
|
|
77
|
-
// item
|
|
78
|
-
// style={{
|
|
79
|
-
// padding: 0,
|
|
80
|
-
// margin: "-5px"
|
|
81
|
-
// }}
|
|
82
|
-
// >
|
|
83
|
-
// <Paper
|
|
84
|
-
// className={classes.paper}
|
|
85
|
-
// style={{
|
|
86
|
-
// backgroundColor: "transparent",
|
|
87
|
-
// boxShadow: "none",
|
|
88
|
-
// fontSize: "18px",
|
|
89
|
-
// fontWeight: "bold",
|
|
90
|
-
// padding: 0
|
|
91
|
-
// }}
|
|
92
|
-
// >
|
|
93
|
-
// =
|
|
94
|
-
// </Paper>
|
|
95
|
-
// </Grid>
|
|
96
|
-
// <Grid item xs={4}>
|
|
97
|
-
// <Paper
|
|
98
|
-
// className={classes.paper}
|
|
99
|
-
// style={{
|
|
100
|
-
// boxShadow: "none",
|
|
101
|
-
// fontWeight: "bold"
|
|
102
|
-
// }}
|
|
103
|
-
// >
|
|
104
|
-
// {t("left-amount-wallet")} <br />
|
|
105
|
-
// {props.leftAmount.toFixed(2)} {t(props.SelectedCurrency)}
|
|
106
|
-
// </Paper>
|
|
107
|
-
// </Grid>
|
|
108
|
-
// <Grid item xs={12}>
|
|
109
|
-
// <Paper
|
|
110
|
-
// className={classes.paper}
|
|
111
|
-
// style={{
|
|
112
|
-
// boxShadow: "none",
|
|
113
|
-
// fontWeight: "bold"
|
|
114
|
-
// }}
|
|
115
|
-
// >
|
|
116
|
-
// {t("remaining-amount")}: {props.remainingAmount.toFixed(2)}{" "}
|
|
117
|
-
// {t(props.SelectedCurrency)}
|
|
118
|
-
// </Paper>
|
|
119
|
-
// </Grid>
|
|
120
|
-
// {!props.leftAmount && (
|
|
121
|
-
// <Grid item xs={12}>
|
|
122
|
-
// <button
|
|
123
|
-
// variant="contained"
|
|
124
|
-
// color="primary"
|
|
125
|
-
// fullWidth
|
|
126
|
-
// type="submit"
|
|
127
|
-
// onClick={(e) => props.handleWalletPayNow(e)}
|
|
128
|
-
// >
|
|
129
|
-
// {props.loading ? (
|
|
130
|
-
// <CircularProgress
|
|
131
|
-
// variant="indeterminate"
|
|
132
|
-
// style={{ color: "white" }}
|
|
133
|
-
// size={25}
|
|
134
|
-
// />
|
|
135
|
-
// ) : (
|
|
136
|
-
// t("pay-now")
|
|
137
|
-
// )}
|
|
138
|
-
// </button>
|
|
139
|
-
// </Grid>
|
|
140
|
-
// )}
|
|
141
|
-
// </Grid>
|
|
142
|
-
// </>
|
|
143
|
-
// </div>
|
|
144
|
-
// </div>
|
|
145
|
-
// );
|
|
146
|
-
// };
|
|
147
|
-
|
|
148
|
-
// export default Wallet;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { HawaButton } from "../../elements";
|
|
3
|
-
import { HawaContainer } from "../../layout";
|
|
4
|
-
|
|
5
|
-
export const PayWithWallet = (props) => {
|
|
6
|
-
return (
|
|
7
|
-
<HawaContainer>
|
|
8
|
-
<div className="text-5xl font-extrabold text-center">
|
|
9
|
-
{props.walletBalance || "0"}
|
|
10
|
-
<div className="text-sm font-normal">{props.currency || "SAR"}</div>
|
|
11
|
-
</div>
|
|
12
|
-
<HawaButton
|
|
13
|
-
type="submit"
|
|
14
|
-
fullWidth
|
|
15
|
-
onClick={props.handlePayWithWallet}
|
|
16
|
-
text={"Pay Now"}
|
|
17
|
-
/>
|
|
18
|
-
</HawaContainer>
|
|
19
|
-
);
|
|
20
|
-
};
|