redsys-easy 4.0.3 → 5.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.
- package/lib/assets/card-brands.d.ts +28 -28
- package/lib/assets/countries.d.ts +31 -31
- package/lib/assets/currencies.d.ts +36 -36
- package/lib/assets/error-codes.d.ts +17 -17
- package/lib/assets/lang-codes.d.ts +31 -31
- package/lib/assets/response-codes.d.ts +2 -2
- package/lib/assets/transaction-types.d.ts +56 -56
- package/lib/client.d.ts +85 -50
- package/lib/crypto.d.ts +25 -25
- package/lib/errors.d.ts +75 -75
- package/lib/formatter-utils.d.ts +24 -24
- package/lib/formatters/input-params.d.ts +21 -21
- package/lib/formatters/output-params.d.ts +29 -29
- package/lib/formatters/types.d.ts +316 -316
- package/lib/index.d.ts +30 -30
- package/lib/index.esm.js +3363 -1985
- package/lib/index.js +3363 -1996
- package/lib/rest/3ds.d.ts +31 -31
- package/lib/rest/json-serialization.d.ts +2 -2
- package/lib/rest/json-sha256-signature.d.ts +3 -3
- package/lib/rest/json.d.ts +3 -3
- package/lib/rest/requests.d.ts +8 -2
- package/lib/soap/notification-serialization.d.ts +3 -3
- package/lib/soap/notification-signature.d.ts +3 -3
- package/lib/soap/notification.d.ts +4 -4
- package/lib/soap/utils.d.ts +43 -43
- package/lib/types/3ds-params.d.ts +345 -345
- package/lib/types/api.d.ts +80 -80
- package/lib/types/input-params.d.ts +176 -176
- package/lib/types/output-params.d.ts +158 -158
- package/lib/utils/codes.d.ts +13 -13
- package/lib/utils/misc.d.ts +30 -24
- package/package.json +40 -41
package/lib/crypto.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Adds padding to a buffer.
|
|
4
|
-
*
|
|
5
|
-
* Rounds up the buffer length to the next block and uses 0 as padding.
|
|
6
|
-
*
|
|
7
|
-
* @params buf - Input buffer
|
|
8
|
-
* @params blocksize - Size of block
|
|
9
|
-
*/
|
|
10
|
-
export declare const zeroPad: (buf: Buffer, blocksize: number) => Buffer;
|
|
11
|
-
/**
|
|
12
|
-
* Encrypt a message using 3DES
|
|
13
|
-
*
|
|
14
|
-
* @params key - Key to encrypt message
|
|
15
|
-
* @params message - Message to be encrypted
|
|
16
|
-
*/
|
|
17
|
-
export declare const encrypt3DES: (key: string, message: string) => Buffer;
|
|
18
|
-
/**
|
|
19
|
-
* Compute HMAC_SHA256_V1 signature
|
|
20
|
-
*
|
|
21
|
-
* @params merchantKey - Key to encrypt message
|
|
22
|
-
* @params order - Order number
|
|
23
|
-
* @params params - Payload to sign
|
|
24
|
-
*/
|
|
25
|
-
export declare const sha256Sign: (merchantKey: string, order: string, params: string) => string;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds padding to a buffer.
|
|
4
|
+
*
|
|
5
|
+
* Rounds up the buffer length to the next block and uses 0 as padding.
|
|
6
|
+
*
|
|
7
|
+
* @params buf - Input buffer
|
|
8
|
+
* @params blocksize - Size of block
|
|
9
|
+
*/
|
|
10
|
+
export declare const zeroPad: (buf: Buffer, blocksize: number) => Buffer;
|
|
11
|
+
/**
|
|
12
|
+
* Encrypt a message using 3DES
|
|
13
|
+
*
|
|
14
|
+
* @params key - Key to encrypt message
|
|
15
|
+
* @params message - Message to be encrypted
|
|
16
|
+
*/
|
|
17
|
+
export declare const encrypt3DES: (key: string, message: string) => Buffer;
|
|
18
|
+
/**
|
|
19
|
+
* Compute HMAC_SHA256_V1 signature
|
|
20
|
+
*
|
|
21
|
+
* @params merchantKey - Key to encrypt message
|
|
22
|
+
* @params order - Order number
|
|
23
|
+
* @params params - Payload to sign
|
|
24
|
+
*/
|
|
25
|
+
export declare const sha256Sign: (merchantKey: string, order: string, params: string) => string;
|
package/lib/errors.d.ts
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error superclass for all redsys-easy specific errors
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export declare class RedsysError extends Error {
|
|
7
|
-
constructor(message: string);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Invalid input provided
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export declare class ValidationError extends RedsysError {
|
|
15
|
-
value: unknown;
|
|
16
|
-
parameters: object;
|
|
17
|
-
constructor(message: string, parameters: object);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Response cannot be parsed
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare class ParseError extends RedsysError {
|
|
25
|
-
value: unknown;
|
|
26
|
-
location: unknown | undefined;
|
|
27
|
-
description: string | undefined;
|
|
28
|
-
constructor(message: string, value?: unknown, location?: unknown);
|
|
29
|
-
}
|
|
30
|
-
interface HTTPErrorOptions {
|
|
31
|
-
message?: string;
|
|
32
|
-
code: number;
|
|
33
|
-
response?: unknown;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* HTTP Error
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export declare class HTTPError extends RedsysError {
|
|
41
|
-
code: number | undefined;
|
|
42
|
-
response: unknown | undefined;
|
|
43
|
-
constructor({ message, code, response }: HTTPErrorOptions);
|
|
44
|
-
}
|
|
45
|
-
interface GatewayErrorOptions {
|
|
46
|
-
message?: string;
|
|
47
|
-
code: string;
|
|
48
|
-
response?: unknown;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Request could not be processed by Redsys
|
|
52
|
-
*
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
export declare class GatewayError extends RedsysError {
|
|
56
|
-
code: string | undefined;
|
|
57
|
-
response: unknown | undefined;
|
|
58
|
-
constructor({ message, code, response }: GatewayErrorOptions);
|
|
59
|
-
}
|
|
60
|
-
interface ResponseErrorOptions {
|
|
61
|
-
message?: string;
|
|
62
|
-
code: number;
|
|
63
|
-
response?: unknown;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Response contained an error code
|
|
67
|
-
*
|
|
68
|
-
* @public
|
|
69
|
-
*/
|
|
70
|
-
export declare class ResponseError extends RedsysError {
|
|
71
|
-
code: number | undefined;
|
|
72
|
-
response: unknown | undefined;
|
|
73
|
-
constructor({ message, code, response }: ResponseErrorOptions);
|
|
74
|
-
}
|
|
75
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Error superclass for all redsys-easy specific errors
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class RedsysError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Invalid input provided
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare class ValidationError extends RedsysError {
|
|
15
|
+
value: unknown;
|
|
16
|
+
parameters: object;
|
|
17
|
+
constructor(message: string, parameters: object);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Response cannot be parsed
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare class ParseError extends RedsysError {
|
|
25
|
+
value: unknown;
|
|
26
|
+
location: unknown | undefined;
|
|
27
|
+
description: string | undefined;
|
|
28
|
+
constructor(message: string, value?: unknown, location?: unknown);
|
|
29
|
+
}
|
|
30
|
+
interface HTTPErrorOptions {
|
|
31
|
+
message?: string;
|
|
32
|
+
code: number;
|
|
33
|
+
response?: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* HTTP Error
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare class HTTPError extends RedsysError {
|
|
41
|
+
code: number | undefined;
|
|
42
|
+
response: unknown | undefined;
|
|
43
|
+
constructor({ message, code, response }: HTTPErrorOptions);
|
|
44
|
+
}
|
|
45
|
+
interface GatewayErrorOptions {
|
|
46
|
+
message?: string;
|
|
47
|
+
code: string;
|
|
48
|
+
response?: unknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Request could not be processed by Redsys
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare class GatewayError extends RedsysError {
|
|
56
|
+
code: string | undefined;
|
|
57
|
+
response: unknown | undefined;
|
|
58
|
+
constructor({ message, code, response }: GatewayErrorOptions);
|
|
59
|
+
}
|
|
60
|
+
interface ResponseErrorOptions {
|
|
61
|
+
message?: string;
|
|
62
|
+
code: number;
|
|
63
|
+
response?: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Response contained an error code
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export declare class ResponseError extends RedsysError {
|
|
71
|
+
code: number | undefined;
|
|
72
|
+
response: unknown | undefined;
|
|
73
|
+
constructor({ message, code, response }: ResponseErrorOptions);
|
|
74
|
+
}
|
|
75
|
+
export {};
|
package/lib/formatter-utils.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Applies an input formatter to the first argument of a function
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* The signature of this function is so complex because tries to suport
|
|
6
|
-
* formatters with generics that provide a default type. This should remain
|
|
7
|
-
* until [variadic generics](https://github.com/microsoft/TypeScript/issues/5453)
|
|
8
|
-
* land in typescript
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare const useSingleInputFormatter: <AF extends (input: any) => B, B, C extends readonly unknown[], D>(fn: (args_0: B, ...args_1: C) => D, inputFormatter: AF) => (input: Parameters<AF>[0], ...otherArgs_0: C) => D;
|
|
13
|
-
/**
|
|
14
|
-
* Applies an output formatter to a function
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export declare const useOutputFormatter: <A, B, C>(fn: (a: A) => B, outputFormatter: (b: B) => C) => (a: A) => C;
|
|
19
|
-
/**
|
|
20
|
-
* Applies an output formatter to the resolved ouput promise of a function
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare const usePromiseOutputFormatter: <A, B, C>(fn: (a: A) => Promise<B>, outputFormatter: (b: B) => C) => (a: A) => Promise<C>;
|
|
1
|
+
/**
|
|
2
|
+
* Applies an input formatter to the first argument of a function
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* The signature of this function is so complex because tries to suport
|
|
6
|
+
* formatters with generics that provide a default type. This should remain
|
|
7
|
+
* until [variadic generics](https://github.com/microsoft/TypeScript/issues/5453)
|
|
8
|
+
* land in typescript
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare const useSingleInputFormatter: <AF extends (input: any) => B, B, C extends readonly unknown[], D>(fn: (args_0: B, ...args_1: C) => D, inputFormatter: AF) => (input: Parameters<AF>[0], ...otherArgs_0: C) => D;
|
|
13
|
+
/**
|
|
14
|
+
* Applies an output formatter to a function
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare const useOutputFormatter: <A, B, C>(fn: (a: A) => B, outputFormatter: (b: B) => C) => (a: A) => C;
|
|
19
|
+
/**
|
|
20
|
+
* Applies an output formatter to the resolved ouput promise of a function
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare const usePromiseOutputFormatter: <A, B, C>(fn: (a: A) => Promise<B>, outputFormatter: (b: B) => C) => (a: A) => Promise<C>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { RedirectInputParams, RequestInputParams, RestIniciaPeticionInputParams, RestTrataPeticionInputParams } from '../types/input-params';
|
|
2
|
-
import type { RedirectFormatterInput, RequestFormatterInput, RestIniciaPeticionFormatterInput, RestTrataPeticionFormatterInput } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Redirection input formatter
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare const redirectInputFormatter: <RawInputParams extends Partial<RedirectInputParams> = Partial<RedirectInputParams>>(input: RedirectFormatterInput<RawInputParams>) => RedirectInputParams;
|
|
9
|
-
export declare const requestInputFormatter: <RawInputParams extends Partial<RequestInputParams>>(input: RequestFormatterInput<RawInputParams>) => RequestInputParams;
|
|
10
|
-
/**
|
|
11
|
-
* REST iniciaPeticion input formatter
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export declare const restIniciaPeticionInputFormatter: <RawInputParams extends Partial<RestIniciaPeticionInputParams> = Partial<RestIniciaPeticionInputParams>>(raw: RestIniciaPeticionFormatterInput<RawInputParams>) => RestIniciaPeticionInputParams;
|
|
16
|
-
/**
|
|
17
|
-
* REST trataPeticion input formatter
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export declare const restTrataPeticionInputFormatter: <RawInputParams extends Partial<RestTrataPeticionInputParams> = Partial<RestTrataPeticionInputParams>>(raw: RestTrataPeticionFormatterInput<RawInputParams>) => RestTrataPeticionInputParams;
|
|
1
|
+
import type { RedirectInputParams, RequestInputParams, RestIniciaPeticionInputParams, RestTrataPeticionInputParams } from '../types/input-params';
|
|
2
|
+
import type { RedirectFormatterInput, RequestFormatterInput, RestIniciaPeticionFormatterInput, RestTrataPeticionFormatterInput } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Redirection input formatter
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const redirectInputFormatter: <RawInputParams extends Partial<RedirectInputParams> = Partial<RedirectInputParams>>(input: RedirectFormatterInput<RawInputParams>) => RedirectInputParams;
|
|
9
|
+
export declare const requestInputFormatter: <RawInputParams extends Partial<RequestInputParams>>(input: RequestFormatterInput<RawInputParams>) => RequestInputParams;
|
|
10
|
+
/**
|
|
11
|
+
* REST iniciaPeticion input formatter
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare const restIniciaPeticionInputFormatter: <RawInputParams extends Partial<RestIniciaPeticionInputParams> = Partial<RestIniciaPeticionInputParams>>(raw: RestIniciaPeticionFormatterInput<RawInputParams>) => RestIniciaPeticionInputParams;
|
|
16
|
+
/**
|
|
17
|
+
* REST trataPeticion input formatter
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare const restTrataPeticionInputFormatter: <RawInputParams extends Partial<RestTrataPeticionInputParams> = Partial<RestTrataPeticionInputParams>>(raw: RestTrataPeticionFormatterInput<RawInputParams>) => RestTrataPeticionInputParams;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { BaseOutputParams, RestNotificationOutputParams, SoapNotificationOutputParams, RequestOutputParams, RestIniciaPeticionOutputParams, RestTrataPeticionOutputParams, ResolvedTransactionTrait } from '../types/output-params';
|
|
2
|
-
import type { BaseFormatterOutput, NotificationFormatterOutput, RequestFormatterOutput, RestIniciaPeticionFormatterOutput, RestTrataPeticionFormatterOutput, ResolvedTransactionTraitFormatterOutput } from './types';
|
|
3
|
-
export declare const baseOutputFormatter: <RawOutputParams extends BaseOutputParams>(raw: RawOutputParams) => BaseFormatterOutput<RawOutputParams>;
|
|
4
|
-
export declare const formatPrice: (params: Omit<ResolvedTransactionTrait, 'Ds_Response'>) => Omit<ResolvedTransactionTraitFormatterOutput, 'response'>;
|
|
5
|
-
/**
|
|
6
|
-
* REST notification formatter
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare const restNotificationOutputFormatter: <RawOutputParams extends RestNotificationOutputParams = RestNotificationOutputParams>(raw: RawOutputParams) => NotificationFormatterOutput<RawOutputParams>;
|
|
11
|
-
/**
|
|
12
|
-
* SOAP notification formatter
|
|
13
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export declare const soapNotificationOutputFormatter: <RawOutputParams extends SoapNotificationOutputParams = SoapNotificationOutputParams>(raw: RawOutputParams) => NotificationFormatterOutput<RawOutputParams>;
|
|
17
|
-
export declare const requestOutputFormatter: <RawOutputParams extends RequestOutputParams>(raw: RawOutputParams) => RequestFormatterOutput<RawOutputParams>;
|
|
18
|
-
/**
|
|
19
|
-
* REST iniciaPeticion output formatter
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export declare const restIniciaPeticionOutputFormatter: <RawOutputParams extends RestIniciaPeticionOutputParams = RestIniciaPeticionOutputParams>(raw: RawOutputParams) => RestIniciaPeticionFormatterOutput<RawOutputParams>;
|
|
24
|
-
/**
|
|
25
|
-
* REST trataPeticion output formatter
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export declare const restTrataPeticionOutputFormatter: <RawOutputParams extends RestTrataPeticionOutputParams = RestTrataPeticionOutputParams>(raw: RawOutputParams) => RestTrataPeticionFormatterOutput<RawOutputParams>;
|
|
1
|
+
import type { BaseOutputParams, RestNotificationOutputParams, SoapNotificationOutputParams, RequestOutputParams, RestIniciaPeticionOutputParams, RestTrataPeticionOutputParams, ResolvedTransactionTrait } from '../types/output-params';
|
|
2
|
+
import type { BaseFormatterOutput, NotificationFormatterOutput, RequestFormatterOutput, RestIniciaPeticionFormatterOutput, RestTrataPeticionFormatterOutput, ResolvedTransactionTraitFormatterOutput } from './types';
|
|
3
|
+
export declare const baseOutputFormatter: <RawOutputParams extends BaseOutputParams>(raw: RawOutputParams) => BaseFormatterOutput<RawOutputParams>;
|
|
4
|
+
export declare const formatPrice: (params: Omit<ResolvedTransactionTrait, 'Ds_Response'>) => Omit<ResolvedTransactionTraitFormatterOutput, 'response'>;
|
|
5
|
+
/**
|
|
6
|
+
* REST notification formatter
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare const restNotificationOutputFormatter: <RawOutputParams extends RestNotificationOutputParams = RestNotificationOutputParams>(raw: RawOutputParams) => NotificationFormatterOutput<RawOutputParams>;
|
|
11
|
+
/**
|
|
12
|
+
* SOAP notification formatter
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare const soapNotificationOutputFormatter: <RawOutputParams extends SoapNotificationOutputParams = SoapNotificationOutputParams>(raw: RawOutputParams) => NotificationFormatterOutput<RawOutputParams>;
|
|
17
|
+
export declare const requestOutputFormatter: <RawOutputParams extends RequestOutputParams>(raw: RawOutputParams) => RequestFormatterOutput<RawOutputParams>;
|
|
18
|
+
/**
|
|
19
|
+
* REST iniciaPeticion output formatter
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare const restIniciaPeticionOutputFormatter: <RawOutputParams extends RestIniciaPeticionOutputParams = RestIniciaPeticionOutputParams>(raw: RawOutputParams) => RestIniciaPeticionFormatterOutput<RawOutputParams>;
|
|
24
|
+
/**
|
|
25
|
+
* REST trataPeticion output formatter
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare const restTrataPeticionOutputFormatter: <RawOutputParams extends RestTrataPeticionOutputParams = RestTrataPeticionOutputParams>(raw: RawOutputParams) => RestTrataPeticionFormatterOutput<RawOutputParams>;
|