@delopay/sdk 0.238.0 → 0.241.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/{chunk-H7EC7OQF.js → chunk-K6P7MQ7K.js} +108 -1
- package/dist/chunk-K6P7MQ7K.js.map +1 -0
- package/dist/index.cjs +107 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +448 -1
- package/dist/index.d.ts +448 -1
- package/dist/index.js +1 -1
- package/dist/internal.cjs +120 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +10 -3
- package/dist/internal.d.ts +10 -3
- package/dist/internal.js +14 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-H7EC7OQF.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -899,6 +899,42 @@ var Connectors = class {
|
|
|
899
899
|
{ body: params }
|
|
900
900
|
);
|
|
901
901
|
}
|
|
902
|
+
/**
|
|
903
|
+
* Share a connector with more shops of the same merchant (todos#320).
|
|
904
|
+
* `POST /account/{accountId}/connectors/{connectorId}/shops`
|
|
905
|
+
*
|
|
906
|
+
* Nothing is copied: every shop sends payments to the same account, on the
|
|
907
|
+
* same credentials and webhook, and the account's limits count them all.
|
|
908
|
+
*/
|
|
909
|
+
async addShops(accountId, connectorId, params) {
|
|
910
|
+
return this.request(
|
|
911
|
+
"POST",
|
|
912
|
+
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/shops`,
|
|
913
|
+
{ body: params }
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Switch a connector off, or back on, in one shop it serves.
|
|
918
|
+
* `POST /account/{accountId}/connectors/{connectorId}/shops/{profileId}`
|
|
919
|
+
*/
|
|
920
|
+
async setShopDisabled(accountId, connectorId, profileId, params) {
|
|
921
|
+
return this.request(
|
|
922
|
+
"POST",
|
|
923
|
+
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/shops/${encodeURIComponent(profileId)}`,
|
|
924
|
+
{ body: params }
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Stop a connector serving one shop it is shared with. The home shop is
|
|
929
|
+
* refused: it holds the connector's name, limits and webhook.
|
|
930
|
+
* `DELETE /account/{accountId}/connectors/{connectorId}/shops/{profileId}`
|
|
931
|
+
*/
|
|
932
|
+
async removeShop(accountId, connectorId, profileId) {
|
|
933
|
+
return this.request(
|
|
934
|
+
"DELETE",
|
|
935
|
+
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/shops/${encodeURIComponent(profileId)}`
|
|
936
|
+
);
|
|
937
|
+
}
|
|
902
938
|
// --- Advanced operations (Task 4.8) ---
|
|
903
939
|
/**
|
|
904
940
|
* Run the configuration checks for a vault (VGS) connector account:
|
|
@@ -1084,6 +1120,77 @@ var Connectors = class {
|
|
|
1084
1120
|
`/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/sync-events`
|
|
1085
1121
|
);
|
|
1086
1122
|
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Read the callback addresses of a connector's payment provider.
|
|
1125
|
+
* `GET /account/{merchantId}/connectors/webhooks/{connectorId}/address`
|
|
1126
|
+
*
|
|
1127
|
+
* One entry per environment: the saved mode and identifier, and for every
|
|
1128
|
+
* credential group the URL the policy asks for (`desired_url`) beside the URL
|
|
1129
|
+
* actually registered at the provider (`registered_url`) with its `status`.
|
|
1130
|
+
* Only `registered` means the provider delivers to the desired URL.
|
|
1131
|
+
*
|
|
1132
|
+
* Available for providers whose webhooks Delopay manages (Stripe, PayPal,
|
|
1133
|
+
* Airwallex, Whop) and for hand-configured ones (Creem, NomuPay,
|
|
1134
|
+
* MicroPayment). Other connectors are refused with a 400.
|
|
1135
|
+
*/
|
|
1136
|
+
async getWebhookAddress(merchantId, connectorId) {
|
|
1137
|
+
return this.request(
|
|
1138
|
+
"GET",
|
|
1139
|
+
`/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/address`
|
|
1140
|
+
);
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Validate a proposed callback address without saving it.
|
|
1144
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/address/preview`
|
|
1145
|
+
*
|
|
1146
|
+
* Returns the validation errors as `{ field, code }` pairs, the URL every
|
|
1147
|
+
* affected credential group would get, the connector accounts that share it,
|
|
1148
|
+
* and whether saving needs `confirm_shared: true`. Needs the same permission
|
|
1149
|
+
* as saving.
|
|
1150
|
+
*
|
|
1151
|
+
* @example
|
|
1152
|
+
* ```typescript
|
|
1153
|
+
* const preview = await delopay.connectors.previewWebhookAddress('mer_abc', 'mca_xyz', {
|
|
1154
|
+
* environment: 'live',
|
|
1155
|
+
* mode: 'anonymous',
|
|
1156
|
+
* format: { prefix: 'wh-', style: 'alphanumeric', length: 16 },
|
|
1157
|
+
* });
|
|
1158
|
+
* if (!preview.valid) console.warn(preview.errors);
|
|
1159
|
+
* ```
|
|
1160
|
+
*/
|
|
1161
|
+
async previewWebhookAddress(merchantId, connectorId, params) {
|
|
1162
|
+
return this.request(
|
|
1163
|
+
"POST",
|
|
1164
|
+
`/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/address/preview`,
|
|
1165
|
+
{ body: params }
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Save the callback address of a connector's payment provider for one
|
|
1170
|
+
* environment.
|
|
1171
|
+
* `PUT /account/{merchantId}/connectors/webhooks/{connectorId}/address`
|
|
1172
|
+
*
|
|
1173
|
+
* The address applies to every connector account of that provider and
|
|
1174
|
+
* environment, so `confirm_shared: true` is required when other accounts are
|
|
1175
|
+
* affected. For a managed provider Delopay then registers the new URL and
|
|
1176
|
+
* keeps the former one accepted; the response reports each credential
|
|
1177
|
+
* group's outcome in `status`. A `pending` or `failed` group keeps receiving
|
|
1178
|
+
* on its previous URL and is retried. For a hand-configured provider the
|
|
1179
|
+
* merchant enters the new `desired_url` at the provider.
|
|
1180
|
+
*
|
|
1181
|
+
* A refused proposal answers 422 with error code `IR_06` and the message
|
|
1182
|
+
* `Webhook address refused: field:code,…`. A save that lost to a concurrent
|
|
1183
|
+
* change of the same address answers 422 with error code `HE_00` and can be
|
|
1184
|
+
* repeated. A caller who may not edit every affected account answers 403.
|
|
1185
|
+
* Address changes are limited per provider and environment (`rate_limit`).
|
|
1186
|
+
*/
|
|
1187
|
+
async updateWebhookAddress(merchantId, connectorId, params) {
|
|
1188
|
+
return this.request(
|
|
1189
|
+
"PUT",
|
|
1190
|
+
`/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/address`,
|
|
1191
|
+
{ body: params }
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1087
1194
|
/** List available payment methods. `GET /account/payment-methods` */
|
|
1088
1195
|
async listPaymentMethods() {
|
|
1089
1196
|
return this.request("GET", "/account/payment-methods");
|
|
@@ -12989,6 +13096,19 @@ var AdminPortal = class {
|
|
|
12989
13096
|
`/admin-portal/transactions/${encodeURIComponent(paymentId)}/refunds`
|
|
12990
13097
|
);
|
|
12991
13098
|
}
|
|
13099
|
+
/**
|
|
13100
|
+
* The refund requests buyers raised from the customer portal about a single
|
|
13101
|
+
* transaction of ANY merchant, newest first, one page at a time
|
|
13102
|
+
* (`total_count` counts them all). Read-only.
|
|
13103
|
+
* `GET /admin-portal/transactions/{paymentId}/refund-requests`
|
|
13104
|
+
*/
|
|
13105
|
+
async getTransactionRefundRequests(paymentId, params) {
|
|
13106
|
+
return this.request(
|
|
13107
|
+
"GET",
|
|
13108
|
+
`/admin-portal/transactions/${encodeURIComponent(paymentId)}/refund-requests`,
|
|
13109
|
+
{ query: params === void 0 ? void 0 : { ...params } }
|
|
13110
|
+
);
|
|
13111
|
+
}
|
|
12992
13112
|
/**
|
|
12993
13113
|
* Refunds of ANY merchant mirrored from a connector webhook at a
|
|
12994
13114
|
* non-terminal status that no sync can advance. Newest first.
|