hs-playlib 0.1.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/README.md +59 -0
- package/dist/src/http_client.d.ts +52 -0
- package/dist/src/http_client.js +128 -0
- package/dist/src/index.d.ts +183 -0
- package/dist/src/index.js +117 -0
- package/dist/src/payments/_generated_connector_client_flows.d.ts +16 -0
- package/dist/src/payments/_generated_connector_client_flows.js +34 -0
- package/dist/src/payments/_generated_flows.js +26 -0
- package/dist/src/payments/_generated_uniffi_client_flows.d.ts +27 -0
- package/dist/src/payments/_generated_uniffi_client_flows.js +58 -0
- package/dist/src/payments/connector_client.d.ts +41 -0
- package/dist/src/payments/connector_client.js +102 -0
- package/dist/src/payments/generated/libconnector_service_ffi.dylib +0 -0
- package/dist/src/payments/generated/proto.d.ts +27658 -0
- package/dist/src/payments/generated/proto.js +82064 -0
- package/dist/src/payments/uniffi_client.d.ts +34 -0
- package/dist/src/payments/uniffi_client.js +213 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# JavaScript Payments SDK
|
|
2
|
+
|
|
3
|
+
Calls the connector FFI layer directly from Node.js using the same UniFFI shared
|
|
4
|
+
library as the Python and Kotlin SDKs. Uses `koffi` to call the C ABI —
|
|
5
|
+
**no NAPI required**.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Rust toolchain (`cargo`)
|
|
10
|
+
- Node.js 18+
|
|
11
|
+
- `npm`
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Build Rust lib, generate bindings and proto stubs, build tarball
|
|
17
|
+
make pack
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Test
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Verify the packed tarball installs and the FFI layer works end-to-end
|
|
24
|
+
make test-pack
|
|
25
|
+
|
|
26
|
+
# With full round-trip (requires valid Stripe test key)
|
|
27
|
+
STRIPE_API_KEY=sk_test_your_key make test-pack
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`test-pack` installs the tarball into an isolated temp directory and runs
|
|
31
|
+
`test_smoke.js`, which asserts the connector request URL and method, then
|
|
32
|
+
optionally exercises the full HTTP round-trip if `STRIPE_API_KEY` is set.
|
|
33
|
+
|
|
34
|
+
## Distribution
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Build tarball containing all available platform binaries (for CI / release)
|
|
38
|
+
make dist
|
|
39
|
+
# → artifacts/sdk-javascript/hyperswitch-payments-0.1.0.tgz
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## How it works
|
|
43
|
+
|
|
44
|
+
1. `make build-lib` — builds `backend/ffi` with `--features uniffi`
|
|
45
|
+
2. `make generate-bindings` — symlinks the `.dylib`/`.so` into `generated/`
|
|
46
|
+
3. `make generate-proto` — runs `pbjs` to produce `generated/proto.js` and `proto.d.ts`
|
|
47
|
+
4. `make pack-archive` — runs `npm pack` to produce the installable `.tgz`
|
|
48
|
+
|
|
49
|
+
## Architecture
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
src/payments/connector_client.js — high-level authorize() with HTTP round-trip
|
|
53
|
+
src/payments/uniffi_client.js — UniFFI C ABI wrapper using koffi (RustBuffer protocol)
|
|
54
|
+
src/payments/generated/proto.js — protobufjs static module (generated)
|
|
55
|
+
src/payments/generated/libconnector_service_ffi.* — native shared library
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
No code generation needed for JS — `uniffi_client.js` manually implements the
|
|
59
|
+
UniFFI RustBuffer serialization protocol.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Dispatcher } from "undici";
|
|
2
|
+
import { ucs } from "./payments/generated/proto";
|
|
3
|
+
/**
|
|
4
|
+
* Normalized HTTP Request structure for the Connector Service.
|
|
5
|
+
*/
|
|
6
|
+
export interface HttpRequest {
|
|
7
|
+
url: string;
|
|
8
|
+
method: string;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
body?: string | Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Normalized HTTP Response structure.
|
|
14
|
+
*/
|
|
15
|
+
export interface HttpResponse {
|
|
16
|
+
statusCode: number;
|
|
17
|
+
headers: Record<string, string>;
|
|
18
|
+
body: Uint8Array;
|
|
19
|
+
latencyMs: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* HTTP client configuration options.
|
|
23
|
+
* Uses proto-generated IHttpOptions as the base, with extended caCert type
|
|
24
|
+
* for better developer experience (accepts string, Buffer, or Uint8Array).
|
|
25
|
+
*/
|
|
26
|
+
export type HttpOptions = Omit<ucs.v2.IHttpOptions, 'caCert'> & {
|
|
27
|
+
caCert?: string | Buffer | Uint8Array;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Specialized error class for HTTP failures in the Connector Service.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ConnectorError extends Error {
|
|
33
|
+
message: string;
|
|
34
|
+
statusCode?: number | undefined;
|
|
35
|
+
errorCode?: "CONNECT_TIMEOUT" | "RESPONSE_TIMEOUT" | "TOTAL_TIMEOUT" | "NETWORK_FAILURE" | "INVALID_CONFIGURATION" | "CLIENT_INITIALIZATION" | string | undefined;
|
|
36
|
+
body?: string | undefined;
|
|
37
|
+
headers?: Record<string, string> | undefined;
|
|
38
|
+
constructor(message: string, statusCode?: number | undefined, errorCode?: "CONNECT_TIMEOUT" | "RESPONSE_TIMEOUT" | "TOTAL_TIMEOUT" | "NETWORK_FAILURE" | "INVALID_CONFIGURATION" | "CLIENT_INITIALIZATION" | string | undefined, body?: string | undefined, headers?: Record<string, string> | undefined);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve proxy URL, honoring bypass rules.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveProxyUrl(url: string, proxy?: HttpOptions["proxy"]): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a high-performance dispatcher with specialized fintech timeouts.
|
|
46
|
+
* (The instance-level connection pool)
|
|
47
|
+
*/
|
|
48
|
+
export declare function createDispatcher(config: HttpOptions): Dispatcher;
|
|
49
|
+
/**
|
|
50
|
+
* Standardized network execution engine for Unified Connector Service.
|
|
51
|
+
*/
|
|
52
|
+
export declare function execute(request: HttpRequest, options?: HttpOptions, dispatcher?: Dispatcher): Promise<HttpResponse>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConnectorError = void 0;
|
|
4
|
+
exports.resolveProxyUrl = resolveProxyUrl;
|
|
5
|
+
exports.createDispatcher = createDispatcher;
|
|
6
|
+
exports.execute = execute;
|
|
7
|
+
const undici_1 = require("undici");
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const proto_1 = require("./payments/generated/proto");
|
|
10
|
+
const Defaults = proto_1.ucs.v2.SdkDefault;
|
|
11
|
+
/**
|
|
12
|
+
* Specialized error class for HTTP failures in the Connector Service.
|
|
13
|
+
*/
|
|
14
|
+
class ConnectorError extends Error {
|
|
15
|
+
message;
|
|
16
|
+
statusCode;
|
|
17
|
+
errorCode;
|
|
18
|
+
body;
|
|
19
|
+
headers;
|
|
20
|
+
constructor(message, statusCode, errorCode, body, headers) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.message = message;
|
|
23
|
+
this.statusCode = statusCode;
|
|
24
|
+
this.errorCode = errorCode;
|
|
25
|
+
this.body = body;
|
|
26
|
+
this.headers = headers;
|
|
27
|
+
this.name = "ConnectorError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ConnectorError = ConnectorError;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve proxy URL, honoring bypass rules.
|
|
33
|
+
*/
|
|
34
|
+
function resolveProxyUrl(url, proxy) {
|
|
35
|
+
if (!proxy)
|
|
36
|
+
return null;
|
|
37
|
+
const shouldBypass = Array.isArray(proxy.bypassUrls) && proxy.bypassUrls.includes(url);
|
|
38
|
+
if (shouldBypass)
|
|
39
|
+
return null;
|
|
40
|
+
return proxy.httpsUrl || proxy.httpUrl || null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates a high-performance dispatcher with specialized fintech timeouts.
|
|
44
|
+
* (The instance-level connection pool)
|
|
45
|
+
*/
|
|
46
|
+
function createDispatcher(config) {
|
|
47
|
+
// Convert caCert to Uint8Array if provided as string or Buffer
|
|
48
|
+
let caCert;
|
|
49
|
+
if (config.caCert !== undefined) {
|
|
50
|
+
if (typeof config.caCert === 'string') {
|
|
51
|
+
caCert = new TextEncoder().encode(config.caCert);
|
|
52
|
+
}
|
|
53
|
+
else if (Buffer.isBuffer(config.caCert)) {
|
|
54
|
+
caCert = new Uint8Array(config.caCert);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
caCert = config.caCert;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const dispatcherOptions = {
|
|
61
|
+
connect: {
|
|
62
|
+
timeout: config.connectTimeoutMs ?? Defaults.CONNECT_TIMEOUT_MS,
|
|
63
|
+
ca: caCert,
|
|
64
|
+
},
|
|
65
|
+
headersTimeout: config.responseTimeoutMs ?? Defaults.RESPONSE_TIMEOUT_MS,
|
|
66
|
+
bodyTimeout: config.responseTimeoutMs ?? Defaults.RESPONSE_TIMEOUT_MS,
|
|
67
|
+
keepAliveTimeout: config.keepAliveTimeoutMs ?? Defaults.KEEP_ALIVE_TIMEOUT_MS,
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
const proxyUrl = config.proxy?.httpsUrl || config.proxy?.httpUrl;
|
|
71
|
+
return proxyUrl
|
|
72
|
+
? new undici_1.ProxyAgent({ uri: proxyUrl, ...dispatcherOptions })
|
|
73
|
+
: new undici_1.Agent(dispatcherOptions);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new ConnectorError(`Internal HTTP setup failed: ${error.message}`, 500, 'CLIENT_INITIALIZATION');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Standardized network execution engine for Unified Connector Service.
|
|
81
|
+
*/
|
|
82
|
+
async function execute(request, options = {}, dispatcher // Pass the instance-owned pool here
|
|
83
|
+
) {
|
|
84
|
+
const { url, method, headers, body } = request;
|
|
85
|
+
// Lifecycle Management
|
|
86
|
+
const totalTimeout = options.totalTimeoutMs ?? Defaults.TOTAL_TIMEOUT_MS;
|
|
87
|
+
const controller = new AbortController();
|
|
88
|
+
const timeoutId = setTimeout(() => controller.abort(), totalTimeout);
|
|
89
|
+
const startTime = Date.now();
|
|
90
|
+
try {
|
|
91
|
+
const response = await fetch(url, {
|
|
92
|
+
method: method.toUpperCase(),
|
|
93
|
+
headers: headers || {},
|
|
94
|
+
body: body ?? undefined,
|
|
95
|
+
redirect: "manual",
|
|
96
|
+
signal: controller.signal,
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
dispatcher,
|
|
99
|
+
});
|
|
100
|
+
const responseHeaders = {};
|
|
101
|
+
response.headers.forEach((v, k) => { responseHeaders[k.toLowerCase()] = v; });
|
|
102
|
+
return {
|
|
103
|
+
statusCode: response.status,
|
|
104
|
+
headers: responseHeaders,
|
|
105
|
+
body: new Uint8Array(await response.arrayBuffer()),
|
|
106
|
+
latencyMs: Date.now() - startTime
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (error.name === 'AbortError') {
|
|
111
|
+
throw new ConnectorError(`Total Request Timeout: ${method} ${url} exceeded ${totalTimeout}ms`, 504, 'TOTAL_TIMEOUT');
|
|
112
|
+
}
|
|
113
|
+
const cause = error.cause;
|
|
114
|
+
if (cause) {
|
|
115
|
+
if (cause.code === 'UND_ERR_CONNECT_TIMEOUT') {
|
|
116
|
+
throw new ConnectorError(`Connection Timeout: Failed to connect to ${url}`, 504, 'CONNECT_TIMEOUT');
|
|
117
|
+
}
|
|
118
|
+
if (cause.code === 'UND_ERR_BODY_TIMEOUT' || cause.code === 'UND_ERR_HEADERS_TIMEOUT') {
|
|
119
|
+
throw new ConnectorError(`Response Timeout: Gateway ${url} accepted connection but failed to respond`, 504, 'RESPONSE_TIMEOUT');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
throw new ConnectorError(`Network Error: ${error.message}`, 500, error.code || 'NETWORK_FAILURE');
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
clearTimeout(timeoutId);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=http_client.js.map
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { ucs } from "./payments/generated/proto";
|
|
2
|
+
export { ConnectorClient } from "./payments/_generated_connector_client_flows";
|
|
3
|
+
export { UniffiClient } from "./payments/_generated_uniffi_client_flows";
|
|
4
|
+
export type { RustBuffer, RustCallStatus } from "./payments/uniffi_client";
|
|
5
|
+
export * from "./http_client";
|
|
6
|
+
export declare const payments: {
|
|
7
|
+
PaymentServiceAuthorizeRequest: typeof ucs.v2.PaymentServiceAuthorizeRequest;
|
|
8
|
+
PaymentServiceAuthorizeResponse: typeof ucs.v2.PaymentServiceAuthorizeResponse;
|
|
9
|
+
PaymentServiceCaptureRequest: typeof ucs.v2.PaymentServiceCaptureRequest;
|
|
10
|
+
PaymentServiceCaptureResponse: typeof ucs.v2.PaymentServiceCaptureResponse;
|
|
11
|
+
PaymentServiceVoidRequest: typeof ucs.v2.PaymentServiceVoidRequest;
|
|
12
|
+
PaymentServiceVoidResponse: typeof ucs.v2.PaymentServiceVoidResponse;
|
|
13
|
+
PaymentServiceRefundRequest: typeof ucs.v2.PaymentServiceRefundRequest;
|
|
14
|
+
PaymentServiceReverseRequest: typeof ucs.v2.PaymentServiceReverseRequest;
|
|
15
|
+
PaymentServiceGetRequest: typeof ucs.v2.PaymentServiceGetRequest;
|
|
16
|
+
PaymentServiceGetResponse: typeof ucs.v2.PaymentServiceGetResponse;
|
|
17
|
+
PaymentServiceCreateOrderRequest: typeof ucs.v2.PaymentServiceCreateOrderRequest;
|
|
18
|
+
PaymentServiceCreateOrderResponse: typeof ucs.v2.PaymentServiceCreateOrderResponse;
|
|
19
|
+
PaymentServiceSetupRecurringRequest: typeof ucs.v2.PaymentServiceSetupRecurringRequest;
|
|
20
|
+
PaymentServiceSetupRecurringResponse: typeof ucs.v2.PaymentServiceSetupRecurringResponse;
|
|
21
|
+
PaymentServiceIncrementalAuthorizationRequest: typeof ucs.v2.PaymentServiceIncrementalAuthorizationRequest;
|
|
22
|
+
PaymentServiceIncrementalAuthorizationResponse: typeof ucs.v2.PaymentServiceIncrementalAuthorizationResponse;
|
|
23
|
+
PaymentServiceVerifyRedirectResponseRequest: typeof ucs.v2.PaymentServiceVerifyRedirectResponseRequest;
|
|
24
|
+
PaymentServiceVerifyRedirectResponseResponse: typeof ucs.v2.PaymentServiceVerifyRedirectResponseResponse;
|
|
25
|
+
PaymentServiceDisputeRequest: typeof ucs.v2.PaymentServiceDisputeRequest;
|
|
26
|
+
PaymentMethodAuthenticationServicePreAuthenticateRequest: typeof ucs.v2.PaymentMethodAuthenticationServicePreAuthenticateRequest;
|
|
27
|
+
PaymentMethodAuthenticationServicePreAuthenticateResponse: typeof ucs.v2.PaymentMethodAuthenticationServicePreAuthenticateResponse;
|
|
28
|
+
PaymentMethodAuthenticationServiceAuthenticateRequest: typeof ucs.v2.PaymentMethodAuthenticationServiceAuthenticateRequest;
|
|
29
|
+
PaymentMethodAuthenticationServiceAuthenticateResponse: typeof ucs.v2.PaymentMethodAuthenticationServiceAuthenticateResponse;
|
|
30
|
+
PaymentMethodServiceTokenizeRequest: typeof ucs.v2.PaymentMethodServiceTokenizeRequest;
|
|
31
|
+
PaymentMethodServiceTokenizeResponse: typeof ucs.v2.PaymentMethodServiceTokenizeResponse;
|
|
32
|
+
MerchantAuthenticationServiceCreateAccessTokenRequest: typeof ucs.v2.MerchantAuthenticationServiceCreateAccessTokenRequest;
|
|
33
|
+
MerchantAuthenticationServiceCreateAccessTokenResponse: typeof ucs.v2.MerchantAuthenticationServiceCreateAccessTokenResponse;
|
|
34
|
+
SecretString: typeof ucs.v2.SecretString;
|
|
35
|
+
AccessToken: typeof ucs.v2.AccessToken;
|
|
36
|
+
ConnectorState: typeof ucs.v2.ConnectorState;
|
|
37
|
+
Customer: typeof ucs.v2.Customer;
|
|
38
|
+
PaymentAddress: typeof ucs.v2.PaymentAddress;
|
|
39
|
+
Money: typeof ucs.v2.Money;
|
|
40
|
+
BrowserInformation: typeof ucs.v2.BrowserInformation;
|
|
41
|
+
CustomerAcceptance: typeof ucs.v2.CustomerAcceptance;
|
|
42
|
+
SessionToken: typeof ucs.v2.SessionToken;
|
|
43
|
+
ConnectorResponseData: typeof ucs.v2.ConnectorResponseData;
|
|
44
|
+
CardConnectorResponse: typeof ucs.v2.CardConnectorResponse;
|
|
45
|
+
ErrorInfo: typeof ucs.v2.ErrorInfo;
|
|
46
|
+
Currency: typeof ucs.v2.Currency;
|
|
47
|
+
CaptureMethod: typeof ucs.v2.CaptureMethod;
|
|
48
|
+
AuthenticationType: typeof ucs.v2.AuthenticationType;
|
|
49
|
+
PaymentMethodType: typeof ucs.v2.PaymentMethodType;
|
|
50
|
+
PaymentStatus: typeof ucs.v2.PaymentStatus;
|
|
51
|
+
RefundStatus: typeof ucs.v2.RefundStatus;
|
|
52
|
+
DisputeStatus: typeof ucs.v2.DisputeStatus;
|
|
53
|
+
MandateStatus: typeof ucs.v2.MandateStatus;
|
|
54
|
+
AuthorizationStatus: typeof ucs.v2.AuthorizationStatus;
|
|
55
|
+
OperationStatus: typeof ucs.v2.OperationStatus;
|
|
56
|
+
HttpMethod: typeof ucs.v2.HttpMethod;
|
|
57
|
+
FutureUsage: typeof ucs.v2.FutureUsage;
|
|
58
|
+
PaymentExperience: typeof ucs.v2.PaymentExperience;
|
|
59
|
+
PaymentChannel: typeof ucs.v2.PaymentChannel;
|
|
60
|
+
Connector: typeof ucs.v2.Connector;
|
|
61
|
+
ProductType: typeof ucs.v2.ProductType;
|
|
62
|
+
DisputeStage: typeof ucs.v2.DisputeStage;
|
|
63
|
+
Tokenization: typeof ucs.v2.Tokenization;
|
|
64
|
+
WebhookEventType: typeof ucs.v2.WebhookEventType;
|
|
65
|
+
ThreeDsCompletionIndicator: typeof ucs.v2.ThreeDsCompletionIndicator;
|
|
66
|
+
TransactionStatus: typeof ucs.v2.TransactionStatus;
|
|
67
|
+
ExemptionIndicator: typeof ucs.v2.ExemptionIndicator;
|
|
68
|
+
MitCategory: typeof ucs.v2.MitCategory;
|
|
69
|
+
SyncRequestType: typeof ucs.v2.SyncRequestType;
|
|
70
|
+
AcceptanceType: typeof ucs.v2.AcceptanceType;
|
|
71
|
+
CavvAlgorithm: typeof ucs.v2.CavvAlgorithm;
|
|
72
|
+
};
|
|
73
|
+
export declare const payment_methods: {
|
|
74
|
+
PaymentMethod: typeof ucs.v2.PaymentMethod;
|
|
75
|
+
CardNumberType: typeof ucs.v2.CardNumberType;
|
|
76
|
+
CardDetails: typeof ucs.v2.CardDetails;
|
|
77
|
+
CardRedirect: typeof ucs.v2.CardRedirect;
|
|
78
|
+
};
|
|
79
|
+
export declare const configs: {
|
|
80
|
+
EnvOptions: typeof ucs.v2.EnvOptions;
|
|
81
|
+
FfiOptions: typeof ucs.v2.FfiOptions;
|
|
82
|
+
FfiConnectorHttpRequest: typeof ucs.v2.FfiConnectorHttpRequest;
|
|
83
|
+
FfiConnectorHttpResponse: typeof ucs.v2.FfiConnectorHttpResponse;
|
|
84
|
+
};
|
|
85
|
+
export declare namespace payments {
|
|
86
|
+
type IPaymentServiceAuthorizeRequest = ucs.v2.IPaymentServiceAuthorizeRequest;
|
|
87
|
+
type IPaymentServiceAuthorizeResponse = ucs.v2.IPaymentServiceAuthorizeResponse;
|
|
88
|
+
type IPaymentServiceCaptureRequest = ucs.v2.IPaymentServiceCaptureRequest;
|
|
89
|
+
type IPaymentServiceCaptureResponse = ucs.v2.IPaymentServiceCaptureResponse;
|
|
90
|
+
type IPaymentServiceVoidRequest = ucs.v2.IPaymentServiceVoidRequest;
|
|
91
|
+
type IPaymentServiceVoidResponse = ucs.v2.IPaymentServiceVoidResponse;
|
|
92
|
+
type IPaymentServiceRefundRequest = ucs.v2.IPaymentServiceRefundRequest;
|
|
93
|
+
type IPaymentServiceReverseRequest = ucs.v2.IPaymentServiceReverseRequest;
|
|
94
|
+
type IPaymentServiceGetRequest = ucs.v2.IPaymentServiceGetRequest;
|
|
95
|
+
type IPaymentServiceGetResponse = ucs.v2.IPaymentServiceGetResponse;
|
|
96
|
+
type IPaymentServiceCreateOrderRequest = ucs.v2.IPaymentServiceCreateOrderRequest;
|
|
97
|
+
type IPaymentServiceCreateOrderResponse = ucs.v2.IPaymentServiceCreateOrderResponse;
|
|
98
|
+
type IPaymentServiceSetupRecurringRequest = ucs.v2.IPaymentServiceSetupRecurringRequest;
|
|
99
|
+
type IPaymentServiceSetupRecurringResponse = ucs.v2.IPaymentServiceSetupRecurringResponse;
|
|
100
|
+
type IPaymentServiceIncrementalAuthorizationRequest = ucs.v2.IPaymentServiceIncrementalAuthorizationRequest;
|
|
101
|
+
type IPaymentServiceIncrementalAuthorizationResponse = ucs.v2.IPaymentServiceIncrementalAuthorizationResponse;
|
|
102
|
+
type IPaymentServiceVerifyRedirectResponseRequest = ucs.v2.IPaymentServiceVerifyRedirectResponseRequest;
|
|
103
|
+
type IPaymentServiceVerifyRedirectResponseResponse = ucs.v2.IPaymentServiceVerifyRedirectResponseResponse;
|
|
104
|
+
type IPaymentServiceDisputeRequest = ucs.v2.IPaymentServiceDisputeRequest;
|
|
105
|
+
type IPaymentMethodAuthenticationServicePreAuthenticateRequest = ucs.v2.IPaymentMethodAuthenticationServicePreAuthenticateRequest;
|
|
106
|
+
type IPaymentMethodAuthenticationServicePreAuthenticateResponse = ucs.v2.IPaymentMethodAuthenticationServicePreAuthenticateResponse;
|
|
107
|
+
type IPaymentMethodAuthenticationServiceAuthenticateRequest = ucs.v2.IPaymentMethodAuthenticationServiceAuthenticateRequest;
|
|
108
|
+
type IPaymentMethodAuthenticationServiceAuthenticateResponse = ucs.v2.IPaymentMethodAuthenticationServiceAuthenticateResponse;
|
|
109
|
+
type IPaymentMethodServiceTokenizeRequest = ucs.v2.IPaymentMethodServiceTokenizeRequest;
|
|
110
|
+
type IPaymentMethodServiceTokenizeResponse = ucs.v2.IPaymentMethodServiceTokenizeResponse;
|
|
111
|
+
type IMerchantAuthenticationServiceCreateAccessTokenRequest = ucs.v2.IMerchantAuthenticationServiceCreateAccessTokenRequest;
|
|
112
|
+
type IMerchantAuthenticationServiceCreateAccessTokenResponse = ucs.v2.IMerchantAuthenticationServiceCreateAccessTokenResponse;
|
|
113
|
+
type ISecretString = ucs.v2.ISecretString;
|
|
114
|
+
type IAccessToken = ucs.v2.IAccessToken;
|
|
115
|
+
type IConnectorState = ucs.v2.IConnectorState;
|
|
116
|
+
type ICustomer = ucs.v2.ICustomer;
|
|
117
|
+
type IPaymentAddress = ucs.v2.IPaymentAddress;
|
|
118
|
+
type IMoney = ucs.v2.IMoney;
|
|
119
|
+
type IBrowserInformation = ucs.v2.IBrowserInformation;
|
|
120
|
+
type ICustomerAcceptance = ucs.v2.ICustomerAcceptance;
|
|
121
|
+
type ISessionToken = ucs.v2.ISessionToken;
|
|
122
|
+
type IConnectorResponseData = ucs.v2.IConnectorResponseData;
|
|
123
|
+
type ICardConnectorResponse = ucs.v2.ICardConnectorResponse;
|
|
124
|
+
type IErrorInfo = ucs.v2.IErrorInfo;
|
|
125
|
+
type PaymentServiceAuthorizeRequest = ucs.v2.PaymentServiceAuthorizeRequest;
|
|
126
|
+
type PaymentServiceAuthorizeResponse = ucs.v2.PaymentServiceAuthorizeResponse;
|
|
127
|
+
type PaymentServiceCaptureRequest = ucs.v2.PaymentServiceCaptureRequest;
|
|
128
|
+
type PaymentServiceCaptureResponse = ucs.v2.PaymentServiceCaptureResponse;
|
|
129
|
+
type PaymentServiceVoidRequest = ucs.v2.PaymentServiceVoidRequest;
|
|
130
|
+
type PaymentServiceVoidResponse = ucs.v2.PaymentServiceVoidResponse;
|
|
131
|
+
type PaymentServiceRefundRequest = ucs.v2.PaymentServiceRefundRequest;
|
|
132
|
+
type PaymentServiceReverseRequest = ucs.v2.PaymentServiceReverseRequest;
|
|
133
|
+
type PaymentServiceGetRequest = ucs.v2.PaymentServiceGetRequest;
|
|
134
|
+
type PaymentServiceGetResponse = ucs.v2.PaymentServiceGetResponse;
|
|
135
|
+
type PaymentServiceCreateOrderRequest = ucs.v2.PaymentServiceCreateOrderRequest;
|
|
136
|
+
type PaymentServiceCreateOrderResponse = ucs.v2.PaymentServiceCreateOrderResponse;
|
|
137
|
+
type PaymentServiceSetupRecurringRequest = ucs.v2.PaymentServiceSetupRecurringRequest;
|
|
138
|
+
type PaymentServiceSetupRecurringResponse = ucs.v2.PaymentServiceSetupRecurringResponse;
|
|
139
|
+
type PaymentServiceIncrementalAuthorizationRequest = ucs.v2.PaymentServiceIncrementalAuthorizationRequest;
|
|
140
|
+
type PaymentServiceIncrementalAuthorizationResponse = ucs.v2.PaymentServiceIncrementalAuthorizationResponse;
|
|
141
|
+
type PaymentServiceVerifyRedirectResponseRequest = ucs.v2.PaymentServiceVerifyRedirectResponseRequest;
|
|
142
|
+
type PaymentServiceVerifyRedirectResponseResponse = ucs.v2.PaymentServiceVerifyRedirectResponseResponse;
|
|
143
|
+
type PaymentServiceDisputeRequest = ucs.v2.PaymentServiceDisputeRequest;
|
|
144
|
+
type PaymentMethodAuthenticationServicePreAuthenticateRequest = ucs.v2.PaymentMethodAuthenticationServicePreAuthenticateRequest;
|
|
145
|
+
type PaymentMethodAuthenticationServicePreAuthenticateResponse = ucs.v2.PaymentMethodAuthenticationServicePreAuthenticateResponse;
|
|
146
|
+
type PaymentMethodAuthenticationServiceAuthenticateRequest = ucs.v2.PaymentMethodAuthenticationServiceAuthenticateRequest;
|
|
147
|
+
type PaymentMethodAuthenticationServiceAuthenticateResponse = ucs.v2.PaymentMethodAuthenticationServiceAuthenticateResponse;
|
|
148
|
+
type PaymentMethodServiceTokenizeRequest = ucs.v2.PaymentMethodServiceTokenizeRequest;
|
|
149
|
+
type PaymentMethodServiceTokenizeResponse = ucs.v2.PaymentMethodServiceTokenizeResponse;
|
|
150
|
+
type MerchantAuthenticationServiceCreateAccessTokenRequest = ucs.v2.MerchantAuthenticationServiceCreateAccessTokenRequest;
|
|
151
|
+
type MerchantAuthenticationServiceCreateAccessTokenResponse = ucs.v2.MerchantAuthenticationServiceCreateAccessTokenResponse;
|
|
152
|
+
type SecretString = ucs.v2.SecretString;
|
|
153
|
+
type AccessToken = ucs.v2.AccessToken;
|
|
154
|
+
type ConnectorState = ucs.v2.ConnectorState;
|
|
155
|
+
type Customer = ucs.v2.Customer;
|
|
156
|
+
type PaymentAddress = ucs.v2.PaymentAddress;
|
|
157
|
+
type Money = ucs.v2.Money;
|
|
158
|
+
type BrowserInformation = ucs.v2.BrowserInformation;
|
|
159
|
+
type CustomerAcceptance = ucs.v2.CustomerAcceptance;
|
|
160
|
+
type SessionToken = ucs.v2.SessionToken;
|
|
161
|
+
type ConnectorResponseData = ucs.v2.ConnectorResponseData;
|
|
162
|
+
type CardConnectorResponse = ucs.v2.CardConnectorResponse;
|
|
163
|
+
type ErrorInfo = ucs.v2.ErrorInfo;
|
|
164
|
+
}
|
|
165
|
+
export declare namespace payment_methods {
|
|
166
|
+
type IPaymentMethod = ucs.v2.IPaymentMethod;
|
|
167
|
+
type ICardDetails = ucs.v2.ICardDetails;
|
|
168
|
+
type ICardRedirect = ucs.v2.ICardRedirect;
|
|
169
|
+
type PaymentMethod = ucs.v2.PaymentMethod;
|
|
170
|
+
type CardNumberType = ucs.v2.CardNumberType;
|
|
171
|
+
type CardDetails = ucs.v2.CardDetails;
|
|
172
|
+
type CardRedirect = ucs.v2.CardRedirect;
|
|
173
|
+
}
|
|
174
|
+
export declare namespace configs {
|
|
175
|
+
type IEnvOptions = ucs.v2.IEnvOptions;
|
|
176
|
+
type IFfiOptions = ucs.v2.IFfiOptions;
|
|
177
|
+
type IFfiConnectorHttpRequest = ucs.v2.IFfiConnectorHttpRequest;
|
|
178
|
+
type IFfiConnectorHttpResponse = ucs.v2.IFfiConnectorHttpResponse;
|
|
179
|
+
type EnvOptions = ucs.v2.EnvOptions;
|
|
180
|
+
type FfiOptions = ucs.v2.FfiOptions;
|
|
181
|
+
type FfiConnectorHttpRequest = ucs.v2.FfiConnectorHttpRequest;
|
|
182
|
+
type FfiConnectorHttpResponse = ucs.v2.FfiConnectorHttpResponse;
|
|
183
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.configs = exports.payment_methods = exports.payments = exports.UniffiClient = exports.ConnectorClient = void 0;
|
|
18
|
+
const proto_1 = require("./payments/generated/proto");
|
|
19
|
+
// Re-export client classes flat (high-level API)
|
|
20
|
+
var _generated_connector_client_flows_1 = require("./payments/_generated_connector_client_flows");
|
|
21
|
+
Object.defineProperty(exports, "ConnectorClient", { enumerable: true, get: function () { return _generated_connector_client_flows_1.ConnectorClient; } });
|
|
22
|
+
var _generated_uniffi_client_flows_1 = require("./payments/_generated_uniffi_client_flows");
|
|
23
|
+
Object.defineProperty(exports, "UniffiClient", { enumerable: true, get: function () { return _generated_uniffi_client_flows_1.UniffiClient; } });
|
|
24
|
+
__exportStar(require("./http_client"), exports);
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Domain namespaces — runtime values
|
|
27
|
+
// Usage: import { payments, payment_methods, configs } from 'hyperswitch-payments';
|
|
28
|
+
// const req = payments.PaymentServiceAuthorizeRequest.create({ ... });
|
|
29
|
+
// const opts: configs.IFfiOptions = configs.FfiOptions.create({ ... });
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
exports.payments = {
|
|
32
|
+
// Request / Response types
|
|
33
|
+
PaymentServiceAuthorizeRequest: proto_1.ucs.v2.PaymentServiceAuthorizeRequest,
|
|
34
|
+
PaymentServiceAuthorizeResponse: proto_1.ucs.v2.PaymentServiceAuthorizeResponse,
|
|
35
|
+
PaymentServiceCaptureRequest: proto_1.ucs.v2.PaymentServiceCaptureRequest,
|
|
36
|
+
PaymentServiceCaptureResponse: proto_1.ucs.v2.PaymentServiceCaptureResponse,
|
|
37
|
+
PaymentServiceVoidRequest: proto_1.ucs.v2.PaymentServiceVoidRequest,
|
|
38
|
+
PaymentServiceVoidResponse: proto_1.ucs.v2.PaymentServiceVoidResponse,
|
|
39
|
+
PaymentServiceRefundRequest: proto_1.ucs.v2.PaymentServiceRefundRequest,
|
|
40
|
+
PaymentServiceReverseRequest: proto_1.ucs.v2.PaymentServiceReverseRequest,
|
|
41
|
+
PaymentServiceGetRequest: proto_1.ucs.v2.PaymentServiceGetRequest,
|
|
42
|
+
PaymentServiceGetResponse: proto_1.ucs.v2.PaymentServiceGetResponse,
|
|
43
|
+
PaymentServiceCreateOrderRequest: proto_1.ucs.v2.PaymentServiceCreateOrderRequest,
|
|
44
|
+
PaymentServiceCreateOrderResponse: proto_1.ucs.v2.PaymentServiceCreateOrderResponse,
|
|
45
|
+
PaymentServiceSetupRecurringRequest: proto_1.ucs.v2.PaymentServiceSetupRecurringRequest,
|
|
46
|
+
PaymentServiceSetupRecurringResponse: proto_1.ucs.v2.PaymentServiceSetupRecurringResponse,
|
|
47
|
+
PaymentServiceIncrementalAuthorizationRequest: proto_1.ucs.v2.PaymentServiceIncrementalAuthorizationRequest,
|
|
48
|
+
PaymentServiceIncrementalAuthorizationResponse: proto_1.ucs.v2.PaymentServiceIncrementalAuthorizationResponse,
|
|
49
|
+
PaymentServiceVerifyRedirectResponseRequest: proto_1.ucs.v2.PaymentServiceVerifyRedirectResponseRequest,
|
|
50
|
+
PaymentServiceVerifyRedirectResponseResponse: proto_1.ucs.v2.PaymentServiceVerifyRedirectResponseResponse,
|
|
51
|
+
PaymentServiceDisputeRequest: proto_1.ucs.v2.PaymentServiceDisputeRequest,
|
|
52
|
+
// Authentication types
|
|
53
|
+
PaymentMethodAuthenticationServicePreAuthenticateRequest: proto_1.ucs.v2.PaymentMethodAuthenticationServicePreAuthenticateRequest,
|
|
54
|
+
PaymentMethodAuthenticationServicePreAuthenticateResponse: proto_1.ucs.v2.PaymentMethodAuthenticationServicePreAuthenticateResponse,
|
|
55
|
+
PaymentMethodAuthenticationServiceAuthenticateRequest: proto_1.ucs.v2.PaymentMethodAuthenticationServiceAuthenticateRequest,
|
|
56
|
+
PaymentMethodAuthenticationServiceAuthenticateResponse: proto_1.ucs.v2.PaymentMethodAuthenticationServiceAuthenticateResponse,
|
|
57
|
+
// Tokenization
|
|
58
|
+
PaymentMethodServiceTokenizeRequest: proto_1.ucs.v2.PaymentMethodServiceTokenizeRequest,
|
|
59
|
+
PaymentMethodServiceTokenizeResponse: proto_1.ucs.v2.PaymentMethodServiceTokenizeResponse,
|
|
60
|
+
// Access token types
|
|
61
|
+
MerchantAuthenticationServiceCreateAccessTokenRequest: proto_1.ucs.v2.MerchantAuthenticationServiceCreateAccessTokenRequest,
|
|
62
|
+
MerchantAuthenticationServiceCreateAccessTokenResponse: proto_1.ucs.v2.MerchantAuthenticationServiceCreateAccessTokenResponse,
|
|
63
|
+
// Data types
|
|
64
|
+
SecretString: proto_1.ucs.v2.SecretString,
|
|
65
|
+
AccessToken: proto_1.ucs.v2.AccessToken,
|
|
66
|
+
ConnectorState: proto_1.ucs.v2.ConnectorState,
|
|
67
|
+
Customer: proto_1.ucs.v2.Customer,
|
|
68
|
+
PaymentAddress: proto_1.ucs.v2.PaymentAddress,
|
|
69
|
+
Money: proto_1.ucs.v2.Money,
|
|
70
|
+
BrowserInformation: proto_1.ucs.v2.BrowserInformation,
|
|
71
|
+
CustomerAcceptance: proto_1.ucs.v2.CustomerAcceptance,
|
|
72
|
+
SessionToken: proto_1.ucs.v2.SessionToken,
|
|
73
|
+
// Response data types
|
|
74
|
+
ConnectorResponseData: proto_1.ucs.v2.ConnectorResponseData,
|
|
75
|
+
CardConnectorResponse: proto_1.ucs.v2.CardConnectorResponse,
|
|
76
|
+
ErrorInfo: proto_1.ucs.v2.ErrorInfo,
|
|
77
|
+
// Enums
|
|
78
|
+
Currency: proto_1.ucs.v2.Currency,
|
|
79
|
+
CaptureMethod: proto_1.ucs.v2.CaptureMethod,
|
|
80
|
+
AuthenticationType: proto_1.ucs.v2.AuthenticationType,
|
|
81
|
+
PaymentMethodType: proto_1.ucs.v2.PaymentMethodType,
|
|
82
|
+
PaymentStatus: proto_1.ucs.v2.PaymentStatus,
|
|
83
|
+
RefundStatus: proto_1.ucs.v2.RefundStatus,
|
|
84
|
+
DisputeStatus: proto_1.ucs.v2.DisputeStatus,
|
|
85
|
+
MandateStatus: proto_1.ucs.v2.MandateStatus,
|
|
86
|
+
AuthorizationStatus: proto_1.ucs.v2.AuthorizationStatus,
|
|
87
|
+
OperationStatus: proto_1.ucs.v2.OperationStatus,
|
|
88
|
+
HttpMethod: proto_1.ucs.v2.HttpMethod,
|
|
89
|
+
FutureUsage: proto_1.ucs.v2.FutureUsage,
|
|
90
|
+
PaymentExperience: proto_1.ucs.v2.PaymentExperience,
|
|
91
|
+
PaymentChannel: proto_1.ucs.v2.PaymentChannel,
|
|
92
|
+
Connector: proto_1.ucs.v2.Connector,
|
|
93
|
+
ProductType: proto_1.ucs.v2.ProductType,
|
|
94
|
+
DisputeStage: proto_1.ucs.v2.DisputeStage,
|
|
95
|
+
Tokenization: proto_1.ucs.v2.Tokenization,
|
|
96
|
+
WebhookEventType: proto_1.ucs.v2.WebhookEventType,
|
|
97
|
+
ThreeDsCompletionIndicator: proto_1.ucs.v2.ThreeDsCompletionIndicator,
|
|
98
|
+
TransactionStatus: proto_1.ucs.v2.TransactionStatus,
|
|
99
|
+
ExemptionIndicator: proto_1.ucs.v2.ExemptionIndicator,
|
|
100
|
+
MitCategory: proto_1.ucs.v2.MitCategory,
|
|
101
|
+
SyncRequestType: proto_1.ucs.v2.SyncRequestType,
|
|
102
|
+
AcceptanceType: proto_1.ucs.v2.AcceptanceType,
|
|
103
|
+
CavvAlgorithm: proto_1.ucs.v2.CavvAlgorithm,
|
|
104
|
+
};
|
|
105
|
+
exports.payment_methods = {
|
|
106
|
+
PaymentMethod: proto_1.ucs.v2.PaymentMethod,
|
|
107
|
+
CardNumberType: proto_1.ucs.v2.CardNumberType,
|
|
108
|
+
CardDetails: proto_1.ucs.v2.CardDetails,
|
|
109
|
+
CardRedirect: proto_1.ucs.v2.CardRedirect,
|
|
110
|
+
};
|
|
111
|
+
exports.configs = {
|
|
112
|
+
EnvOptions: proto_1.ucs.v2.EnvOptions,
|
|
113
|
+
FfiOptions: proto_1.ucs.v2.FfiOptions,
|
|
114
|
+
FfiConnectorHttpRequest: proto_1.ucs.v2.FfiConnectorHttpRequest,
|
|
115
|
+
FfiConnectorHttpResponse: proto_1.ucs.v2.FfiConnectorHttpResponse,
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ConnectorClient as _ConnectorClientBase } from "./connector_client";
|
|
2
|
+
import { ucs } from "./generated/proto";
|
|
3
|
+
export declare class ConnectorClient extends _ConnectorClientBase {
|
|
4
|
+
/** PaymentService.Authorize — Authorize a payment amount on a payment method. This reserves funds without capturing them, essential for verifying availability before finalizing. */
|
|
5
|
+
authorize(requestMsg: ucs.v2.IPaymentServiceAuthorizeRequest, metadata: Record<string, string>, ffiOptions?: ucs.v2.IFfiOptions | null): Promise<ucs.v2.PaymentServiceAuthorizeResponse>;
|
|
6
|
+
/** PaymentService.Capture — Finalize an authorized payment transaction. Transfers reserved funds from customer to merchant account, completing the payment lifecycle. */
|
|
7
|
+
capture(requestMsg: ucs.v2.IPaymentServiceCaptureRequest, metadata: Record<string, string>, ffiOptions?: ucs.v2.IFfiOptions | null): Promise<ucs.v2.PaymentServiceCaptureResponse>;
|
|
8
|
+
/** MerchantAuthenticationService.CreateAccessToken — Generate short-lived connector authentication token. Provides secure credentials for connector API access without storing secrets client-side. */
|
|
9
|
+
createAccessToken(requestMsg: ucs.v2.IMerchantAuthenticationServiceCreateAccessTokenRequest, metadata: Record<string, string>, ffiOptions?: ucs.v2.IFfiOptions | null): Promise<ucs.v2.MerchantAuthenticationServiceCreateAccessTokenResponse>;
|
|
10
|
+
/** PaymentService.Get — Retrieve current payment status from the payment processor. Enables synchronization between your system and payment processors for accurate state tracking. */
|
|
11
|
+
get(requestMsg: ucs.v2.IPaymentServiceGetRequest, metadata: Record<string, string>, ffiOptions?: ucs.v2.IFfiOptions | null): Promise<ucs.v2.PaymentServiceGetResponse>;
|
|
12
|
+
/** PaymentService.Refund — Initiate a refund to customer's payment method. Returns funds for returns, cancellations, or service adjustments after original payment. */
|
|
13
|
+
refund(requestMsg: ucs.v2.IPaymentServiceRefundRequest, metadata: Record<string, string>, ffiOptions?: ucs.v2.IFfiOptions | null): Promise<ucs.v2.RefundResponse>;
|
|
14
|
+
/** PaymentService.Void — Cancel an authorized payment before capture. Releases held funds back to customer, typically used when orders are cancelled or abandoned. */
|
|
15
|
+
void(requestMsg: ucs.v2.IPaymentServiceVoidRequest, metadata: Record<string, string>, ffiOptions?: ucs.v2.IFfiOptions | null): Promise<ucs.v2.PaymentServiceVoidResponse>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AUTO-GENERATED — do not edit by hand.
|
|
3
|
+
// Source: services.proto ∩ bindings/uniffi.rs | Regenerate: make generate
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ConnectorClient = void 0;
|
|
6
|
+
const connector_client_1 = require("./connector_client");
|
|
7
|
+
class ConnectorClient extends connector_client_1.ConnectorClient {
|
|
8
|
+
/** PaymentService.Authorize — Authorize a payment amount on a payment method. This reserves funds without capturing them, essential for verifying availability before finalizing. */
|
|
9
|
+
async authorize(requestMsg, metadata, ffiOptions) {
|
|
10
|
+
return this._executeFlow('authorize', requestMsg, metadata, ffiOptions, 'PaymentServiceAuthorizeRequest', 'PaymentServiceAuthorizeResponse');
|
|
11
|
+
}
|
|
12
|
+
/** PaymentService.Capture — Finalize an authorized payment transaction. Transfers reserved funds from customer to merchant account, completing the payment lifecycle. */
|
|
13
|
+
async capture(requestMsg, metadata, ffiOptions) {
|
|
14
|
+
return this._executeFlow('capture', requestMsg, metadata, ffiOptions, 'PaymentServiceCaptureRequest', 'PaymentServiceCaptureResponse');
|
|
15
|
+
}
|
|
16
|
+
/** MerchantAuthenticationService.CreateAccessToken — Generate short-lived connector authentication token. Provides secure credentials for connector API access without storing secrets client-side. */
|
|
17
|
+
async createAccessToken(requestMsg, metadata, ffiOptions) {
|
|
18
|
+
return this._executeFlow('create_access_token', requestMsg, metadata, ffiOptions, 'MerchantAuthenticationServiceCreateAccessTokenRequest', 'MerchantAuthenticationServiceCreateAccessTokenResponse');
|
|
19
|
+
}
|
|
20
|
+
/** PaymentService.Get — Retrieve current payment status from the payment processor. Enables synchronization between your system and payment processors for accurate state tracking. */
|
|
21
|
+
async get(requestMsg, metadata, ffiOptions) {
|
|
22
|
+
return this._executeFlow('get', requestMsg, metadata, ffiOptions, 'PaymentServiceGetRequest', 'PaymentServiceGetResponse');
|
|
23
|
+
}
|
|
24
|
+
/** PaymentService.Refund — Initiate a refund to customer's payment method. Returns funds for returns, cancellations, or service adjustments after original payment. */
|
|
25
|
+
async refund(requestMsg, metadata, ffiOptions) {
|
|
26
|
+
return this._executeFlow('refund', requestMsg, metadata, ffiOptions, 'PaymentServiceRefundRequest', 'RefundResponse');
|
|
27
|
+
}
|
|
28
|
+
/** PaymentService.Void — Cancel an authorized payment before capture. Releases held funds back to customer, typically used when orders are cancelled or abandoned. */
|
|
29
|
+
async void(requestMsg, metadata, ffiOptions) {
|
|
30
|
+
return this._executeFlow('void', requestMsg, metadata, ffiOptions, 'PaymentServiceVoidRequest', 'PaymentServiceVoidResponse');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ConnectorClient = ConnectorClient;
|
|
34
|
+
//# sourceMappingURL=_generated_connector_client_flows.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// AUTO-GENERATED — do not edit by hand.
|
|
2
|
+
// Source: services.proto ∩ bindings/uniffi.rs | Regenerate: make generate
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const FLOWS = {
|
|
6
|
+
// authorize: PaymentService.Authorize — Authorize a payment amount on a payment method. This reserves funds without capturing them, essential for verifying availability before finalizing.
|
|
7
|
+
authorize : { request: "PaymentServiceAuthorizeRequest", response: "PaymentServiceAuthorizeResponse" },
|
|
8
|
+
|
|
9
|
+
// capture: PaymentService.Capture — Finalize an authorized payment transaction. Transfers reserved funds from customer to merchant account, completing the payment lifecycle.
|
|
10
|
+
capture : { request: "PaymentServiceCaptureRequest", response: "PaymentServiceCaptureResponse" },
|
|
11
|
+
|
|
12
|
+
// create_access_token: MerchantAuthenticationService.CreateAccessToken — Generate short-lived connector authentication token. Provides secure credentials for connector API access without storing secrets client-side.
|
|
13
|
+
create_access_token : { request: "MerchantAuthenticationServiceCreateAccessTokenRequest", response: "MerchantAuthenticationServiceCreateAccessTokenResponse" },
|
|
14
|
+
|
|
15
|
+
// get: PaymentService.Get — Retrieve current payment status from the payment processor. Enables synchronization between your system and payment processors for accurate state tracking.
|
|
16
|
+
get : { request: "PaymentServiceGetRequest", response: "PaymentServiceGetResponse" },
|
|
17
|
+
|
|
18
|
+
// refund: PaymentService.Refund — Initiate a refund to customer's payment method. Returns funds for returns, cancellations, or service adjustments after original payment.
|
|
19
|
+
refund : { request: "PaymentServiceRefundRequest", response: "RefundResponse" },
|
|
20
|
+
|
|
21
|
+
// void: PaymentService.Void — Cancel an authorized payment before capture. Releases held funds back to customer, typically used when orders are cancelled or abandoned.
|
|
22
|
+
void : { request: "PaymentServiceVoidRequest", response: "PaymentServiceVoidResponse" },
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
module.exports = { FLOWS };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UniffiClient as _UniffiClientBase } from "./uniffi_client";
|
|
2
|
+
export declare class UniffiClient extends _UniffiClientBase {
|
|
3
|
+
/** Build connector HTTP request for authorize flow. */
|
|
4
|
+
authorizeReq(requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
5
|
+
/** Parse connector HTTP response for authorize flow. */
|
|
6
|
+
authorizeRes(responseBytes: Buffer | Uint8Array, requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
7
|
+
/** Build connector HTTP request for capture flow. */
|
|
8
|
+
captureReq(requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
9
|
+
/** Parse connector HTTP response for capture flow. */
|
|
10
|
+
captureRes(responseBytes: Buffer | Uint8Array, requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
11
|
+
/** Build connector HTTP request for create_access_token flow. */
|
|
12
|
+
createAccessTokenReq(requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
13
|
+
/** Parse connector HTTP response for create_access_token flow. */
|
|
14
|
+
createAccessTokenRes(responseBytes: Buffer | Uint8Array, requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
15
|
+
/** Build connector HTTP request for get flow. */
|
|
16
|
+
getReq(requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
17
|
+
/** Parse connector HTTP response for get flow. */
|
|
18
|
+
getRes(responseBytes: Buffer | Uint8Array, requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
19
|
+
/** Build connector HTTP request for refund flow. */
|
|
20
|
+
refundReq(requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
21
|
+
/** Parse connector HTTP response for refund flow. */
|
|
22
|
+
refundRes(responseBytes: Buffer | Uint8Array, requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
23
|
+
/** Build connector HTTP request for void flow. */
|
|
24
|
+
voidReq(requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
25
|
+
/** Parse connector HTTP response for void flow. */
|
|
26
|
+
voidRes(responseBytes: Buffer | Uint8Array, requestBytes: Buffer | Uint8Array, metadata: Record<string, string>, optionsBytes: Buffer | Uint8Array): Buffer;
|
|
27
|
+
}
|