@paykit-sdk/medusajs 1.0.12 → 1.0.13
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 +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +264 -254
- package/dist/index.mjs +265 -255
- package/dist/providers/paykit-provider.d.mts +19 -15
- package/dist/providers/paykit-provider.d.ts +19 -15
- package/dist/providers/paykit-provider.js +264 -254
- package/dist/providers/paykit-provider.mjs +265 -255
- package/dist/utils/mapper.d.mts +5 -2
- package/dist/utils/mapper.d.ts +5 -2
- package/dist/utils/mapper.js +2 -2
- package/dist/utils/mapper.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,31 +1,37 @@
|
|
|
1
|
+
import * as _paykit_sdk_core from '@paykit-sdk/core';
|
|
2
|
+
import { PayKit } from '@paykit-sdk/core';
|
|
1
3
|
import { InitiatePaymentInput, InitiatePaymentOutput, CapturePaymentInput, CapturePaymentOutput, AuthorizePaymentInput, AuthorizePaymentOutput, CancelPaymentInput, CancelPaymentOutput, DeletePaymentInput, DeletePaymentOutput, GetPaymentStatusInput, GetPaymentStatusOutput, RefundPaymentInput, RefundPaymentOutput, RetrievePaymentInput, RetrievePaymentOutput, UpdatePaymentInput, UpdatePaymentOutput, ProviderWebhookPayload, WebhookActionResult, CreateAccountHolderInput, CreateAccountHolderOutput, UpdateAccountHolderInput, UpdateAccountHolderOutput, DeleteAccountHolderInput, DeleteAccountHolderOutput } from '@medusajs/framework/types';
|
|
2
4
|
import { AbstractPaymentProvider } from '@medusajs/framework/utils';
|
|
3
|
-
import { PayKitProvider, PayKit } from '@paykit-sdk/core';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
|
|
6
7
|
declare const optionsSchema: z.ZodObject<{
|
|
7
8
|
/**
|
|
8
9
|
* The underlying PayKit provider instance (Stripe, PayPal, etc.)
|
|
9
|
-
* This is required and must be a valid PayKit provider instance
|
|
10
10
|
*/
|
|
11
|
-
provider: z.ZodType<PayKitProvider, z.ZodTypeDef, PayKitProvider
|
|
11
|
+
provider: z.ZodType<_paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>, z.ZodTypeDef, _paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>>;
|
|
12
12
|
/**
|
|
13
|
-
* The webhook secret for the provider
|
|
14
|
-
* This is required and must be a valid webhook secret
|
|
13
|
+
* The webhook secret for the provider.
|
|
15
14
|
*/
|
|
16
|
-
webhookSecret: z.ZodString
|
|
15
|
+
webhookSecret: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
/**
|
|
17
|
+
* Multiplier applied to the amount before sending to the payment provider.
|
|
18
|
+
* Use this when your provider expects amounts in the smallest currency unit (e.g. cents)
|
|
19
|
+
* but Medusa is passing amounts in the major unit (e.g. euros).
|
|
20
|
+
*/
|
|
21
|
+
amountToCentsMultiplier: z.ZodDefault<z.ZodNumber>;
|
|
17
22
|
/**
|
|
18
23
|
* Whether to enable debug mode
|
|
19
|
-
* If enabled, the adapter will log debug information to the console
|
|
20
24
|
*/
|
|
21
25
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
22
26
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
provider: PayKitProvider
|
|
24
|
-
webhookSecret: string;
|
|
27
|
+
provider: _paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>;
|
|
28
|
+
webhookSecret: string | null;
|
|
29
|
+
amountToCentsMultiplier: number;
|
|
25
30
|
debug?: boolean | undefined;
|
|
26
31
|
}, {
|
|
27
|
-
provider: PayKitProvider
|
|
28
|
-
webhookSecret
|
|
32
|
+
provider: _paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>;
|
|
33
|
+
webhookSecret?: string | null | undefined;
|
|
34
|
+
amountToCentsMultiplier?: number | undefined;
|
|
29
35
|
debug?: boolean | undefined;
|
|
30
36
|
}>;
|
|
31
37
|
type PaykitMedusaJSAdapterOptions = z.infer<typeof optionsSchema>;
|
|
@@ -35,17 +41,15 @@ declare class PaykitMedusaJSAdapter extends AbstractPaymentProvider<PaykitMedusa
|
|
|
35
41
|
* Will be stored as `pp_paykit_{id}` in Medusa
|
|
36
42
|
*/
|
|
37
43
|
static identifier: string;
|
|
38
|
-
protected readonly paykit: PayKit
|
|
39
|
-
protected readonly provider: PayKitProvider;
|
|
44
|
+
protected readonly paykit: PayKit<PaykitMedusaJSAdapterOptions['provider']>;
|
|
40
45
|
protected readonly options: PaykitMedusaJSAdapterOptions;
|
|
41
46
|
static validateOptions(options: Record<string, any>): void | never;
|
|
42
47
|
/**
|
|
43
|
-
* Constructor receives Medusa's container and provider options
|
|
44
|
-
*
|
|
45
48
|
* @param cradle - Medusa's dependency injection container
|
|
46
49
|
* @param options - PayKit provider configuration
|
|
47
50
|
*/
|
|
48
51
|
constructor(cradle: Record<string, unknown>, options: PaykitMedusaJSAdapterOptions);
|
|
52
|
+
private exec;
|
|
49
53
|
initiatePayment: ({ context, amount, currency_code, data, }: InitiatePaymentInput) => Promise<InitiatePaymentOutput>;
|
|
50
54
|
capturePayment: (input: CapturePaymentInput) => Promise<CapturePaymentOutput>;
|
|
51
55
|
authorizePayment: (input: AuthorizePaymentInput) => Promise<AuthorizePaymentOutput>;
|
|
@@ -1,31 +1,37 @@
|
|
|
1
|
+
import * as _paykit_sdk_core from '@paykit-sdk/core';
|
|
2
|
+
import { PayKit } from '@paykit-sdk/core';
|
|
1
3
|
import { InitiatePaymentInput, InitiatePaymentOutput, CapturePaymentInput, CapturePaymentOutput, AuthorizePaymentInput, AuthorizePaymentOutput, CancelPaymentInput, CancelPaymentOutput, DeletePaymentInput, DeletePaymentOutput, GetPaymentStatusInput, GetPaymentStatusOutput, RefundPaymentInput, RefundPaymentOutput, RetrievePaymentInput, RetrievePaymentOutput, UpdatePaymentInput, UpdatePaymentOutput, ProviderWebhookPayload, WebhookActionResult, CreateAccountHolderInput, CreateAccountHolderOutput, UpdateAccountHolderInput, UpdateAccountHolderOutput, DeleteAccountHolderInput, DeleteAccountHolderOutput } from '@medusajs/framework/types';
|
|
2
4
|
import { AbstractPaymentProvider } from '@medusajs/framework/utils';
|
|
3
|
-
import { PayKitProvider, PayKit } from '@paykit-sdk/core';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
|
|
6
7
|
declare const optionsSchema: z.ZodObject<{
|
|
7
8
|
/**
|
|
8
9
|
* The underlying PayKit provider instance (Stripe, PayPal, etc.)
|
|
9
|
-
* This is required and must be a valid PayKit provider instance
|
|
10
10
|
*/
|
|
11
|
-
provider: z.ZodType<PayKitProvider, z.ZodTypeDef, PayKitProvider
|
|
11
|
+
provider: z.ZodType<_paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>, z.ZodTypeDef, _paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>>;
|
|
12
12
|
/**
|
|
13
|
-
* The webhook secret for the provider
|
|
14
|
-
* This is required and must be a valid webhook secret
|
|
13
|
+
* The webhook secret for the provider.
|
|
15
14
|
*/
|
|
16
|
-
webhookSecret: z.ZodString
|
|
15
|
+
webhookSecret: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
/**
|
|
17
|
+
* Multiplier applied to the amount before sending to the payment provider.
|
|
18
|
+
* Use this when your provider expects amounts in the smallest currency unit (e.g. cents)
|
|
19
|
+
* but Medusa is passing amounts in the major unit (e.g. euros).
|
|
20
|
+
*/
|
|
21
|
+
amountToCentsMultiplier: z.ZodDefault<z.ZodNumber>;
|
|
17
22
|
/**
|
|
18
23
|
* Whether to enable debug mode
|
|
19
|
-
* If enabled, the adapter will log debug information to the console
|
|
20
24
|
*/
|
|
21
25
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
22
26
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
provider: PayKitProvider
|
|
24
|
-
webhookSecret: string;
|
|
27
|
+
provider: _paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>;
|
|
28
|
+
webhookSecret: string | null;
|
|
29
|
+
amountToCentsMultiplier: number;
|
|
25
30
|
debug?: boolean | undefined;
|
|
26
31
|
}, {
|
|
27
|
-
provider: PayKitProvider
|
|
28
|
-
webhookSecret
|
|
32
|
+
provider: _paykit_sdk_core.PayKitProvider<_paykit_sdk_core.ProviderMetadataRegistry, any, Record<string, any>>;
|
|
33
|
+
webhookSecret?: string | null | undefined;
|
|
34
|
+
amountToCentsMultiplier?: number | undefined;
|
|
29
35
|
debug?: boolean | undefined;
|
|
30
36
|
}>;
|
|
31
37
|
type PaykitMedusaJSAdapterOptions = z.infer<typeof optionsSchema>;
|
|
@@ -35,17 +41,15 @@ declare class PaykitMedusaJSAdapter extends AbstractPaymentProvider<PaykitMedusa
|
|
|
35
41
|
* Will be stored as `pp_paykit_{id}` in Medusa
|
|
36
42
|
*/
|
|
37
43
|
static identifier: string;
|
|
38
|
-
protected readonly paykit: PayKit
|
|
39
|
-
protected readonly provider: PayKitProvider;
|
|
44
|
+
protected readonly paykit: PayKit<PaykitMedusaJSAdapterOptions['provider']>;
|
|
40
45
|
protected readonly options: PaykitMedusaJSAdapterOptions;
|
|
41
46
|
static validateOptions(options: Record<string, any>): void | never;
|
|
42
47
|
/**
|
|
43
|
-
* Constructor receives Medusa's container and provider options
|
|
44
|
-
*
|
|
45
48
|
* @param cradle - Medusa's dependency injection container
|
|
46
49
|
* @param options - PayKit provider configuration
|
|
47
50
|
*/
|
|
48
51
|
constructor(cradle: Record<string, unknown>, options: PaykitMedusaJSAdapterOptions);
|
|
52
|
+
private exec;
|
|
49
53
|
initiatePayment: ({ context, amount, currency_code, data, }: InitiatePaymentInput) => Promise<InitiatePaymentOutput>;
|
|
50
54
|
capturePayment: (input: CapturePaymentInput) => Promise<CapturePaymentOutput>;
|
|
51
55
|
authorizePayment: (input: AuthorizePaymentInput) => Promise<AuthorizePaymentOutput>;
|