pycer-sdk 1.0.3 → 1.0.4
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/index.cjs +24 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -159,6 +159,10 @@ declare class SwitchResource {
|
|
|
159
159
|
constructor(client: HttpClient);
|
|
160
160
|
initiate(params: RailPaymentParams, options?: RequestOptions): Promise<SwitchChargeResult>;
|
|
161
161
|
charge(params: SwitchChargeParams, options?: RequestOptions): Promise<SwitchChargeResult>;
|
|
162
|
+
getRules(options?: RequestOptions): Promise<unknown>;
|
|
163
|
+
createRule(rule: Record<string, unknown>, options?: RequestOptions): Promise<unknown>;
|
|
164
|
+
getRailHealth(providerId?: string, options?: RequestOptions): Promise<unknown>;
|
|
165
|
+
getAttempts(transactionId?: string, options?: RequestOptions): Promise<unknown>;
|
|
162
166
|
}
|
|
163
167
|
|
|
164
168
|
interface PaymentDetails {
|
|
@@ -659,6 +663,10 @@ declare class MerchantResource {
|
|
|
659
663
|
create: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
660
664
|
update: (id: string, body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
661
665
|
remove: (id: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
666
|
+
lookup: (query: {
|
|
667
|
+
umi: string;
|
|
668
|
+
accountNumber?: string;
|
|
669
|
+
}, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
662
670
|
};
|
|
663
671
|
readonly commerce: {
|
|
664
672
|
listProducts: (query?: Query$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
@@ -809,6 +817,7 @@ declare class OwnPay {
|
|
|
809
817
|
readonly merchant: MerchantResource;
|
|
810
818
|
readonly cards: CardsResource;
|
|
811
819
|
readonly checkout: CheckoutResource;
|
|
820
|
+
readonly virtualAccounts: MerchantResource['virtualAccounts'];
|
|
812
821
|
/**
|
|
813
822
|
* Creates a new OwnPay client instance.
|
|
814
823
|
*
|
|
@@ -828,4 +837,4 @@ declare class OwnPay {
|
|
|
828
837
|
constructor(apiKeyOrConfig?: string | OwnPayConfig);
|
|
829
838
|
}
|
|
830
839
|
|
|
831
|
-
export { ApiKey, ApiKeysResource, ApiResponse, Banking, Billing, CardsResource, CheckoutResource, type CheckoutSession, type CheckoutStatus, OwnPay as Client, type CreateCheckoutParams, CreateCustomerParams, CreateRefundParams, Customer, CustomersResource, DeveloperTools, type DisbursementParams, ForeignExchange, GenerateApiKeyParams, GeneratedApiKey, HealthResource, HealthStatus, ListCustomersParams, ListRefundsParams, ListTransactionsParams, MerchantResource, Notifications, OwnPay, OwnPayConfig, PaginatedList, type PaymentDetails, PaymentsResource, type PlatformServiceConfig, OwnPay as Pycer, type RailPaymentParams, Refund, RefundsResource, RequestOptions, type SwitchChargeParams, type SwitchChargeResult, SwitchResource, Transaction, TransactionsResource, type VaultCardParams, type VaultedCard, WebhookDelivery, WebhookTestResult, WebhooksResource, OwnPay as default };
|
|
840
|
+
export { ApiKey, ApiKeysResource, ApiResponse, Banking, Billing, CardsResource, CheckoutResource, type CheckoutSession, type CheckoutStatus, OwnPay as Client, type CreateCheckoutParams, CreateCustomerParams, CreateRefundParams, Customer, CustomersResource, DeveloperTools, type DisbursementParams, ForeignExchange, GenerateApiKeyParams, GeneratedApiKey, HealthResource, HealthStatus, ListCustomersParams, ListRefundsParams, ListTransactionsParams, MerchantResource, Notifications, OwnPay, OwnPayConfig, PaginatedList, type PaymentDetails, PaymentsResource, type PlatformServiceConfig, OwnPay as Pycer, type RailPaymentParams, Refund, RefundsResource, RequestOptions, type SwitchChargeParams, type SwitchChargeResult, SwitchResource, Transaction, TransactionsResource, type VaultCardParams, type VaultedCard, type VirtualAccount, WebhookDelivery, WebhookTestResult, WebhooksResource, OwnPay as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -159,6 +159,10 @@ declare class SwitchResource {
|
|
|
159
159
|
constructor(client: HttpClient);
|
|
160
160
|
initiate(params: RailPaymentParams, options?: RequestOptions): Promise<SwitchChargeResult>;
|
|
161
161
|
charge(params: SwitchChargeParams, options?: RequestOptions): Promise<SwitchChargeResult>;
|
|
162
|
+
getRules(options?: RequestOptions): Promise<unknown>;
|
|
163
|
+
createRule(rule: Record<string, unknown>, options?: RequestOptions): Promise<unknown>;
|
|
164
|
+
getRailHealth(providerId?: string, options?: RequestOptions): Promise<unknown>;
|
|
165
|
+
getAttempts(transactionId?: string, options?: RequestOptions): Promise<unknown>;
|
|
162
166
|
}
|
|
163
167
|
|
|
164
168
|
interface PaymentDetails {
|
|
@@ -659,6 +663,10 @@ declare class MerchantResource {
|
|
|
659
663
|
create: (body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
660
664
|
update: (id: string, body: Fields$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
661
665
|
remove: (id: string, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
666
|
+
lookup: (query: {
|
|
667
|
+
umi: string;
|
|
668
|
+
accountNumber?: string;
|
|
669
|
+
}, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
662
670
|
};
|
|
663
671
|
readonly commerce: {
|
|
664
672
|
listProducts: (query?: Query$1, options?: RequestOptions) => Promise<ApiResponse<unknown> | undefined>;
|
|
@@ -809,6 +817,7 @@ declare class OwnPay {
|
|
|
809
817
|
readonly merchant: MerchantResource;
|
|
810
818
|
readonly cards: CardsResource;
|
|
811
819
|
readonly checkout: CheckoutResource;
|
|
820
|
+
readonly virtualAccounts: MerchantResource['virtualAccounts'];
|
|
812
821
|
/**
|
|
813
822
|
* Creates a new OwnPay client instance.
|
|
814
823
|
*
|
|
@@ -828,4 +837,4 @@ declare class OwnPay {
|
|
|
828
837
|
constructor(apiKeyOrConfig?: string | OwnPayConfig);
|
|
829
838
|
}
|
|
830
839
|
|
|
831
|
-
export { ApiKey, ApiKeysResource, ApiResponse, Banking, Billing, CardsResource, CheckoutResource, type CheckoutSession, type CheckoutStatus, OwnPay as Client, type CreateCheckoutParams, CreateCustomerParams, CreateRefundParams, Customer, CustomersResource, DeveloperTools, type DisbursementParams, ForeignExchange, GenerateApiKeyParams, GeneratedApiKey, HealthResource, HealthStatus, ListCustomersParams, ListRefundsParams, ListTransactionsParams, MerchantResource, Notifications, OwnPay, OwnPayConfig, PaginatedList, type PaymentDetails, PaymentsResource, type PlatformServiceConfig, OwnPay as Pycer, type RailPaymentParams, Refund, RefundsResource, RequestOptions, type SwitchChargeParams, type SwitchChargeResult, SwitchResource, Transaction, TransactionsResource, type VaultCardParams, type VaultedCard, WebhookDelivery, WebhookTestResult, WebhooksResource, OwnPay as default };
|
|
840
|
+
export { ApiKey, ApiKeysResource, ApiResponse, Banking, Billing, CardsResource, CheckoutResource, type CheckoutSession, type CheckoutStatus, OwnPay as Client, type CreateCheckoutParams, CreateCustomerParams, CreateRefundParams, Customer, CustomersResource, DeveloperTools, type DisbursementParams, ForeignExchange, GenerateApiKeyParams, GeneratedApiKey, HealthResource, HealthStatus, ListCustomersParams, ListRefundsParams, ListTransactionsParams, MerchantResource, Notifications, OwnPay, OwnPayConfig, PaginatedList, type PaymentDetails, PaymentsResource, type PlatformServiceConfig, OwnPay as Pycer, type RailPaymentParams, Refund, RefundsResource, RequestOptions, type SwitchChargeParams, type SwitchChargeResult, SwitchResource, Transaction, TransactionsResource, type VaultCardParams, type VaultedCard, type VirtualAccount, WebhookDelivery, WebhookTestResult, WebhooksResource, OwnPay as default };
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,20 @@ var SwitchResource = class {
|
|
|
42
42
|
partyB: { umid: merchantUmid, accountReference, recipientAccount }
|
|
43
43
|
}, options);
|
|
44
44
|
}
|
|
45
|
+
getRules(options) {
|
|
46
|
+
return this.client.request({ method: "GET", path: "/api/v2/switch/rules", options });
|
|
47
|
+
}
|
|
48
|
+
createRule(rule, options) {
|
|
49
|
+
return this.client.request({ method: "POST", path: "/api/v2/switch/rules", body: rule, options });
|
|
50
|
+
}
|
|
51
|
+
getRailHealth(providerId, options) {
|
|
52
|
+
const path = providerId ? `/api/v2/switch/health/${encodeURIComponent(providerId)}` : "/api/v2/switch/health";
|
|
53
|
+
return this.client.request({ method: "GET", path, options });
|
|
54
|
+
}
|
|
55
|
+
getAttempts(transactionId, options) {
|
|
56
|
+
const path = transactionId ? `/api/v2/switch/transactions/${encodeURIComponent(transactionId)}/attempts` : "/api/v2/switch/attempts";
|
|
57
|
+
return this.client.request({ method: "GET", path, options });
|
|
58
|
+
}
|
|
45
59
|
};
|
|
46
60
|
|
|
47
61
|
// src/resources/cards.ts
|
|
@@ -186,7 +200,7 @@ var DEFAULT_CONFIG = {
|
|
|
186
200
|
TIMEOUT: 3e4,
|
|
187
201
|
MAX_RETRIES: 2,
|
|
188
202
|
API_VERSION: "v1",
|
|
189
|
-
USER_AGENT: "Pycer-SDK/1.0.
|
|
203
|
+
USER_AGENT: "Pycer-SDK/1.0.4"
|
|
190
204
|
};
|
|
191
205
|
var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
192
206
|
var HttpClient = class {
|
|
@@ -322,10 +336,10 @@ var HttpClient = class {
|
|
|
322
336
|
* Builds the full request URL.
|
|
323
337
|
*/
|
|
324
338
|
buildUrl(path, query) {
|
|
325
|
-
const basePath = `/api/${this.apiVersion}`;
|
|
326
339
|
const fullPath = path.startsWith("/") ? path : `/${path}`;
|
|
340
|
+
const urlPath = fullPath.startsWith("/api/") ? fullPath : `/api/${this.apiVersion}${fullPath}`;
|
|
327
341
|
const queryString = query ? buildQueryString(query) : "";
|
|
328
|
-
return `${this.baseUrl}${
|
|
342
|
+
return `${this.baseUrl}${urlPath}${queryString}`;
|
|
329
343
|
}
|
|
330
344
|
/**
|
|
331
345
|
* Builds request headers including authentication.
|
|
@@ -1039,7 +1053,11 @@ var MerchantResource = class {
|
|
|
1039
1053
|
get: (id, options) => this.call("GET", `/merchants/account-references/${segment(id)}`, options),
|
|
1040
1054
|
create: (body, options) => this.call("POST", "/merchants/account-references", options, body),
|
|
1041
1055
|
update: (id, body, options) => this.call("PUT", `/merchants/account-references/${segment(id)}`, options, body),
|
|
1042
|
-
remove: (id, options) => this.call("DELETE", `/merchants/account-references/${segment(id)}`, options)
|
|
1056
|
+
remove: (id, options) => this.call("DELETE", `/merchants/account-references/${segment(id)}`, options),
|
|
1057
|
+
lookup: (query, options) => this.call("GET", "/account-references/lookup", options, void 0, {
|
|
1058
|
+
umi: query.umi,
|
|
1059
|
+
account_number: query.accountNumber
|
|
1060
|
+
})
|
|
1043
1061
|
};
|
|
1044
1062
|
commerce = {
|
|
1045
1063
|
listProducts: (query, options) => this.call("GET", "/products", options, void 0, query),
|
|
@@ -1210,6 +1228,7 @@ var OwnPay = class {
|
|
|
1210
1228
|
merchant;
|
|
1211
1229
|
cards;
|
|
1212
1230
|
checkout;
|
|
1231
|
+
virtualAccounts;
|
|
1213
1232
|
/**
|
|
1214
1233
|
* Creates a new OwnPay client instance.
|
|
1215
1234
|
*
|
|
@@ -1240,6 +1259,7 @@ var OwnPay = class {
|
|
|
1240
1259
|
this.merchant = new MerchantResource(this.client);
|
|
1241
1260
|
this.cards = new CardsResource(this.client);
|
|
1242
1261
|
this.checkout = new CheckoutResource(this.client, config.checkoutBaseUrl ?? this.client.baseUrl);
|
|
1262
|
+
this.virtualAccounts = this.merchant.virtualAccounts;
|
|
1243
1263
|
}
|
|
1244
1264
|
};
|
|
1245
1265
|
var src_default = OwnPay;
|