paygate-checkout-sdk 1.0.0

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.
Files changed (83) hide show
  1. package/README.md +46 -0
  2. package/dist/App.d.ts +3 -0
  3. package/dist/App.test.d.ts +1 -0
  4. package/dist/assets/icons/AmexIcon.d.ts +3 -0
  5. package/dist/assets/icons/DefaultCardIcon.d.ts +3 -0
  6. package/dist/assets/icons/DiscoverIcon.d.ts +3 -0
  7. package/dist/assets/icons/FaArrowLeftIcon.d.ts +3 -0
  8. package/dist/assets/icons/FaBankCardIcon.d.ts +9 -0
  9. package/dist/assets/icons/FaBankTransferIcon.d.ts +3 -0
  10. package/dist/assets/icons/FaChevronDownIcon.d.ts +3 -0
  11. package/dist/assets/icons/FaCopyIcon.d.ts +3 -0
  12. package/dist/assets/icons/FaInfoIcon.d.ts +3 -0
  13. package/dist/assets/icons/FaLockIcon.d.ts +3 -0
  14. package/dist/assets/icons/FaMobileIcon.d.ts +3 -0
  15. package/dist/assets/icons/FaNQRIcon.d.ts +3 -0
  16. package/dist/assets/icons/FaPaygateIcon.d.ts +3 -0
  17. package/dist/assets/icons/FaQRCodeIcon.d.ts +3 -0
  18. package/dist/assets/icons/FaSuccessicon.d.ts +3 -0
  19. package/dist/assets/icons/FaTimerIcon.d.ts +3 -0
  20. package/dist/assets/icons/FaUssdIcon.d.ts +3 -0
  21. package/dist/assets/icons/MasterCardIcon.d.ts +3 -0
  22. package/dist/assets/icons/VerveIcon.d.ts +3 -0
  23. package/dist/assets/icons/VisaIcon.d.ts +7 -0
  24. package/dist/components/Base.d.ts +8 -0
  25. package/dist/components/Button/StatusBadge.d.ts +2 -0
  26. package/dist/components/Button/Styles.d.ts +5 -0
  27. package/dist/components/Button/index.d.ts +35 -0
  28. package/dist/components/CardPayment.d.ts +3 -0
  29. package/dist/components/CountrySelector.d.ts +7 -0
  30. package/dist/components/FadeLoader/index.d.ts +8 -0
  31. package/dist/components/PaymentMethods.d.ts +8 -0
  32. package/dist/components/Text/Styles.d.ts +3 -0
  33. package/dist/components/Text/index.d.ts +26 -0
  34. package/dist/components/card/BankCard.d.ts +2 -0
  35. package/dist/components/card/CardForm.d.ts +3 -0
  36. package/dist/components/card/CardPayment.d.ts +3 -0
  37. package/dist/components/card/Styles/CardPayment.styles.d.ts +6 -0
  38. package/dist/components/card/Styles/index.d.ts +13 -0
  39. package/dist/components/checkout/BankTransferPayment.d.ts +15 -0
  40. package/dist/components/checkout/CardPaymentForm.d.ts +12 -0
  41. package/dist/components/checkout/CardPinEntry.d.ts +12 -0
  42. package/dist/components/checkout/KudaPayment.d.ts +2 -0
  43. package/dist/components/checkout/MobileHeaderText.d.ts +9 -0
  44. package/dist/components/checkout/MobileMoneyPayment.d.ts +16 -0
  45. package/dist/components/checkout/OpayPayment.d.ts +2 -0
  46. package/dist/components/checkout/PalmPayPayment.d.ts +2 -0
  47. package/dist/components/checkout/PaymentFailedView.d.ts +7 -0
  48. package/dist/components/checkout/PaymentSuccessView.d.ts +5 -0
  49. package/dist/components/checkout/QRPayment.d.ts +2 -0
  50. package/dist/components/checkout/SecureBox.d.ts +2 -0
  51. package/dist/components/checkout/SidebarMenu.d.ts +14 -0
  52. package/dist/components/checkout/USSDPayment.d.ts +17 -0
  53. package/dist/components/checkout/styles/PaymentFailedStyl.d.ts +5 -0
  54. package/dist/components/checkout/styles/PaymentSuccessful.d.ts +7 -0
  55. package/dist/components/dropdowns/BankSelectXDropdown.d.ts +8 -0
  56. package/dist/components/dropdowns/NetworkProviderDropdown.d.ts +4 -0
  57. package/dist/components/dropdowns/styles/BankSelectXDropdownStyle.d.ts +11 -0
  58. package/dist/components/dropdowns/styles/index.d.ts +9 -0
  59. package/dist/containers/Payment/CountrySelector.d.ts +7 -0
  60. package/dist/containers/Payment/OtpVerification.d.ts +14 -0
  61. package/dist/containers/Payment/PaymentMethodSelector.d.ts +81 -0
  62. package/dist/containers/Payment/PaymentMethods.d.ts +7 -0
  63. package/dist/containers/Payment/Styles/PaymentStyle.d.ts +5 -0
  64. package/dist/containers/Payment/index.d.ts +2 -0
  65. package/dist/index.d.ts +45 -0
  66. package/dist/index.esm.js +27899 -0
  67. package/dist/index.esm.js.map +1 -0
  68. package/dist/index.js +27919 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/lib/index.d.ts +2 -0
  71. package/dist/reportWebVitals.d.ts +3 -0
  72. package/dist/setupTests.d.ts +1 -0
  73. package/dist/shared/hooks/Styles/SnackbarStyle.d.ts +7 -0
  74. package/dist/shared/hooks/useCheckTransactionStatus.d.ts +14 -0
  75. package/dist/shared/hooks/useGetBanks.d.ts +7 -0
  76. package/dist/shared/hooks/usePaymentFlow.d.ts +5 -0
  77. package/dist/shared/hooks/useSnackBar.d.ts +6 -0
  78. package/dist/shared/themes/ThemeProvider.d.ts +6 -0
  79. package/dist/shared/themes/index.d.ts +5 -0
  80. package/dist/shared/types/index.d.ts +204 -0
  81. package/dist/shared/utils/Styles.d.ts +77 -0
  82. package/dist/shared/utils/index.d.ts +9 -0
  83. package/package.json +98 -0
@@ -0,0 +1,2 @@
1
+ export { default as PaymentMethodSelector } from '../containers/Payment/PaymentMethodSelector';
2
+ export type { UserBasicDataType, PaymentMethodSelectorProps } from '../shared/types';
@@ -0,0 +1,3 @@
1
+ import { ReportHandler } from 'web-vitals';
2
+ declare const reportWebVitals: (onPerfEntry?: ReportHandler) => void;
3
+ export default reportWebVitals;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const SnackbarContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const Snackbar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
4
+ type: "success" | "error" | "info" | "warning";
5
+ }>> & string;
6
+ export declare const SnackbarTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
+ export declare const SnackbarMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,14 @@
1
+ interface CheckStatusPayload {
2
+ transactionReference: string;
3
+ transactionCountry: string;
4
+ requestType: string;
5
+ clientId?: string;
6
+ publicKey: string;
7
+ }
8
+ interface CheckStatusResponse {
9
+ [key: string]: any;
10
+ }
11
+ export declare const useCheckTransactionStatus: () => {
12
+ checkStatus: ({ transactionReference, transactionCountry, requestType, clientId, publicKey, }: CheckStatusPayload) => Promise<CheckStatusResponse>;
13
+ };
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import { BankListResponse } from "../types";
2
+ export declare const useGetBanks: () => {
3
+ banks: BankListResponse | undefined;
4
+ loading: boolean;
5
+ error: string | null;
6
+ getBanks: (currency?: string) => Promise<any>;
7
+ };
@@ -0,0 +1,5 @@
1
+ export type FlowStep = 'details' | 'pin' | 'otp' | 'completed';
2
+ export declare const usePaymentFlow: () => {
3
+ step: FlowStep;
4
+ nextStep: () => void;
5
+ };
@@ -0,0 +1,6 @@
1
+ type SnackbarType = "success" | "error" | "info" | "warning";
2
+ export declare const useSnackbar: () => {
3
+ showSnackbar: (type: SnackbarType, title: string, message: string) => void;
4
+ SnackbarUI: () => import("react/jsx-runtime").JSX.Element;
5
+ };
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ interface ThemeProviderProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare function ThemeProvider({ children }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const theme: {
2
+ color: {
3
+ blue: string;
4
+ };
5
+ };
@@ -0,0 +1,204 @@
1
+ export type PaymentMethod = 'card' | 'ussd';
2
+ export type PaymentOption = {
3
+ id: number;
4
+ paymentOption: string;
5
+ status: boolean;
6
+ businessFk: number;
7
+ feeAmount: number;
8
+ };
9
+ export type CheckoutResponseData = {
10
+ redirect_url: string;
11
+ id: number;
12
+ transaction_amount: number;
13
+ transaction_amount_card: number;
14
+ transaction_fee_amount: number;
15
+ ussd_fee_amount: number;
16
+ momo_fee_amount: number;
17
+ qr_fee_amount: number;
18
+ transaction_card_fee_amount: number;
19
+ business: Business;
20
+ customer: Customer;
21
+ currency: Currency;
22
+ transaction_reference: string;
23
+ biller_name: string;
24
+ payment_options: PaymentOption[];
25
+ customer_pay_fee: boolean;
26
+ };
27
+ export type CheckoutResponse = {
28
+ status: true;
29
+ message: "Checkout ready";
30
+ data: CheckoutResponseData;
31
+ code: string;
32
+ };
33
+ export interface PaymentSDKProps {
34
+ amount?: number;
35
+ method?: PaymentMethod;
36
+ currency?: 'NGN' | 'USD';
37
+ onSuccess?: (transactionId: string) => void;
38
+ onFailure?: (error: string) => void;
39
+ }
40
+ export type UserBasicDataType = {
41
+ clientId?: string;
42
+ firstName: string;
43
+ lastName: string;
44
+ email: string;
45
+ phoneNumber: string;
46
+ countryCode: string;
47
+ currencyCode: string;
48
+ transactionCurrency?: string;
49
+ merchantName?: string;
50
+ amount: number;
51
+ merchantReference?: string;
52
+ customerAddress?: string;
53
+ customerCity?: string;
54
+ customerState?: string;
55
+ customerCountry?: string;
56
+ customerPostalCode?: string;
57
+ webhookUrl?: string;
58
+ deviceSignature?: string;
59
+ ipAddress?: string;
60
+ metadataOrderId?: string;
61
+ metadataProductInfo?: string;
62
+ redirectUrl?: string;
63
+ merchantPublicKey?: string;
64
+ merchantSecretKey?: string;
65
+ merchantAPIKey?: string;
66
+ merchantSiteUrl: string;
67
+ };
68
+ export type ItemsType = {
69
+ name?: string;
70
+ price?: number;
71
+ };
72
+ export type VirtualAccountData = {
73
+ account_name: string;
74
+ account_number: string;
75
+ bank_name: string;
76
+ bank_code: string;
77
+ account_reference: string;
78
+ account_expired: boolean;
79
+ };
80
+ export type VirtualAccountResponse = {
81
+ message: string;
82
+ data: VirtualAccountData;
83
+ success: boolean;
84
+ };
85
+ export type Business = {
86
+ id: number;
87
+ name: string;
88
+ business_public_id: string;
89
+ resubmission_status: boolean;
90
+ };
91
+ export type Customer = {
92
+ customer_id: string;
93
+ email_address: string;
94
+ first_name: string;
95
+ last_name: string;
96
+ mobile_number: string;
97
+ };
98
+ export type Currency = {
99
+ id: number;
100
+ name: string;
101
+ code: string;
102
+ unicode: string;
103
+ html_value: string;
104
+ enabled: boolean;
105
+ };
106
+ export type CheckoutReadyResponse = {
107
+ status: boolean;
108
+ message: string;
109
+ data: CheckoutReadyResponseData;
110
+ code: string;
111
+ };
112
+ export type CheckoutReadyResponseData = {
113
+ redirect_url: string;
114
+ id: number;
115
+ transaction_amount: number;
116
+ transaction_amount_card: number;
117
+ transaction_fee_amount: number;
118
+ ussd_fee_amount: number;
119
+ momo_fee_amount: number;
120
+ qr_fee_amount: number;
121
+ transaction_card_fee_amount: number;
122
+ business: Business;
123
+ customer: Customer;
124
+ currency: Currency;
125
+ transaction_reference: string;
126
+ biller_name: string;
127
+ payment_options: PaymentOption[];
128
+ customer_pay_fee: boolean;
129
+ };
130
+ export type BankListResponse = {
131
+ isSuccessful: boolean;
132
+ responseCode: string;
133
+ responseMessage: string;
134
+ responseData: Bank[];
135
+ };
136
+ export type Bank = {
137
+ blockTransaction: boolean;
138
+ avatar: string;
139
+ sortCode: string;
140
+ active: boolean;
141
+ skipNameEnquiry: boolean;
142
+ code: string;
143
+ shortName: string;
144
+ name: string;
145
+ currency: string;
146
+ country: string;
147
+ };
148
+ export type TransactionResponse = {
149
+ internal_transaction_id: string;
150
+ processor_transaction_id: string;
151
+ status: string;
152
+ message: string;
153
+ client_transaction_reference: string;
154
+ business_reference: string;
155
+ amount: number;
156
+ processed_amount: number;
157
+ fee_amount: number;
158
+ merchant_amount: number;
159
+ currency: string;
160
+ processor_reference: string;
161
+ fee_bearer: "BUSINESS" | "CUSTOMER" | string;
162
+ card_bin: string;
163
+ card_scheme: string;
164
+ card_type: string;
165
+ card_last4: string;
166
+ card_holder_name: string;
167
+ acquirer_reference_number: string;
168
+ retrieval_reference_number: string;
169
+ transaction_date: string;
170
+ redirect_url_3ds?: string;
171
+ details?: string;
172
+ error_code?: string;
173
+ };
174
+ export type ThreeDSRequiredResponse = {
175
+ internal_transaction_id: string;
176
+ processor_transaction_id: string | null;
177
+ status: "PENDING_3DS";
178
+ message: string;
179
+ redirect_url_3ds: string;
180
+ client_transaction_reference: string;
181
+ amount: number;
182
+ currency: string;
183
+ };
184
+ export type OtpRequiredResponse = {
185
+ internal_transaction_id: string;
186
+ processor_transaction_id: string;
187
+ status: string;
188
+ message: string;
189
+ otp_required: true;
190
+ otp_submission_reference: string;
191
+ client_transaction_reference: string;
192
+ amount: number;
193
+ currency: string;
194
+ };
195
+ export type PaymentMethodSelectorProps = {
196
+ userData: UserBasicDataType;
197
+ config?: {
198
+ theme?: "light" | "dark";
199
+ environment?: "test" | "live";
200
+ [key: string]: any;
201
+ };
202
+ onSuccess?: (response: any) => void;
203
+ onError?: (error: any) => void;
204
+ };
@@ -0,0 +1,77 @@
1
+ export declare const color: {
2
+ blue: string;
3
+ blue1: string;
4
+ blue2: string;
5
+ blue3: string;
6
+ black: string;
7
+ black1: string;
8
+ black2: string;
9
+ white: string;
10
+ white1: string;
11
+ white2: string;
12
+ white3: string;
13
+ white4: string;
14
+ grey: string;
15
+ grey1: string;
16
+ grey2: string;
17
+ grey3: string;
18
+ grey4: string;
19
+ grey5: string;
20
+ red: string;
21
+ red1: string;
22
+ green: string;
23
+ green1: string;
24
+ green2: string;
25
+ green3: string;
26
+ green4: string;
27
+ green5: string;
28
+ yellow: string;
29
+ yellow1: string;
30
+ yellow2: string;
31
+ purple: string;
32
+ purple1: string;
33
+ error: string;
34
+ error1: string;
35
+ error2: string;
36
+ error3: string;
37
+ error4: string;
38
+ error5: string;
39
+ error6: string;
40
+ error7: string;
41
+ error8: string;
42
+ };
43
+ export declare const size: {
44
+ gridSize: number;
45
+ gutterWidth: string;
46
+ outerMargin: string;
47
+ xsMin: number;
48
+ smMin: number;
49
+ mdMin: number;
50
+ lgMin: number;
51
+ xlMin: number;
52
+ xxlMin: number;
53
+ };
54
+ export declare const breakpoint: {
55
+ xs: string;
56
+ sm: string;
57
+ md: string;
58
+ lg: string;
59
+ xl: string;
60
+ xxl: string;
61
+ };
62
+ export declare const device: {
63
+ mobile: string;
64
+ tablet: string;
65
+ desktop: string;
66
+ };
67
+ export declare const gradient: {
68
+ primary: string;
69
+ primaryActive: string;
70
+ light: string;
71
+ error: string;
72
+ };
73
+ export declare const mixin: {
74
+ clickable: import("styled-components").RuleSet<object>;
75
+ scrollableY: import("styled-components").RuleSet<object>;
76
+ truncateText: import("styled-components").RuleSet<object>;
77
+ };
@@ -0,0 +1,9 @@
1
+ export declare function generateRandomString(length?: number): string;
2
+ export declare const generateSdkTransactionReference: () => string;
3
+ export declare const isValidCardNumber: (cardNumber: string) => boolean;
4
+ export declare const generateXModelHeader: (transactionAmount: number, transactionReference: string, customerNumber: string) => string;
5
+ export declare const encodeString: (input: string) => string;
6
+ export declare const allCurrencySymbols: Record<string, string>;
7
+ export declare const getCurrencySymbol: (code: string) => string;
8
+ export declare const formatAmountWithSymbol: (amount?: number, currency?: string, locale?: string) => string;
9
+ export declare const isVerveCard: (cardNumber: string) => boolean;
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "paygate-checkout-sdk",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.esm.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "description": "A React-based SDK for integrating payment methods via Paygate.",
11
+ "private": false,
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/MYPAYGATE/checkout-frontend.git"
15
+ },
16
+ "homepage": "https://github.com/MYPAYGATE/checkout-frontend#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/MYPAYGATE/checkout-frontend/issues"
19
+ },
20
+ "author": "Paygate",
21
+ "license": "MIT",
22
+ "dependencies": {
23
+ "@radix-ui/react-toast": "^1.2.11",
24
+ "@rollup/plugin-json": "^6.1.0",
25
+ "@testing-library/dom": "^10.4.0",
26
+ "@testing-library/jest-dom": "^6.6.3",
27
+ "@testing-library/react": "^16.1.0",
28
+ "@testing-library/user-event": "^13.2.1",
29
+ "@types/jest": "^27.0.1",
30
+ "@types/node": "^16.7.13",
31
+ "@types/react": "^19.0.0",
32
+ "@types/react-dom": "^19.0.0",
33
+ "@types/styled-system": "^5.1.23",
34
+ "@vitejs/plugin-react": "^4.4.1",
35
+ "axios": "^1.9.0",
36
+ "card-validator": "^10.0.3",
37
+ "credit-card-type": "^10.0.2",
38
+ "fontawesome": "^5.6.3",
39
+ "html2canvas": "^1.4.1",
40
+ "moment": "^2.30.1",
41
+ "react-chartjs-2": "^5.3.0",
42
+ "react-icons": "^5.5.0",
43
+ "react-router-dom": "^7.5.3",
44
+ "react-scripts": "5.0.1",
45
+ "recharts": "^2.15.3",
46
+ "styled-components": "^6.1.19",
47
+ "styled-system": "^5.1.5",
48
+ "vite": "^6.3.3",
49
+ "web-vitals": "^2.1.0"
50
+ },
51
+ "peerDependencies": {
52
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
53
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
54
+ "styled-components": "^6.0.0"
55
+ },
56
+ "scripts": {
57
+ "start": "react-scripts start",
58
+ "dev": "rollup -c -w",
59
+ "build": "rollup -c",
60
+ "prepare": "yarn build"
61
+ },
62
+ "eslintConfig": {
63
+ "extends": [
64
+ "react-app",
65
+ "react-app/jest"
66
+ ]
67
+ },
68
+ "browserslist": {
69
+ "production": [
70
+ ">0.2%",
71
+ "not dead",
72
+ "not op_mini all"
73
+ ],
74
+ "development": [
75
+ "last 1 chrome version",
76
+ "last 1 firefox version",
77
+ "last 1 safari version"
78
+ ]
79
+ },
80
+ "devDependencies": {
81
+ "@fortawesome/fontawesome-svg-core": "^6.7.2",
82
+ "@fortawesome/free-brands-svg-icons": "^6.7.2",
83
+ "@fortawesome/free-regular-svg-icons": "^6.7.2",
84
+ "@fortawesome/free-solid-svg-icons": "^6.7.2",
85
+ "@fortawesome/react-fontawesome": "^0.2.2",
86
+ "@rollup/plugin-alias": "^5.1.1",
87
+ "@rollup/plugin-commonjs": "^28.0.6",
88
+ "@rollup/plugin-node-resolve": "^16.0.1",
89
+ "@rollup/plugin-typescript": "^12.1.4",
90
+ "@svgr/rollup": "^8.1.0",
91
+ "@types/styled-components": "^5.1.34",
92
+ "rollup": "^4.44.2",
93
+ "rollup-plugin-dts": "^6.2.1",
94
+ "rollup-plugin-peer-deps-external": "^2.2.4",
95
+ "rollup-plugin-postcss": "^4.0.2",
96
+ "typescript": "^4.4.2"
97
+ }
98
+ }