@spot-flow/checkout-inline-js 0.1.21 → 0.1.23

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 CHANGED
@@ -24,16 +24,8 @@ npm install @spot-flow/checkout-inline-js
24
24
  ```javascript
25
25
  import { CheckoutForm } from "@spot-flow/checkout-inline-js";
26
26
 
27
- const { CheckoutForm } = SpotflowCheckout
28
- const checkout = new CheckoutForm({}
29
- // merchantKey = "sk_test_d968XXXXXXXXXX69",
30
- // encryption = "g4ryTjP3VAGwl8Bk9r0foFtgoY64Ba4gZQ701OAAbB4=",
31
- // email = "oldsdkdk@youmain.com",
32
- // amount = 10,
33
- // plandId = "3c902af2-XXXXj-XXXX-XXX88d4"
34
-
35
- );
36
- // N
27
+ const { CheckoutForm } = SpotflowCheckout;
28
+ const checkout = new CheckoutForm({});
37
29
  checkout.setup({
38
30
  email: "oludkhsdksn@gmail.com",
39
31
  encryptionKey: "g4ryXXXXXXXXXXXX=",
@@ -62,16 +54,8 @@ Alternatively, you can include it directly in your HTML via a CDN:
62
54
  <script>
63
55
 
64
56
  const openCheckout = () => {
65
- const { CheckoutForm } = SpotflowCheckout
66
- const checkout = new CheckoutForm({}
67
- // merchantKey = "sk_test_d968XXXXXXXXXX69",
68
- // encryption = "g4ryTjP373849849494949OAAbB4=",
69
- // email = "oldsdkdk@youmain.com",
70
- // amount = 10,
71
- // plandId = "3c902af2-XXXXj-XXXX-XXX88d4"
72
-
73
- );
74
- // N
57
+ const { CheckoutForm } = SpotflowCheckout;
58
+ const checkout = new CheckoutForm({});
75
59
  checkout.setup({
76
60
  email: "oludkhsdksn@gmail.com",
77
61
  encryptionKey: "g4ryXXXXXXXXXXXX=",
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 createCardPayment: (token: string, payload: CardPaymentRequestPayload) => Promise<PaymentResponseData>;
4
- export declare const authorizeCardPayment: (token: string, payload: AuthorizeCardPaymentRequestPayload) => Promise<PaymentResponseData>;
5
- export declare const validateCardPayment: (token: string, payload: ValidateCardPaymentRequestPayload) => Promise<PaymentResponseData>;
6
- export declare const createTransferPayment: (token: string, payload: PaymentRequestPayload) => Promise<PaymentResponseData>;
7
- export declare const verifyPayment: (token: string, reference: string, signal?: AbortSignal) => Promise<PaymentResponseData>;
8
- export declare function getRate(token: string, payload: GetPaymentRateParams): Promise<Rate>;
9
- export declare function getCheckoutConfiguration(secret: string, planId: string): Promise<GetMerchantPlanDetail>;
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 {};
@@ -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;