@spot-flow/checkout-inline-js 0.1.16 → 0.1.22
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/README.md +37 -55
- package/dist/api.d.ts +8 -7
- package/dist/apis/payment.service.d.ts +47 -0
- package/dist/checkout-class.d.ts +6 -0
- package/dist/checkout-inline.es.js +30230 -1645
- package/dist/checkout-inline.js +521 -624
- package/dist/data/countryStateCode.json.d.ts +22019 -0
- package/dist/data.d.ts +17 -0
- package/dist/index.css +1 -1
- package/dist/modules/Card.d.ts +23 -4
- package/dist/modules/Transfer.d.ts +27 -6
- package/dist/modules/Ussd.d.ts +37 -7
- package/dist/types/types.d.ts +48 -6
- package/dist/types.d.ts +2 -0
- package/dist/utils/format-date.d.ts +9 -0
- package/dist/utils/keys.d.ts +1 -0
- package/dist/utils/mask-text.d.ts +2 -0
- package/dist/utils/number-format.d.ts +6 -0
- package/dist/utils/set-baseurl.d.ts +1 -0
- package/dist/utils/stringTransform.d.ts +8 -0
- package/dist/utils.d.ts +7 -0
- package/dist/views/card/avs-validation.d.ts +10 -2
- package/dist/views/card/card-detail-form.d.ts +15 -7
- package/dist/views/card/card-otp-validation-form.d.ts +14 -2
- package/dist/views/card/card-pin-form.d.ts +11 -4
- package/dist/views/shared/main-footer.d.ts +15 -0
- package/dist/views/shared/main-header.d.ts +17 -0
- package/dist/views/shared/main-page.d.ts +40 -7
- package/dist/views/shared/main-sidebar.d.ts +17 -0
- package/dist/views/shared/page-loader.d.ts +1 -0
- package/dist/views/shared/payment-warning.d.ts +13 -2
- package/dist/views/shared/shared-main-option.d.ts +23 -0
- package/dist/views/transfer/transfer-confirmation-one.d.ts +13 -0
- package/dist/views/transfer/transfer-confirmation-two.d.ts +13 -0
- package/dist/views/transfer/transfer-confirmtation-progress.d.ts +34 -0
- package/dist/views/transfer/transfer-details.d.ts +23 -0
- package/dist/views/transfer/transfer-expired.d.ts +11 -0
- package/dist/views/ussd/ussd-bank-detail-form.d.ts +14 -2
- package/dist/views/ussd/ussd-error-screen.d.ts +3 -0
- package/dist/views/ussd/ussd-view-code.d.ts +36 -1
- package/package.json +20 -4
package/README.md
CHANGED
|
@@ -3,36 +3,44 @@
|
|
|
3
3
|
|
|
4
4
|
This project is an inline library that enables users to make payments seamlessly. It integrates smoothly into your application, providing a streamlined checkout experience.
|
|
5
5
|
|
|
6
|
-
For React components and usage, [
|
|
6
|
+
For React components and usage, [React NPM Package](https://www.npmjs.com/package/@spot-flow/react-spotflow-checkout)
|
|
7
7
|
|
|
8
|
-
For Vue.js components and usage, [
|
|
9
|
-
|
|
10
|
-
For Angular components and usage, [link](https://github.com/Spotflow-One/angular-spotflow-checkout)
|
|
8
|
+
For Vue.js components and usage, [Vue NPM Package](https://www.npmjs.com/package/@spot-flow/vue-spotflow-checkout)
|
|
11
9
|
|
|
10
|
+
For Angular components and usage, [Angular NPM Package](https://www.npmjs.com/package/@spot-flow/ng-spotflow-checkout)
|
|
12
11
|
|
|
13
12
|
## Demo
|
|
14
|
-
<img width="808" alt="Screenshot 2024-07-26 at 16 05 52" src="https://github.com/user-attachments/assets/4dbb0b2e-2142-4f04-994a-5c352de7d30e">
|
|
15
13
|
|
|
14
|
+
<img width="808" alt="Screenshot 2024-07-26 at 16 05 52" src="https://github.com/user-attachments/assets/4dbb0b2e-2142-4f04-994a-5c352de7d30e">
|
|
16
15
|
|
|
17
16
|
## Installation
|
|
17
|
+
|
|
18
18
|
```sh
|
|
19
19
|
npm install @spot-flow/checkout-inline-js
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
24
25
|
import { CheckoutForm } from "@spot-flow/checkout-inline-js";
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const { CheckoutForm } = SpotflowCheckout;
|
|
28
|
+
const checkout = new CheckoutForm({});
|
|
29
|
+
checkout.setup({
|
|
30
|
+
email: "oludkhsdksn@gmail.com",
|
|
31
|
+
encryptionKey: "g4ryXXXXXXXXXXXX=",
|
|
32
|
+
merchantKey: "sk_test_d96889XXXXXXX684adXXXXX5b69",
|
|
33
|
+
planId: "3c902af2-3333-333-xxxxxxx,
|
|
34
|
+
amount: 5,
|
|
35
|
+
onSuccess: (value) => {
|
|
36
|
+
console.log("Fully Success", { value })
|
|
37
|
+
}
|
|
38
|
+
});
|
|
32
39
|
```
|
|
33
40
|
|
|
34
41
|
Alternatively, you can include it directly in your HTML via a CDN:
|
|
35
|
-
|
|
42
|
+
|
|
43
|
+
```sh
|
|
36
44
|
<script src="https://dr4h9151gox1m.cloudfront.net/dist/checkout-inline.js"></script>
|
|
37
45
|
```
|
|
38
46
|
|
|
@@ -41,50 +49,24 @@ Alternatively, you can include it directly in your HTML via a CDN:
|
|
|
41
49
|
Make Payment
|
|
42
50
|
</button>
|
|
43
51
|
```
|
|
44
|
-
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
45
54
|
<script>
|
|
55
|
+
|
|
46
56
|
const openCheckout = () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
const { CheckoutForm } = SpotflowCheckout;
|
|
58
|
+
const checkout = new CheckoutForm({});
|
|
59
|
+
checkout.setup({
|
|
60
|
+
email: "oludkhsdksn@gmail.com",
|
|
61
|
+
encryptionKey: "g4ryXXXXXXXXXXXX=",
|
|
62
|
+
merchantKey: "sk_test_d96889XXXXXXX684adXXXXX5b69",
|
|
63
|
+
planId: "3c902af2-3333-333-xxxxxxx,
|
|
64
|
+
amount: 5,
|
|
65
|
+
onSuccess: (value) => {
|
|
66
|
+
console.log("Fully Success", { value })
|
|
67
|
+
}
|
|
68
|
+
});
|
|
54
69
|
};
|
|
70
|
+
|
|
55
71
|
</script>
|
|
56
72
|
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Contributing
|
|
60
|
-
|
|
61
|
-
We welcome contributions! Follow the steps below to get started:
|
|
62
|
-
|
|
63
|
-
### Getting Started
|
|
64
|
-
|
|
65
|
-
1. **Clone the repository:**
|
|
66
|
-
|
|
67
|
-
```sh
|
|
68
|
-
git clone https://github.com/Spotflow-One/spotflow-checkout.git
|
|
69
|
-
cd your-repo
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
2. **Install dependencies:**
|
|
73
|
-
|
|
74
|
-
```sh
|
|
75
|
-
npm install
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Example Usage
|
|
79
|
-
|
|
80
|
-
You can see an example of how to use the library in `index.html`. Open this file in your browser to see it in action.
|
|
81
|
-
|
|
82
|
-
### Building the Project
|
|
83
|
-
|
|
84
|
-
To build the project, run:
|
|
85
|
-
|
|
86
|
-
```sh
|
|
87
|
-
npm run build
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
This will compile the source files and generate the output in the `dist` directory.
|
package/dist/api.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CardPaymentRequestPayload, PaymentResponseData, AuthorizeCardPaymentRequestPayload, ValidateCardPaymentRequestPayload, PaymentRequestPayload, GetPaymentRateParams, Rate, GetMerchantPlanDetail } from './types/types';
|
|
2
2
|
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare
|
|
9
|
-
export declare function
|
|
3
|
+
export declare const getHeaders: (token: string, rdtCode?: string) => Headers;
|
|
4
|
+
export declare const createCardPayment: (token: string, payload: CardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentResponseData>;
|
|
5
|
+
export declare const authorizeCardPayment: (token: string, payload: AuthorizeCardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentResponseData>;
|
|
6
|
+
export declare const validateCardPayment: (token: string, payload: ValidateCardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentResponseData>;
|
|
7
|
+
export declare const createTransferPayment: (token: string, payload: PaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentResponseData>;
|
|
8
|
+
export declare const verifyPayment: (token: string, reference: string, signal?: AbortSignal, rdtCode?: string, url?: string) => Promise<PaymentResponseData>;
|
|
9
|
+
export declare function getRate(token: string, payload: GetPaymentRateParams, rdtCode?: string, url?: string): Promise<Rate>;
|
|
10
|
+
export declare function getCheckoutConfiguration(secret: string, planId: string, rdtCode?: string, url?: string): Promise<GetMerchantPlanDetail>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AuthorizeCardPaymentRequestPayload, CardPaymentRequestPayload, GetBanksResponse, GetMerchantPlanDetail, GetPaymentRateParams, PaymentRequestPayload, PaymentResponseData, Rate, UssdPaymentRequestPayload, ValidateCardPaymentRequestPayload } from '../types/types';
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
token: string;
|
|
5
|
+
rdtCode?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class BaseService {
|
|
9
|
+
protected token: string;
|
|
10
|
+
protected baseurl: string;
|
|
11
|
+
protected headers: Headers;
|
|
12
|
+
protected rdtCode?: string;
|
|
13
|
+
protected url?: string;
|
|
14
|
+
constructor(props: Props);
|
|
15
|
+
protected getHeaders: (token: string, rdtCode?: string) => Headers;
|
|
16
|
+
}
|
|
17
|
+
type PaymentServiceProps = Props;
|
|
18
|
+
export declare class PaymentService extends BaseService {
|
|
19
|
+
constructor(props: PaymentServiceProps);
|
|
20
|
+
createCardPayment(payload: CardPaymentRequestPayload): Promise<PaymentResponseData>;
|
|
21
|
+
createUssdPayment(payload: UssdPaymentRequestPayload): Promise<PaymentResponseData>;
|
|
22
|
+
validateCardPayment(payload: ValidateCardPaymentRequestPayload): Promise<PaymentResponseData>;
|
|
23
|
+
authorizeCardPayment(payload: AuthorizeCardPaymentRequestPayload): Promise<PaymentResponseData>;
|
|
24
|
+
createTransferPayment(payload: PaymentRequestPayload): Promise<PaymentResponseData>;
|
|
25
|
+
verifyPayment(reference: string, signal?: AbortSignal): Promise<PaymentResponseData>;
|
|
26
|
+
}
|
|
27
|
+
type RateServiceProps = Props;
|
|
28
|
+
export declare class RateService extends BaseService {
|
|
29
|
+
constructor(props: RateServiceProps);
|
|
30
|
+
getRate(payload: GetPaymentRateParams): Promise<Rate>;
|
|
31
|
+
}
|
|
32
|
+
type MerchantConfigServiceProps = Props;
|
|
33
|
+
export declare class MerchantConfigService extends BaseService {
|
|
34
|
+
constructor(props: MerchantConfigServiceProps);
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param planId this is the planId for the subscriptions
|
|
38
|
+
* @returns {Promise<GetMerchantPlanDetail>}
|
|
39
|
+
*/
|
|
40
|
+
getMerchantConfig(planId: string): Promise<GetMerchantPlanDetail>;
|
|
41
|
+
}
|
|
42
|
+
type BankServiceProps = Props;
|
|
43
|
+
export declare class BankService extends BaseService {
|
|
44
|
+
constructor(props: BankServiceProps);
|
|
45
|
+
getBankList(): Promise<GetBanksResponse>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
package/dist/checkout-class.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare class CheckoutForm {
|
|
|
12
12
|
private onClose;
|
|
13
13
|
encryption: string;
|
|
14
14
|
mainScreen: MainPageScreen;
|
|
15
|
+
private merchantConfigService;
|
|
15
16
|
mainError: SharedErrorScreen;
|
|
16
17
|
mainLoader: PageLoader;
|
|
17
18
|
private merchantPlanDetail;
|
|
@@ -20,8 +21,13 @@ declare class CheckoutForm {
|
|
|
20
21
|
email: string;
|
|
21
22
|
amount: number;
|
|
22
23
|
isMobile: boolean;
|
|
24
|
+
rdtCode: string;
|
|
25
|
+
url: string;
|
|
26
|
+
reference: string;
|
|
27
|
+
currency: string;
|
|
23
28
|
constructor(config: Partial<SpotflowProps>);
|
|
24
29
|
closeBTN(): void;
|
|
30
|
+
getDeviceType(): "Mobile" | "Tablet" | "Desktop";
|
|
25
31
|
setup(config: Partial<SpotflowProps>): void;
|
|
26
32
|
private getPlanDetails;
|
|
27
33
|
closeModal(): void;
|