hs-playlib 0.2.0 → 0.4.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/dist/src/index.js +1 -1
- package/dist/src/payments/_generated_connector_client_flows.d.ts +17 -17
- package/dist/src/payments/connector_client.d.ts +8 -8
- package/dist/src/payments/connector_client.js +12 -13
- package/dist/src/payments/generated/libconnector_service_ffi.dylib +0 -0
- package/dist/src/payments/generated/proto.d.ts +639 -217
- package/dist/src/payments/generated/proto.js +2146 -843
- package/dist/src/payments/uniffi_client.js +34 -29
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -24,7 +24,7 @@ __exportStar(require("./payments/generated/proto"), exports);
|
|
|
24
24
|
// ---------------------------------------------------------------------------
|
|
25
25
|
// Domain namespaces — runtime values
|
|
26
26
|
// Usage: import { payments, payment_methods, configs } from '@juspay/connector-service-sdk';
|
|
27
|
-
// const
|
|
27
|
+
// const config: configs.IConnectorConfig = { ... };
|
|
28
28
|
// const client = new ConnectorClient(identity);
|
|
29
29
|
// ---------------------------------------------------------------------------
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,49 +2,49 @@ import { ConnectorClient as _ConnectorClientBase } from "./connector_client";
|
|
|
2
2
|
import { types } from "./generated/proto";
|
|
3
3
|
export declare class CustomerClient extends _ConnectorClientBase {
|
|
4
4
|
/** CustomerService.Create — Create customer record in the payment processor system. Stores customer details for future payment operations without re-sending personal information. */
|
|
5
|
-
create(requestMsg: types.ICustomerServiceCreateRequest, options?: types.
|
|
5
|
+
create(requestMsg: types.ICustomerServiceCreateRequest, options?: types.IRequestConfig | null): Promise<types.CustomerServiceCreateResponse>;
|
|
6
6
|
}
|
|
7
7
|
export declare class EventClient extends _ConnectorClientBase {
|
|
8
8
|
/** EventService.HandleEvent — Process webhook notifications from connectors. Translates connector events into standardized responses for asynchronous payment state updates. */
|
|
9
|
-
handleEvent(requestMsg: types.IEventServiceHandleRequest, options?: types.
|
|
9
|
+
handleEvent(requestMsg: types.IEventServiceHandleRequest, options?: types.IRequestConfig | null): Promise<types.EventServiceHandleResponse>;
|
|
10
10
|
}
|
|
11
11
|
export declare class MerchantAuthenticationClient extends _ConnectorClientBase {
|
|
12
12
|
/** MerchantAuthenticationService.CreateAccessToken — Generate short-lived connector authentication token. Provides secure credentials for connector API access without storing secrets client-side. */
|
|
13
|
-
createAccessToken(requestMsg: types.IMerchantAuthenticationServiceCreateAccessTokenRequest, options?: types.
|
|
13
|
+
createAccessToken(requestMsg: types.IMerchantAuthenticationServiceCreateAccessTokenRequest, options?: types.IRequestConfig | null): Promise<types.MerchantAuthenticationServiceCreateAccessTokenResponse>;
|
|
14
14
|
/** MerchantAuthenticationService.CreateSessionToken — Create session token for payment processing. Maintains session state across multiple payment operations for improved security and tracking. */
|
|
15
|
-
createSessionToken(requestMsg: types.IMerchantAuthenticationServiceCreateSessionTokenRequest, options?: types.
|
|
15
|
+
createSessionToken(requestMsg: types.IMerchantAuthenticationServiceCreateSessionTokenRequest, options?: types.IRequestConfig | null): Promise<types.MerchantAuthenticationServiceCreateSessionTokenResponse>;
|
|
16
16
|
}
|
|
17
17
|
export declare class PaymentMethodAuthenticationClient extends _ConnectorClientBase {
|
|
18
18
|
/** PaymentMethodAuthenticationService.Authenticate — Execute 3DS challenge or frictionless verification. Authenticates customer via bank challenge or behind-the-scenes verification for fraud prevention. */
|
|
19
|
-
authenticate(requestMsg: types.IPaymentMethodAuthenticationServiceAuthenticateRequest, options?: types.
|
|
19
|
+
authenticate(requestMsg: types.IPaymentMethodAuthenticationServiceAuthenticateRequest, options?: types.IRequestConfig | null): Promise<types.PaymentMethodAuthenticationServiceAuthenticateResponse>;
|
|
20
20
|
/** PaymentMethodAuthenticationService.PostAuthenticate — Validate authentication results with the issuing bank. Processes bank's authentication decision to determine if payment can proceed. */
|
|
21
|
-
postAuthenticate(requestMsg: types.IPaymentMethodAuthenticationServicePostAuthenticateRequest, options?: types.
|
|
21
|
+
postAuthenticate(requestMsg: types.IPaymentMethodAuthenticationServicePostAuthenticateRequest, options?: types.IRequestConfig | null): Promise<types.PaymentMethodAuthenticationServicePostAuthenticateResponse>;
|
|
22
22
|
/** PaymentMethodAuthenticationService.PreAuthenticate — Initiate 3DS flow before payment authorization. Collects device data and prepares authentication context for frictionless or challenge-based verification. */
|
|
23
|
-
preAuthenticate(requestMsg: types.IPaymentMethodAuthenticationServicePreAuthenticateRequest, options?: types.
|
|
23
|
+
preAuthenticate(requestMsg: types.IPaymentMethodAuthenticationServicePreAuthenticateRequest, options?: types.IRequestConfig | null): Promise<types.PaymentMethodAuthenticationServicePreAuthenticateResponse>;
|
|
24
24
|
}
|
|
25
25
|
export declare class PaymentMethodClient extends _ConnectorClientBase {
|
|
26
26
|
/** PaymentMethodService.Tokenize — Tokenize payment method for secure storage. Replaces raw card details with secure token for one-click payments and recurring billing. */
|
|
27
|
-
tokenize(requestMsg: types.IPaymentMethodServiceTokenizeRequest, options?: types.
|
|
27
|
+
tokenize(requestMsg: types.IPaymentMethodServiceTokenizeRequest, options?: types.IRequestConfig | null): Promise<types.PaymentMethodServiceTokenizeResponse>;
|
|
28
28
|
}
|
|
29
29
|
export declare class PaymentClient extends _ConnectorClientBase {
|
|
30
30
|
/** PaymentService.Authorize — Authorize a payment amount on a payment method. This reserves funds without capturing them, essential for verifying availability before finalizing. */
|
|
31
|
-
authorize(requestMsg: types.IPaymentServiceAuthorizeRequest, options?: types.
|
|
31
|
+
authorize(requestMsg: types.IPaymentServiceAuthorizeRequest, options?: types.IRequestConfig | null): Promise<types.PaymentServiceAuthorizeResponse>;
|
|
32
32
|
/** PaymentService.Capture — Finalize an authorized payment transaction. Transfers reserved funds from customer to merchant account, completing the payment lifecycle. */
|
|
33
|
-
capture(requestMsg: types.IPaymentServiceCaptureRequest, options?: types.
|
|
33
|
+
capture(requestMsg: types.IPaymentServiceCaptureRequest, options?: types.IRequestConfig | null): Promise<types.PaymentServiceCaptureResponse>;
|
|
34
34
|
/** PaymentService.CreateOrder — Initialize an order in the payment processor system. Sets up payment context before customer enters card details for improved authorization rates. */
|
|
35
|
-
createOrder(requestMsg: types.IPaymentServiceCreateOrderRequest, options?: types.
|
|
35
|
+
createOrder(requestMsg: types.IPaymentServiceCreateOrderRequest, options?: types.IRequestConfig | null): Promise<types.PaymentServiceCreateOrderResponse>;
|
|
36
36
|
/** PaymentService.Get — Retrieve current payment status from the payment processor. Enables synchronization between your system and payment processors for accurate state tracking. */
|
|
37
|
-
get(requestMsg: types.IPaymentServiceGetRequest, options?: types.
|
|
37
|
+
get(requestMsg: types.IPaymentServiceGetRequest, options?: types.IRequestConfig | null): Promise<types.PaymentServiceGetResponse>;
|
|
38
38
|
/** PaymentService.Refund — Initiate a refund to customer's payment method. Returns funds for returns, cancellations, or service adjustments after original payment. */
|
|
39
|
-
refund(requestMsg: types.IPaymentServiceRefundRequest, options?: types.
|
|
39
|
+
refund(requestMsg: types.IPaymentServiceRefundRequest, options?: types.IRequestConfig | null): Promise<types.RefundResponse>;
|
|
40
40
|
/** PaymentService.Reverse — Reverse a captured payment before settlement. Recovers funds after capture but before bank settlement, used for corrections or cancellations. */
|
|
41
|
-
reverse(requestMsg: types.IPaymentServiceReverseRequest, options?: types.
|
|
41
|
+
reverse(requestMsg: types.IPaymentServiceReverseRequest, options?: types.IRequestConfig | null): Promise<types.PaymentServiceReverseResponse>;
|
|
42
42
|
/** PaymentService.SetupRecurring — Setup a recurring payment instruction for future payments/ debits. This could be for SaaS subscriptions, monthly bill payments, insurance payments and similar use cases. */
|
|
43
|
-
setupRecurring(requestMsg: types.IPaymentServiceSetupRecurringRequest, options?: types.
|
|
43
|
+
setupRecurring(requestMsg: types.IPaymentServiceSetupRecurringRequest, options?: types.IRequestConfig | null): Promise<types.PaymentServiceSetupRecurringResponse>;
|
|
44
44
|
/** PaymentService.Void — Cancel an authorized payment before capture. Releases held funds back to customer, typically used when orders are cancelled or abandoned. */
|
|
45
|
-
void(requestMsg: types.IPaymentServiceVoidRequest, options?: types.
|
|
45
|
+
void(requestMsg: types.IPaymentServiceVoidRequest, options?: types.IRequestConfig | null): Promise<types.PaymentServiceVoidResponse>;
|
|
46
46
|
}
|
|
47
47
|
export declare class RecurringPaymentClient extends _ConnectorClientBase {
|
|
48
48
|
/** RecurringPaymentService.Charge — Charge using an existing stored recurring payment instruction. Processes repeat payments for subscriptions or recurring billing without collecting payment details. */
|
|
49
|
-
charge(requestMsg: types.IRecurringPaymentServiceChargeRequest, options?: types.
|
|
49
|
+
charge(requestMsg: types.IRecurringPaymentServiceChargeRequest, options?: types.IRequestConfig | null): Promise<types.RecurringPaymentServiceChargeResponse>;
|
|
50
50
|
}
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
import { types } from "./generated/proto";
|
|
15
15
|
export declare class ConnectorClient {
|
|
16
16
|
private uniffi;
|
|
17
|
-
private
|
|
17
|
+
private config;
|
|
18
18
|
private defaults;
|
|
19
19
|
private dispatcher;
|
|
20
20
|
/**
|
|
21
|
-
* Initialize the client with mandatory
|
|
21
|
+
* Initialize the client with mandatory config and optional request defaults.
|
|
22
22
|
*
|
|
23
|
-
* @param
|
|
24
|
-
* @param defaults -
|
|
23
|
+
* @param config - Immutable connector identity and environment (Connector, Auth, Environment).
|
|
24
|
+
* @param defaults - Optional per-request defaults (Http, Vault).
|
|
25
25
|
* @param libPath - optional path to the UniFFI shared library.
|
|
26
26
|
*/
|
|
27
|
-
constructor(
|
|
27
|
+
constructor(config: types.IConnectorConfig, defaults?: types.IRequestConfig, libPath?: string);
|
|
28
28
|
/**
|
|
29
|
-
* Merges request-level options with client defaults.
|
|
29
|
+
* Merges request-level options with client defaults. Environment comes from config (immutable).
|
|
30
30
|
*/
|
|
31
31
|
private _resolveConfig;
|
|
32
32
|
/**
|
|
@@ -36,10 +36,10 @@ export declare class ConnectorClient {
|
|
|
36
36
|
* @param requestMsg - Protobuf request message object.
|
|
37
37
|
* @param options - Optional ConfigOptions override (Environment, Http).
|
|
38
38
|
*/
|
|
39
|
-
_executeFlow(flow: string, requestMsg: object, options?: types.
|
|
39
|
+
_executeFlow(flow: string, requestMsg: object, options?: types.IRequestConfig | null, reqTypeName?: string, resTypeName?: string): Promise<unknown>;
|
|
40
40
|
/**
|
|
41
41
|
* Execute a single-step flow directly via FFI (no HTTP round-trip).
|
|
42
42
|
* Used for inbound flows like webhook processing where the connector sends data to us.
|
|
43
43
|
*/
|
|
44
|
-
_executeDirect(flow: string, requestMsg: object, options?: types.
|
|
44
|
+
_executeDirect(flow: string, requestMsg: object, options?: types.IRequestConfig | null, reqTypeName?: string, resTypeName?: string): Promise<unknown>;
|
|
45
45
|
}
|
|
@@ -21,32 +21,31 @@ const proto_1 = require("./generated/proto");
|
|
|
21
21
|
const v2 = proto_1.types;
|
|
22
22
|
class ConnectorClient {
|
|
23
23
|
uniffi;
|
|
24
|
-
|
|
24
|
+
config;
|
|
25
25
|
defaults;
|
|
26
26
|
dispatcher;
|
|
27
27
|
/**
|
|
28
|
-
* Initialize the client with mandatory
|
|
28
|
+
* Initialize the client with mandatory config and optional request defaults.
|
|
29
29
|
*
|
|
30
|
-
* @param
|
|
31
|
-
* @param defaults -
|
|
30
|
+
* @param config - Immutable connector identity and environment (Connector, Auth, Environment).
|
|
31
|
+
* @param defaults - Optional per-request defaults (Http, Vault).
|
|
32
32
|
* @param libPath - optional path to the UniFFI shared library.
|
|
33
33
|
*/
|
|
34
|
-
constructor(
|
|
34
|
+
constructor(config, defaults = {}, libPath) {
|
|
35
35
|
this.uniffi = new uniffi_client_1.UniffiClient(libPath);
|
|
36
|
-
this.
|
|
36
|
+
this.config = proto_1.types.ConnectorConfig.create(config);
|
|
37
37
|
this.defaults = defaults;
|
|
38
|
-
if (
|
|
39
|
-
throw new http_client_1.ConnectorError("Connector is required in
|
|
38
|
+
if (config.connector === undefined) {
|
|
39
|
+
throw new http_client_1.ConnectorError("Connector is required in ConnectorConfig", 400, "CLIENT_INITIALIZATION");
|
|
40
40
|
}
|
|
41
41
|
// Instance-level cache: create the primary connection pool at startup
|
|
42
42
|
this.dispatcher = (0, http_client_1.createDispatcher)(defaults.http || {});
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Merges request-level options with client defaults.
|
|
45
|
+
* Merges request-level options with client defaults. Environment comes from config (immutable).
|
|
46
46
|
*/
|
|
47
47
|
_resolveConfig(overrides) {
|
|
48
48
|
const opt = overrides || {};
|
|
49
|
-
const environment = opt.environment ?? this.defaults.environment ?? proto_1.types.Environment.SANDBOX;
|
|
50
49
|
const clientHttp = this.defaults.http || {};
|
|
51
50
|
const overrideHttp = opt.http || {};
|
|
52
51
|
const http = {
|
|
@@ -58,9 +57,9 @@ class ConnectorClient {
|
|
|
58
57
|
caCert: overrideHttp.caCert ?? clientHttp.caCert,
|
|
59
58
|
};
|
|
60
59
|
const ffi = proto_1.types.FfiOptions.create({
|
|
61
|
-
environment,
|
|
62
|
-
connector: this.
|
|
63
|
-
auth: this.
|
|
60
|
+
environment: this.config.environment ?? proto_1.types.Environment.SANDBOX,
|
|
61
|
+
connector: this.config.connector,
|
|
62
|
+
auth: this.config.auth,
|
|
64
63
|
});
|
|
65
64
|
return { ffi, http };
|
|
66
65
|
}
|
|
Binary file
|