@spot-flow/checkout-inline-js 0.1.49-dev.2 → 0.1.49-dev.3
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 +78 -78
- package/dist/api.d.ts +37 -37
- package/dist/checkout-class.d.ts +44 -44
- package/dist/checkout-inline.es.js +38467 -38029
- package/dist/checkout-inline.js +2118 -2081
- package/dist/constants.d.ts +112 -105
- package/dist/contexts/translate-context.d.ts +17 -15
- package/dist/data/countryStateCode.json.d.ts +22016 -22016
- package/dist/data.d.ts +27 -27
- package/dist/index.css +1 -1
- package/dist/modules/Card.d.ts +98 -98
- package/dist/modules/EFT.d.ts +65 -65
- package/dist/modules/MobileMoney.d.ts +85 -85
- package/dist/modules/Opay.d.ts +68 -0
- package/dist/modules/Transfer.d.ts +76 -76
- package/dist/types/types.d.ts +219 -219
- package/dist/types.d.ts +32 -32
- package/dist/utils/encryption.d.ts +8 -8
- package/dist/utils/get-browser-details.d.ts +11 -11
- package/dist/utils/get-currency.d.ts +1 -1
- package/dist/utils/get-region-details.d.ts +4 -4
- package/dist/utils.d.ts +26 -26
- package/dist/views/card/avs-validation.d.ts +27 -27
- package/dist/views/card/isw-3ds-form.d.ts +21 -21
- package/dist/views/opay/opay-authenticate.d.ts +22 -0
- package/dist/views/shared/main-footer.d.ts +24 -24
- package/dist/views/shared/main-header.d.ts +37 -37
- package/dist/views/shared/main-page.d.ts +103 -101
- package/dist/views/shared/shared-error-page.d.ts +6 -6
- package/dist/views/shared/test-card.d.ts +17 -17
- package/package.json +64 -64
package/README.md
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
# Spotflow Checkout Inline
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
For React components and usage, [React NPM Package](https://www.npmjs.com/package/@spot-flow/react-spotflow-checkout)
|
|
7
|
-
|
|
8
|
-
For Vue.js components and usage, [Vue NPM Package](https://www.npmjs.com/package/@spot-flow/vue-spotflow-checkout)
|
|
9
|
-
|
|
10
|
-
For Angular components and usage, [Angular NPM Package](https://www.npmjs.com/package/@spot-flow/ng-spotflow-checkout)
|
|
11
|
-
|
|
12
|
-
## Demo
|
|
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">
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
npm install @spot-flow/checkout-inline-js
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```javascript
|
|
25
|
-
import { CheckoutForm } from "@spot-flow/checkout-inline-js";
|
|
26
|
-
|
|
27
|
-
const { CheckoutForm } = SpotflowCheckout;
|
|
28
|
-
const checkout = new CheckoutForm();
|
|
29
|
-
checkout.setup({
|
|
30
|
-
email: "oluXXXXXX@gmail.com",
|
|
31
|
-
encryptionKey: "g4ryXXXXXXXXXXXX=",
|
|
32
|
-
merchantKey: "sk_test_d96889XXXXXXX684adXXXXX5b69",
|
|
33
|
-
amount: 5,
|
|
34
|
-
metadata: {
|
|
35
|
-
productName: "",
|
|
36
|
-
title: ""
|
|
37
|
-
},
|
|
38
|
-
amount: 20,
|
|
39
|
-
currency: "USD",
|
|
40
|
-
localCurrency: "NGN"
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Alternatively, you can include it directly in your HTML via a CDN:
|
|
46
|
-
|
|
47
|
-
```sh
|
|
48
|
-
<script src="https://v2.inline-checkout.spotflow.one/dist/checkout-inline.js"></script>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
<button onclick="openCheckout()">
|
|
53
|
-
Make Payment
|
|
54
|
-
</button>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
<script>
|
|
59
|
-
|
|
60
|
-
const openCheckout = () => {
|
|
61
|
-
const { CheckoutForm } = SpotflowCheckout;
|
|
62
|
-
const checkout = new CheckoutForm();
|
|
63
|
-
checkout.setup({
|
|
64
|
-
email: "oluXXXXXX@gmail.com",
|
|
65
|
-
encryptionKey: "g4ryXXXXXXXXXXXX=",
|
|
66
|
-
merchantKey: "sk_test_d96889XXXXXXX684adXXXXX5b69",
|
|
67
|
-
metadata: {
|
|
68
|
-
productName: "",
|
|
69
|
-
title: ""
|
|
70
|
-
},
|
|
71
|
-
amount: 20,
|
|
72
|
-
currency: "USD",
|
|
73
|
-
localCurrency: "NGN"
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
</script>
|
|
78
|
-
```
|
|
1
|
+
|
|
2
|
+
# Spotflow Checkout Inline
|
|
3
|
+
|
|
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
|
+
|
|
6
|
+
For React components and usage, [React NPM Package](https://www.npmjs.com/package/@spot-flow/react-spotflow-checkout)
|
|
7
|
+
|
|
8
|
+
For Vue.js components and usage, [Vue NPM Package](https://www.npmjs.com/package/@spot-flow/vue-spotflow-checkout)
|
|
9
|
+
|
|
10
|
+
For Angular components and usage, [Angular NPM Package](https://www.npmjs.com/package/@spot-flow/ng-spotflow-checkout)
|
|
11
|
+
|
|
12
|
+
## Demo
|
|
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">
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install @spot-flow/checkout-inline-js
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
import { CheckoutForm } from "@spot-flow/checkout-inline-js";
|
|
26
|
+
|
|
27
|
+
const { CheckoutForm } = SpotflowCheckout;
|
|
28
|
+
const checkout = new CheckoutForm();
|
|
29
|
+
checkout.setup({
|
|
30
|
+
email: "oluXXXXXX@gmail.com",
|
|
31
|
+
encryptionKey: "g4ryXXXXXXXXXXXX=",
|
|
32
|
+
merchantKey: "sk_test_d96889XXXXXXX684adXXXXX5b69",
|
|
33
|
+
amount: 5,
|
|
34
|
+
metadata: {
|
|
35
|
+
productName: "",
|
|
36
|
+
title: ""
|
|
37
|
+
},
|
|
38
|
+
amount: 20,
|
|
39
|
+
currency: "USD",
|
|
40
|
+
localCurrency: "NGN"
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Alternatively, you can include it directly in your HTML via a CDN:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
<script src="https://v2.inline-checkout.spotflow.one/dist/checkout-inline.js"></script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
<button onclick="openCheckout()">
|
|
53
|
+
Make Payment
|
|
54
|
+
</button>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
<script>
|
|
59
|
+
|
|
60
|
+
const openCheckout = () => {
|
|
61
|
+
const { CheckoutForm } = SpotflowCheckout;
|
|
62
|
+
const checkout = new CheckoutForm();
|
|
63
|
+
checkout.setup({
|
|
64
|
+
email: "oluXXXXXX@gmail.com",
|
|
65
|
+
encryptionKey: "g4ryXXXXXXXXXXXX=",
|
|
66
|
+
merchantKey: "sk_test_d96889XXXXXXX684adXXXXX5b69",
|
|
67
|
+
metadata: {
|
|
68
|
+
productName: "",
|
|
69
|
+
title: ""
|
|
70
|
+
},
|
|
71
|
+
amount: 20,
|
|
72
|
+
currency: "USD",
|
|
73
|
+
localCurrency: "NGN"
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
</script>
|
|
78
|
+
```
|
package/dist/api.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { CardPaymentRequestPayload, PaymentResponseData, AuthorizeCardPaymentRequestPayload, ValidateCardPaymentRequestPayload, PaymentRequestPayload, GetPaymentRateParams, Rate, GetMerchantPlanDetail, MobileMoneyPaymentRequestPayload, GetMobileMoneyResponse, CreateDisputeRequest, RetryPaymentPayload, TaxQuoteResponse } from './types/types';
|
|
2
|
-
|
|
3
|
-
export declare const getHeaders: (token: string, rdtCode?: string, isFile?: boolean) => Headers;
|
|
4
|
-
export type PaymentAPIResponse = {
|
|
5
|
-
data: PaymentResponseData;
|
|
6
|
-
headers: Headers;
|
|
7
|
-
};
|
|
8
|
-
export declare const createCardPayment: (token: string, payload: CardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
9
|
-
export declare const authorizeCardPayment: (token: string, payload: AuthorizeCardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
10
|
-
export declare const validateCardPayment: (token: string, payload: ValidateCardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
11
|
-
export declare const createTransferPayment: (token: string, payload: PaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
12
|
-
export declare const createMobileMoneyPayment: (token: string, payload: MobileMoneyPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
13
|
-
export declare const verifyPayment: (token: string, reference: string, signal?: AbortSignal, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
14
|
-
export declare function getRate(token: string, payload: GetPaymentRateParams, rdtCode?: string, url?: string): Promise<Rate>;
|
|
15
|
-
export declare function getProviders(token: string, currency: string, rdtCode?: string, url?: string, localCurrency?: string): Promise<GetMobileMoneyResponse>;
|
|
16
|
-
export declare function getCheckoutConfiguration(secret: string, planId: string, rdtCode?: string, url?: string): Promise<GetMerchantPlanDetail>;
|
|
17
|
-
export declare const cancelPayment: (token: string, payload: {
|
|
18
|
-
reference: string;
|
|
19
|
-
}, rdtCode?: string, url?: string) => Promise<{
|
|
20
|
-
headers: Headers;
|
|
21
|
-
}>;
|
|
22
|
-
export declare const uploadFile: (token: string, payload: FormData, rdtCode?: string, url?: string) => Promise<any>;
|
|
23
|
-
export declare const createDispute: (token: string, payload: CreateDisputeRequest, rdtCode?: string, url?: string) => Promise<any>;
|
|
24
|
-
export declare const retryPayment: (token: string, payload: RetryPaymentPayload, rdtCode?: string, url?: string) => Promise<{
|
|
25
|
-
data: PaymentResponseData;
|
|
26
|
-
headers: Headers;
|
|
27
|
-
}>;
|
|
28
|
-
export declare function getTaxQuotes(token: string, amount: number, currency: string, rdtCode?: string, url?: string): Promise<TaxQuoteResponse>;
|
|
29
|
-
export declare const chargePayment: (token: string, reference: string, rdtCode?: string, url?: string) => Promise<{
|
|
30
|
-
headers: Headers;
|
|
31
|
-
data: PaymentResponseData;
|
|
32
|
-
}>;
|
|
33
|
-
export declare const translateText: (payload: {
|
|
34
|
-
text: string | Array<string>;
|
|
35
|
-
source?: string;
|
|
36
|
-
target: string;
|
|
37
|
-
}) => Promise<any>;
|
|
1
|
+
import { CardPaymentRequestPayload, PaymentResponseData, AuthorizeCardPaymentRequestPayload, ValidateCardPaymentRequestPayload, PaymentRequestPayload, GetPaymentRateParams, Rate, GetMerchantPlanDetail, MobileMoneyPaymentRequestPayload, GetMobileMoneyResponse, CreateDisputeRequest, RetryPaymentPayload, TaxQuoteResponse } from './types/types';
|
|
2
|
+
|
|
3
|
+
export declare const getHeaders: (token: string, rdtCode?: string, isFile?: boolean) => Headers;
|
|
4
|
+
export type PaymentAPIResponse = {
|
|
5
|
+
data: PaymentResponseData;
|
|
6
|
+
headers: Headers;
|
|
7
|
+
};
|
|
8
|
+
export declare const createCardPayment: (token: string, payload: CardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
9
|
+
export declare const authorizeCardPayment: (token: string, payload: AuthorizeCardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
10
|
+
export declare const validateCardPayment: (token: string, payload: ValidateCardPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
11
|
+
export declare const createTransferPayment: (token: string, payload: PaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
12
|
+
export declare const createMobileMoneyPayment: (token: string, payload: MobileMoneyPaymentRequestPayload, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
13
|
+
export declare const verifyPayment: (token: string, reference: string, signal?: AbortSignal, rdtCode?: string, url?: string) => Promise<PaymentAPIResponse>;
|
|
14
|
+
export declare function getRate(token: string, payload: GetPaymentRateParams, rdtCode?: string, url?: string): Promise<Rate>;
|
|
15
|
+
export declare function getProviders(token: string, currency: string, rdtCode?: string, url?: string, localCurrency?: string): Promise<GetMobileMoneyResponse>;
|
|
16
|
+
export declare function getCheckoutConfiguration(secret: string, planId: string, rdtCode?: string, url?: string): Promise<GetMerchantPlanDetail>;
|
|
17
|
+
export declare const cancelPayment: (token: string, payload: {
|
|
18
|
+
reference: string;
|
|
19
|
+
}, rdtCode?: string, url?: string) => Promise<{
|
|
20
|
+
headers: Headers;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const uploadFile: (token: string, payload: FormData, rdtCode?: string, url?: string) => Promise<any>;
|
|
23
|
+
export declare const createDispute: (token: string, payload: CreateDisputeRequest, rdtCode?: string, url?: string) => Promise<any>;
|
|
24
|
+
export declare const retryPayment: (token: string, payload: RetryPaymentPayload, rdtCode?: string, url?: string) => Promise<{
|
|
25
|
+
data: PaymentResponseData;
|
|
26
|
+
headers: Headers;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function getTaxQuotes(token: string, amount: number, currency: string, rdtCode?: string, url?: string): Promise<TaxQuoteResponse>;
|
|
29
|
+
export declare const chargePayment: (token: string, reference: string, rdtCode?: string, url?: string) => Promise<{
|
|
30
|
+
headers: Headers;
|
|
31
|
+
data: PaymentResponseData;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const translateText: (payload: {
|
|
34
|
+
text: string | Array<string>;
|
|
35
|
+
source?: string;
|
|
36
|
+
target: string;
|
|
37
|
+
}) => Promise<any>;
|
package/dist/checkout-class.d.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { MainPageScreen } from './views/shared/main-page';
|
|
2
|
-
import { SharedErrorScreen } from './views/shared/shared-error-page';
|
|
3
|
-
import { PageLoader } from './views/shared/page-loader';
|
|
4
|
-
import { SpotflowProps } from './types';
|
|
5
|
-
|
|
6
|
-
declare class CheckoutForm {
|
|
7
|
-
modalContainer: HTMLDivElement;
|
|
8
|
-
mainLayout: HTMLDivElement;
|
|
9
|
-
encryption: string;
|
|
10
|
-
mainScreen: MainPageScreen;
|
|
11
|
-
private merchantConfigService;
|
|
12
|
-
mainError: SharedErrorScreen;
|
|
13
|
-
mainLoader: PageLoader;
|
|
14
|
-
private merchantPlanDetail;
|
|
15
|
-
merchantKey: string;
|
|
16
|
-
planId: string;
|
|
17
|
-
email: string;
|
|
18
|
-
amount: number;
|
|
19
|
-
name?: string;
|
|
20
|
-
rdtCode: string;
|
|
21
|
-
url: string;
|
|
22
|
-
phoneNumber?: string;
|
|
23
|
-
code: string;
|
|
24
|
-
reference: string;
|
|
25
|
-
currency: string;
|
|
26
|
-
callBackUrl: string;
|
|
27
|
-
metadata: Record<string, unknown>;
|
|
28
|
-
localCurrency: string;
|
|
29
|
-
countryCode?: string;
|
|
30
|
-
mode?: "test" | "live";
|
|
31
|
-
rawPaymentMethodTexts: Record<string, string>;
|
|
32
|
-
translatedPMTexts: Record<string, string>;
|
|
33
|
-
constructor();
|
|
34
|
-
closePayment(): void;
|
|
35
|
-
getDeviceType(): "Mobile" | "Tablet" | "Desktop";
|
|
36
|
-
setup(config: SpotflowProps): void;
|
|
37
|
-
private getAvailableChannels;
|
|
38
|
-
private getPlanDetails;
|
|
39
|
-
render(validChannels: string[], disabledChannels: string[]): void;
|
|
40
|
-
updateMethodsOptionsTexts(methods: string[]): Promise<void>;
|
|
41
|
-
showErrorIcon(): void;
|
|
42
|
-
closeModal(): void;
|
|
43
|
-
}
|
|
44
|
-
export { CheckoutForm };
|
|
1
|
+
import { MainPageScreen } from './views/shared/main-page';
|
|
2
|
+
import { SharedErrorScreen } from './views/shared/shared-error-page';
|
|
3
|
+
import { PageLoader } from './views/shared/page-loader';
|
|
4
|
+
import { SpotflowProps } from './types';
|
|
5
|
+
|
|
6
|
+
declare class CheckoutForm {
|
|
7
|
+
modalContainer: HTMLDivElement;
|
|
8
|
+
mainLayout: HTMLDivElement;
|
|
9
|
+
encryption: string;
|
|
10
|
+
mainScreen: MainPageScreen;
|
|
11
|
+
private merchantConfigService;
|
|
12
|
+
mainError: SharedErrorScreen;
|
|
13
|
+
mainLoader: PageLoader;
|
|
14
|
+
private merchantPlanDetail;
|
|
15
|
+
merchantKey: string;
|
|
16
|
+
planId: string;
|
|
17
|
+
email: string;
|
|
18
|
+
amount: number;
|
|
19
|
+
name?: string;
|
|
20
|
+
rdtCode: string;
|
|
21
|
+
url: string;
|
|
22
|
+
phoneNumber?: string;
|
|
23
|
+
code: string;
|
|
24
|
+
reference: string;
|
|
25
|
+
currency: string;
|
|
26
|
+
callBackUrl: string;
|
|
27
|
+
metadata: Record<string, unknown>;
|
|
28
|
+
localCurrency: string;
|
|
29
|
+
countryCode?: string;
|
|
30
|
+
mode?: "test" | "live";
|
|
31
|
+
rawPaymentMethodTexts: Record<string, string>;
|
|
32
|
+
translatedPMTexts: Record<string, string>;
|
|
33
|
+
constructor();
|
|
34
|
+
closePayment(): void;
|
|
35
|
+
getDeviceType(): "Mobile" | "Tablet" | "Desktop";
|
|
36
|
+
setup(config: SpotflowProps): void;
|
|
37
|
+
private getAvailableChannels;
|
|
38
|
+
private getPlanDetails;
|
|
39
|
+
render(validChannels: string[], disabledChannels: string[]): void;
|
|
40
|
+
updateMethodsOptionsTexts(methods: string[]): Promise<void>;
|
|
41
|
+
showErrorIcon(): void;
|
|
42
|
+
closeModal(): void;
|
|
43
|
+
}
|
|
44
|
+
export { CheckoutForm };
|