@wix/auto_sdk_benefit-programs_balances 1.0.22 → 1.0.24
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/build/cjs/index.d.ts +12 -8
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.ts → index.typings.d.ts} +111 -1
- package/build/cjs/index.typings.js +539 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +2 -1
- package/build/es/index.d.mts +12 -8
- package/build/es/index.mjs.map +1 -1
- package/build/es/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.mts → index.typings.d.mts} +111 -1
- package/build/es/index.typings.mjs +503 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +2 -1
- package/build/internal/cjs/index.d.ts +12 -8
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.ts → index.typings.d.ts} +111 -1
- package/build/internal/cjs/index.typings.js +539 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +2 -1
- package/build/internal/es/index.d.mts +12 -8
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.mts → index.typings.d.mts} +111 -1
- package/build/internal/es/index.typings.mjs +503 -0
- package/build/internal/es/index.typings.mjs.map +1 -0
- package/build/internal/es/meta.d.mts +2 -1
- package/package.json +5 -4
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NonNullablePaths } from '@wix/sdk-types';
|
|
2
|
+
|
|
1
3
|
interface Balance {
|
|
2
4
|
/**
|
|
3
5
|
* Balance ID. This is the same as the associated pool's ID.
|
|
@@ -95,6 +97,8 @@ declare enum IdentityType {
|
|
|
95
97
|
/** A Wix account holder, such as a site owner or contributor. */
|
|
96
98
|
WIX_USER = "WIX_USER"
|
|
97
99
|
}
|
|
100
|
+
/** @enumType */
|
|
101
|
+
type IdentityTypeWithLiterals = IdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER';
|
|
98
102
|
interface BalanceAmount {
|
|
99
103
|
/**
|
|
100
104
|
* number of available credits.
|
|
@@ -386,6 +390,8 @@ declare enum LimitRule {
|
|
|
386
390
|
/** If the limit is exceeded, the operation will succeed but the balance will be adjusted so that it satisfies the provided limits. If the resulting balance is below the lower_limit, it will be set to the lower_limit. If the resulting balance is above the upper_limit, it will be set to the upper_limit. */
|
|
387
391
|
HARD_ENFORCE = "HARD_ENFORCE"
|
|
388
392
|
}
|
|
393
|
+
/** @enumType */
|
|
394
|
+
type LimitRuleWithLiterals = LimitRule | 'UNKNOWN_LIMIT_RULE' | 'FAIL' | 'SOFT_ENFORCE' | 'HARD_ENFORCE';
|
|
389
395
|
interface SetOptions {
|
|
390
396
|
/**
|
|
391
397
|
* Amount to set the balance's available credits to.
|
|
@@ -770,6 +776,51 @@ declare enum WebhookIdentityType {
|
|
|
770
776
|
}
|
|
771
777
|
/** @enumType */
|
|
772
778
|
type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
|
|
779
|
+
/** @docsIgnore */
|
|
780
|
+
type ChangeBalanceApplicationErrors = {
|
|
781
|
+
code?: 'ALREADY_EXECUTED';
|
|
782
|
+
description?: string;
|
|
783
|
+
data?: Record<string, any>;
|
|
784
|
+
} | {
|
|
785
|
+
code?: 'BALANCE_EXCEEDED_LIMITS';
|
|
786
|
+
description?: string;
|
|
787
|
+
data?: BalanceExceededLimits;
|
|
788
|
+
};
|
|
789
|
+
/** @docsIgnore */
|
|
790
|
+
type RevertBalanceChangeApplicationErrors = {
|
|
791
|
+
code?: 'CHANGE_ALREADY_REVERTED';
|
|
792
|
+
description?: string;
|
|
793
|
+
data?: ChangeAlreadyReverted;
|
|
794
|
+
} | {
|
|
795
|
+
code?: 'NOT_ENOUGH_BALANCE';
|
|
796
|
+
description?: string;
|
|
797
|
+
data?: NotEnoughBalance;
|
|
798
|
+
} | {
|
|
799
|
+
code?: 'TRANSACTION_NOT_FOUND';
|
|
800
|
+
description?: string;
|
|
801
|
+
data?: Record<string, any>;
|
|
802
|
+
};
|
|
803
|
+
/**
|
|
804
|
+
* Retrieves a balance.
|
|
805
|
+
* @param poolId - ID of the pool associated with the balance to retrieve. This is also the ID of the balance.
|
|
806
|
+
* @public
|
|
807
|
+
* @documentationMaturity preview
|
|
808
|
+
* @requiredField poolId
|
|
809
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_READ
|
|
810
|
+
* @applicableIdentity APP
|
|
811
|
+
* @returns Retrieved balance.
|
|
812
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.GetBalance
|
|
813
|
+
*/
|
|
814
|
+
declare function getBalance(poolId: string): Promise<NonNullablePaths<Balance, `_id` | `beneficiary.anonymousVisitorId` | `beneficiary.memberId` | `beneficiary.wixUserId` | `amount.available` | `poolInfo._id` | `poolInfo.status`, 3>>;
|
|
815
|
+
/**
|
|
816
|
+
* Retrieves a list of balances.
|
|
817
|
+
* @public
|
|
818
|
+
* @documentationMaturity preview
|
|
819
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_READ
|
|
820
|
+
* @applicableIdentity APP
|
|
821
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.ListBalances
|
|
822
|
+
*/
|
|
823
|
+
declare function listBalances(options?: ListBalancesOptions): Promise<NonNullablePaths<ListBalancesResponse, `balances` | `balances.${number}._id` | `balances.${number}.beneficiary.anonymousVisitorId` | `balances.${number}.beneficiary.memberId` | `balances.${number}.beneficiary.wixUserId` | `balances.${number}.amount.available` | `balances.${number}.poolInfo._id` | `balances.${number}.poolInfo.status`, 5>>;
|
|
773
824
|
interface ListBalancesOptions {
|
|
774
825
|
/**
|
|
775
826
|
* List of IDs of the pools associated with the balances to retrieve. These are also the IDs of the balances.
|
|
@@ -780,6 +831,25 @@ interface ListBalancesOptions {
|
|
|
780
831
|
/** Cursor paging. */
|
|
781
832
|
cursorPaging?: CursorPaging;
|
|
782
833
|
}
|
|
834
|
+
/**
|
|
835
|
+
* Creates a query to retrieve a list of balances.
|
|
836
|
+
*
|
|
837
|
+
* The Query Balances method builds a query to retrieve a list of balances and returns a `BalancesQueryBuilder` object.
|
|
838
|
+
*
|
|
839
|
+
* The returned object contains the query definition, which is used to run the query using the `find()` method.
|
|
840
|
+
*
|
|
841
|
+
* You can refine the query by chaining `BalancesQueryBuilder` methods onto the query. `BalancesQueryBuilder` methods enable you to filter, sort, and control the results that Query Balances returns.
|
|
842
|
+
*
|
|
843
|
+
* Query Balances has a default paging limit of 50, which you can override.
|
|
844
|
+
*
|
|
845
|
+
* For a full description of the item object, see the object returned for the `items` property in `BalancesQueryResult`.
|
|
846
|
+
* @public
|
|
847
|
+
* @documentationMaturity preview
|
|
848
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_READ
|
|
849
|
+
* @applicableIdentity APP
|
|
850
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.QueryBalances
|
|
851
|
+
*/
|
|
852
|
+
declare function queryBalances(): BalancesQueryBuilder;
|
|
783
853
|
interface QueryCursorResult {
|
|
784
854
|
cursors: Cursors;
|
|
785
855
|
hasNext: () => boolean;
|
|
@@ -857,6 +927,25 @@ interface BalancesQueryBuilder {
|
|
|
857
927
|
/** @documentationMaturity preview */
|
|
858
928
|
find: () => Promise<BalancesQueryResult>;
|
|
859
929
|
}
|
|
930
|
+
/**
|
|
931
|
+
* Changes the number of available credits in a balance.
|
|
932
|
+
*
|
|
933
|
+
* You can adjust or set the number of available credits.
|
|
934
|
+
* @param poolId - ID of the pool associated with the balance to change. This is also the ID of the balance.
|
|
935
|
+
* @param idempotencyKey - Unique identifier, generated by the client.
|
|
936
|
+
* Used to recognize repeated attempts to make the same request.
|
|
937
|
+
* @public
|
|
938
|
+
* @documentationMaturity preview
|
|
939
|
+
* @requiredField idempotencyKey
|
|
940
|
+
* @requiredField options.operation
|
|
941
|
+
* @requiredField poolId
|
|
942
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_CHANGE
|
|
943
|
+
* @applicableIdentity APP
|
|
944
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.ChangeBalance
|
|
945
|
+
*/
|
|
946
|
+
declare function changeBalance(poolId: string, idempotencyKey: string, options?: ChangeBalanceOptions): Promise<NonNullablePaths<ChangeBalanceResponse, `balance._id` | `balance.beneficiary.anonymousVisitorId` | `balance.beneficiary.memberId` | `balance.beneficiary.wixUserId` | `balance.amount.available` | `balance.poolInfo._id` | `balance.poolInfo.status`, 4> & {
|
|
947
|
+
__applicationErrorsType?: ChangeBalanceApplicationErrors;
|
|
948
|
+
}>;
|
|
860
949
|
interface ChangeBalanceOptions extends ChangeBalanceOptionsOperationOneOf {
|
|
861
950
|
/** Identity changing the balance. */
|
|
862
951
|
instructingParty?: CommonIdentificationData;
|
|
@@ -876,9 +965,30 @@ interface ChangeBalanceOptionsOperationOneOf {
|
|
|
876
965
|
/** Set the balance to a specific number of credits. */
|
|
877
966
|
setOptions?: SetOptions;
|
|
878
967
|
}
|
|
968
|
+
/**
|
|
969
|
+
* Reverts a transaction created by calling Change Balance.
|
|
970
|
+
*
|
|
971
|
+
* For example, if a transaction increased a balance's available credits by 5,
|
|
972
|
+
* calling Revert Balance Change with the transaction's ID will decrease the balance's available credit by 5.
|
|
973
|
+
*
|
|
974
|
+
* > **Note:** If the Change Balance call set the balance, Revert Transaction reverts the amount the balance changed by, ensuring subsequent balance changes are still reflected after the reversion.
|
|
975
|
+
* @param transactionId - ID of the transaction associated with the balance change to revert.
|
|
976
|
+
* @param idempotencyKey - Unique identifier, generated by the client.
|
|
977
|
+
* Used to recognize repeated attempts to make the same request.
|
|
978
|
+
* @public
|
|
979
|
+
* @documentationMaturity preview
|
|
980
|
+
* @requiredField idempotencyKey
|
|
981
|
+
* @requiredField transactionId
|
|
982
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_CHANGE
|
|
983
|
+
* @applicableIdentity APP
|
|
984
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.RevertBalanceChange
|
|
985
|
+
*/
|
|
986
|
+
declare function revertBalanceChange(transactionId: string, idempotencyKey: string, options?: RevertBalanceChangeOptions): Promise<RevertBalanceChangeResponse & {
|
|
987
|
+
__applicationErrorsType?: RevertBalanceChangeApplicationErrors;
|
|
988
|
+
}>;
|
|
879
989
|
interface RevertBalanceChangeOptions {
|
|
880
990
|
/** Identity reverting the balance change. */
|
|
881
991
|
instructingParty?: CommonIdentificationData;
|
|
882
992
|
}
|
|
883
993
|
|
|
884
|
-
export { type
|
|
994
|
+
export { type ActionEvent, type AdjustOptions, type ApplicationError, type Balance, type BalanceAmount, type BalanceChangeBalanceRequest, type BalanceChangeBalanceRequestOperationOneOf, type BalanceExceededLimits, type BalancesQueryBuilder, type BalancesQueryResult, type BulkActionMetadata, type BulkChangeBalanceResult, type BulkChangeBalancesRequest, type BulkChangeBalancesResponse, type ChangeAlreadyReverted, type ChangeBalanceApplicationErrors, type ChangeBalanceOptions, type ChangeBalanceOptionsOperationOneOf, type ChangeBalanceRequest, type ChangeBalanceRequestOperationOneOf, ChangeBalanceRequestType, type ChangeBalanceRequestTypeWithLiterals, type ChangeBalanceResponse, type CommonIdentificationData, type CommonIdentificationDataIdOneOf, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type ExtendedFields, type GetBalanceRequest, type GetBalanceResponse, type GetTransactionReversibilityRequest, type GetTransactionReversibilityResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, type IdentityTypeWithLiterals, type Item, type ItemMetadata, LimitRule, type LimitRuleWithLiterals, type ListBalancesOptions, type ListBalancesRequest, type ListBalancesResponse, type MessageEnvelope, type NotEnoughBalance, type PoolInfo, PoolStatus, type PoolStatusWithLiterals, type QueryBalancesRequest, type QueryBalancesResponse, type RestoreInfo, type RevertBalanceChangeApplicationErrors, type RevertBalanceChangeOptions, type RevertBalanceChangeRequest, type RevertBalanceChangeResponse, type RolloverConfigurationInfo, type SetInitialOptions, type SetOptions, SortOrder, type SortOrderWithLiterals, type Sorting, type TransactionDetails, TransactionReversibility, type TransactionReversibilityWithLiterals, Type, type TypeWithLiterals, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, changeBalance, getBalance, listBalances, queryBalances, revertBalanceChange };
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
// src/benefit-programs-v1-balance-balances.universal.ts
|
|
2
|
+
import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
|
|
3
|
+
import { queryBuilder } from "@wix/sdk-runtime/query-builder";
|
|
4
|
+
import {
|
|
5
|
+
renameKeysFromSDKRequestToRESTRequest,
|
|
6
|
+
renameKeysFromRESTResponseToSDKResponse
|
|
7
|
+
} from "@wix/sdk-runtime/rename-all-nested-keys";
|
|
8
|
+
|
|
9
|
+
// src/benefit-programs-v1-balance-balances.http.ts
|
|
10
|
+
import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
|
|
11
|
+
import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
|
|
12
|
+
import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
|
|
13
|
+
import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
|
|
14
|
+
import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
|
|
15
|
+
function resolveWixBenefitProgramsV1BalanceBalanceServiceUrl(opts) {
|
|
16
|
+
const domainToMappings = {
|
|
17
|
+
"api._api_base_domain_": [
|
|
18
|
+
{
|
|
19
|
+
srcPath: "/pool-accounts",
|
|
20
|
+
destPath: ""
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
_: [
|
|
24
|
+
{
|
|
25
|
+
srcPath: "/_api/benefit-programs-pool-accounts",
|
|
26
|
+
destPath: ""
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"editor._base_domain_": [
|
|
30
|
+
{
|
|
31
|
+
srcPath: "/_api/benefit-programs-pool-accounts",
|
|
32
|
+
destPath: ""
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
srcPath: "/_api/benefit-programs/v1/balances",
|
|
36
|
+
destPath: "/v1/balances"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
srcPath: "/_api/benefit-programs/v1/bulk/balances",
|
|
40
|
+
destPath: "/v1/bulk/balances"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"blocks._base_domain_": [
|
|
44
|
+
{
|
|
45
|
+
srcPath: "/_api/benefit-programs-pool-accounts",
|
|
46
|
+
destPath: ""
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
srcPath: "/_api/benefit-programs/v1/balances",
|
|
50
|
+
destPath: "/v1/balances"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
srcPath: "/_api/benefit-programs/v1/bulk/balances",
|
|
54
|
+
destPath: "/v1/bulk/balances"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"create.editorx": [
|
|
58
|
+
{
|
|
59
|
+
srcPath: "/_api/benefit-programs-pool-accounts",
|
|
60
|
+
destPath: ""
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
srcPath: "/_api/benefit-programs/v1/balances",
|
|
64
|
+
destPath: "/v1/balances"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
srcPath: "/_api/benefit-programs/v1/bulk/balances",
|
|
68
|
+
destPath: "/v1/bulk/balances"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"editor.wixapps.net": [
|
|
72
|
+
{
|
|
73
|
+
srcPath: "/_api/benefit-programs-pool-accounts",
|
|
74
|
+
destPath: ""
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
srcPath: "/_api/benefit-programs/v1/balances",
|
|
78
|
+
destPath: "/v1/balances"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
srcPath: "/_api/benefit-programs/v1/bulk/balances",
|
|
82
|
+
destPath: "/v1/bulk/balances"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"manage._base_domain_": [
|
|
86
|
+
{
|
|
87
|
+
srcPath: "/_api/benefit-programs-pool-accounts",
|
|
88
|
+
destPath: ""
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
srcPath: "/_api/benefit-programs/v1/balances",
|
|
92
|
+
destPath: "/v1/balances"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
srcPath: "/_api/benefit-programs/v1/bulk/balances",
|
|
96
|
+
destPath: "/v1/bulk/balances"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"www._base_domain_": [
|
|
100
|
+
{
|
|
101
|
+
srcPath: "/_api/benefit-programs-pool-accounts",
|
|
102
|
+
destPath: ""
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
srcPath: "/_api/benefit-programs/v1/balances",
|
|
106
|
+
destPath: "/v1/balances"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
srcPath: "/_api/benefit-programs/v1/bulk/balances",
|
|
110
|
+
destPath: "/v1/bulk/balances"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"www.wixapis.com": [
|
|
114
|
+
{
|
|
115
|
+
srcPath: "/benefit-programs/v1/balances",
|
|
116
|
+
destPath: "/v1/balances"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
srcPath: "/benefit-programs/v1/bulk/balances",
|
|
120
|
+
destPath: "/v1/bulk/balances"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"*.dev.wix-code.com": [
|
|
124
|
+
{
|
|
125
|
+
srcPath: "/_api/benefit-programs/v1/balances",
|
|
126
|
+
destPath: "/v1/balances"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
srcPath: "/_api/benefit-programs/v1/bulk/balances",
|
|
130
|
+
destPath: "/v1/bulk/balances"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
135
|
+
}
|
|
136
|
+
var PACKAGE_NAME = "@wix/auto_sdk_benefit-programs_balances";
|
|
137
|
+
function getBalance(payload) {
|
|
138
|
+
function __getBalance({ host }) {
|
|
139
|
+
const metadata = {
|
|
140
|
+
entityFqdn: "wix.benefit_programs.v1.balance",
|
|
141
|
+
method: "GET",
|
|
142
|
+
methodFqn: "wix.benefit_programs.v1.balance.BalanceService.GetBalance",
|
|
143
|
+
packageName: PACKAGE_NAME,
|
|
144
|
+
url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
|
|
145
|
+
protoPath: "/v1/balances/{poolId}",
|
|
146
|
+
data: payload,
|
|
147
|
+
host
|
|
148
|
+
}),
|
|
149
|
+
params: toURLSearchParams(payload),
|
|
150
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
151
|
+
{
|
|
152
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
153
|
+
paths: [
|
|
154
|
+
{ path: "balance.createdDate" },
|
|
155
|
+
{ path: "balance.updatedDate" }
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
])
|
|
159
|
+
};
|
|
160
|
+
return metadata;
|
|
161
|
+
}
|
|
162
|
+
return __getBalance;
|
|
163
|
+
}
|
|
164
|
+
function listBalances(payload) {
|
|
165
|
+
function __listBalances({ host }) {
|
|
166
|
+
const metadata = {
|
|
167
|
+
entityFqdn: "wix.benefit_programs.v1.balance",
|
|
168
|
+
method: "GET",
|
|
169
|
+
methodFqn: "wix.benefit_programs.v1.balance.BalanceService.ListBalances",
|
|
170
|
+
packageName: PACKAGE_NAME,
|
|
171
|
+
url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
|
|
172
|
+
protoPath: "/v1/balances",
|
|
173
|
+
data: payload,
|
|
174
|
+
host
|
|
175
|
+
}),
|
|
176
|
+
params: toURLSearchParams(payload),
|
|
177
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
178
|
+
{
|
|
179
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
180
|
+
paths: [
|
|
181
|
+
{ path: "balances.createdDate" },
|
|
182
|
+
{ path: "balances.updatedDate" }
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
])
|
|
186
|
+
};
|
|
187
|
+
return metadata;
|
|
188
|
+
}
|
|
189
|
+
return __listBalances;
|
|
190
|
+
}
|
|
191
|
+
function queryBalances(payload) {
|
|
192
|
+
function __queryBalances({ host }) {
|
|
193
|
+
const metadata = {
|
|
194
|
+
entityFqdn: "wix.benefit_programs.v1.balance",
|
|
195
|
+
method: "POST",
|
|
196
|
+
methodFqn: "wix.benefit_programs.v1.balance.BalanceService.QueryBalances",
|
|
197
|
+
packageName: PACKAGE_NAME,
|
|
198
|
+
url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
|
|
199
|
+
protoPath: "/v1/balances/query",
|
|
200
|
+
data: payload,
|
|
201
|
+
host
|
|
202
|
+
}),
|
|
203
|
+
data: payload,
|
|
204
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
205
|
+
{
|
|
206
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
207
|
+
paths: [
|
|
208
|
+
{ path: "balances.createdDate" },
|
|
209
|
+
{ path: "balances.updatedDate" }
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
])
|
|
213
|
+
};
|
|
214
|
+
return metadata;
|
|
215
|
+
}
|
|
216
|
+
return __queryBalances;
|
|
217
|
+
}
|
|
218
|
+
function changeBalance(payload) {
|
|
219
|
+
function __changeBalance({ host }) {
|
|
220
|
+
const serializedData = transformPaths(payload, [
|
|
221
|
+
{
|
|
222
|
+
transformFn: transformSDKTimestampToRESTTimestamp,
|
|
223
|
+
paths: [{ path: "transactionDetails.effectiveDate" }]
|
|
224
|
+
}
|
|
225
|
+
]);
|
|
226
|
+
const metadata = {
|
|
227
|
+
entityFqdn: "wix.benefit_programs.v1.balance",
|
|
228
|
+
method: "POST",
|
|
229
|
+
methodFqn: "wix.benefit_programs.v1.balance.BalanceService.ChangeBalance",
|
|
230
|
+
packageName: PACKAGE_NAME,
|
|
231
|
+
url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
|
|
232
|
+
protoPath: "/v1/balances/{poolId}/change",
|
|
233
|
+
data: serializedData,
|
|
234
|
+
host
|
|
235
|
+
}),
|
|
236
|
+
data: serializedData,
|
|
237
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
238
|
+
{
|
|
239
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
240
|
+
paths: [
|
|
241
|
+
{ path: "balance.createdDate" },
|
|
242
|
+
{ path: "balance.updatedDate" }
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
])
|
|
246
|
+
};
|
|
247
|
+
return metadata;
|
|
248
|
+
}
|
|
249
|
+
return __changeBalance;
|
|
250
|
+
}
|
|
251
|
+
function revertBalanceChange(payload) {
|
|
252
|
+
function __revertBalanceChange({ host }) {
|
|
253
|
+
const metadata = {
|
|
254
|
+
entityFqdn: "wix.benefit_programs.v1.balance",
|
|
255
|
+
method: "POST",
|
|
256
|
+
methodFqn: "wix.benefit_programs.v1.balance.BalanceService.RevertBalanceChange",
|
|
257
|
+
packageName: PACKAGE_NAME,
|
|
258
|
+
url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
|
|
259
|
+
protoPath: "/v1/balances/changes/{transactionId}/revert",
|
|
260
|
+
data: payload,
|
|
261
|
+
host
|
|
262
|
+
}),
|
|
263
|
+
data: payload
|
|
264
|
+
};
|
|
265
|
+
return metadata;
|
|
266
|
+
}
|
|
267
|
+
return __revertBalanceChange;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// src/benefit-programs-v1-balance-balances.universal.ts
|
|
271
|
+
import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
|
|
272
|
+
var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
|
|
273
|
+
IdentityType2["UNKNOWN"] = "UNKNOWN";
|
|
274
|
+
IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
275
|
+
IdentityType2["MEMBER"] = "MEMBER";
|
|
276
|
+
IdentityType2["WIX_USER"] = "WIX_USER";
|
|
277
|
+
return IdentityType2;
|
|
278
|
+
})(IdentityType || {});
|
|
279
|
+
var PoolStatus = /* @__PURE__ */ ((PoolStatus2) => {
|
|
280
|
+
PoolStatus2["UNDEFINED"] = "UNDEFINED";
|
|
281
|
+
PoolStatus2["ACTIVE"] = "ACTIVE";
|
|
282
|
+
PoolStatus2["PAUSED"] = "PAUSED";
|
|
283
|
+
PoolStatus2["ENDED"] = "ENDED";
|
|
284
|
+
PoolStatus2["PROVISIONING"] = "PROVISIONING";
|
|
285
|
+
PoolStatus2["RENEWING"] = "RENEWING";
|
|
286
|
+
return PoolStatus2;
|
|
287
|
+
})(PoolStatus || {});
|
|
288
|
+
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
289
|
+
SortOrder2["ASC"] = "ASC";
|
|
290
|
+
SortOrder2["DESC"] = "DESC";
|
|
291
|
+
return SortOrder2;
|
|
292
|
+
})(SortOrder || {});
|
|
293
|
+
var ChangeBalanceRequestType = /* @__PURE__ */ ((ChangeBalanceRequestType2) => {
|
|
294
|
+
ChangeBalanceRequestType2["UNKNOWN_OPERATION"] = "UNKNOWN_OPERATION";
|
|
295
|
+
ChangeBalanceRequestType2["ADJUST"] = "ADJUST";
|
|
296
|
+
ChangeBalanceRequestType2["SET"] = "SET";
|
|
297
|
+
return ChangeBalanceRequestType2;
|
|
298
|
+
})(ChangeBalanceRequestType || {});
|
|
299
|
+
var LimitRule = /* @__PURE__ */ ((LimitRule2) => {
|
|
300
|
+
LimitRule2["UNKNOWN_LIMIT_RULE"] = "UNKNOWN_LIMIT_RULE";
|
|
301
|
+
LimitRule2["FAIL"] = "FAIL";
|
|
302
|
+
LimitRule2["SOFT_ENFORCE"] = "SOFT_ENFORCE";
|
|
303
|
+
LimitRule2["HARD_ENFORCE"] = "HARD_ENFORCE";
|
|
304
|
+
return LimitRule2;
|
|
305
|
+
})(LimitRule || {});
|
|
306
|
+
var Type = /* @__PURE__ */ ((Type2) => {
|
|
307
|
+
Type2["UNKNOWN_OPERATION"] = "UNKNOWN_OPERATION";
|
|
308
|
+
return Type2;
|
|
309
|
+
})(Type || {});
|
|
310
|
+
var TransactionReversibility = /* @__PURE__ */ ((TransactionReversibility2) => {
|
|
311
|
+
TransactionReversibility2["TRANSACTION_IS_REVERSIBLE"] = "TRANSACTION_IS_REVERSIBLE";
|
|
312
|
+
TransactionReversibility2["TRANSACTION_ALREADY_REVERSED"] = "TRANSACTION_ALREADY_REVERSED";
|
|
313
|
+
return TransactionReversibility2;
|
|
314
|
+
})(TransactionReversibility || {});
|
|
315
|
+
var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
316
|
+
WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
|
|
317
|
+
WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
318
|
+
WebhookIdentityType2["MEMBER"] = "MEMBER";
|
|
319
|
+
WebhookIdentityType2["WIX_USER"] = "WIX_USER";
|
|
320
|
+
WebhookIdentityType2["APP"] = "APP";
|
|
321
|
+
return WebhookIdentityType2;
|
|
322
|
+
})(WebhookIdentityType || {});
|
|
323
|
+
async function getBalance2(poolId) {
|
|
324
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
325
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ poolId });
|
|
326
|
+
const reqOpts = getBalance(payload);
|
|
327
|
+
sideEffects?.onSiteCall?.();
|
|
328
|
+
try {
|
|
329
|
+
const result = await httpClient.request(reqOpts);
|
|
330
|
+
sideEffects?.onSuccess?.(result);
|
|
331
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data)?.balance;
|
|
332
|
+
} catch (err) {
|
|
333
|
+
const transformedError = sdkTransformError(
|
|
334
|
+
err,
|
|
335
|
+
{
|
|
336
|
+
spreadPathsToArguments: {},
|
|
337
|
+
explicitPathsToArguments: { poolId: "$[0]" },
|
|
338
|
+
singleArgumentUnchanged: false
|
|
339
|
+
},
|
|
340
|
+
["poolId"]
|
|
341
|
+
);
|
|
342
|
+
sideEffects?.onError?.(err);
|
|
343
|
+
throw transformedError;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
async function listBalances2(options) {
|
|
347
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
348
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
349
|
+
poolIds: options?.poolIds,
|
|
350
|
+
cursorPaging: options?.cursorPaging
|
|
351
|
+
});
|
|
352
|
+
const reqOpts = listBalances(payload);
|
|
353
|
+
sideEffects?.onSiteCall?.();
|
|
354
|
+
try {
|
|
355
|
+
const result = await httpClient.request(reqOpts);
|
|
356
|
+
sideEffects?.onSuccess?.(result);
|
|
357
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
358
|
+
} catch (err) {
|
|
359
|
+
const transformedError = sdkTransformError(
|
|
360
|
+
err,
|
|
361
|
+
{
|
|
362
|
+
spreadPathsToArguments: {},
|
|
363
|
+
explicitPathsToArguments: {
|
|
364
|
+
poolIds: "$[0].poolIds",
|
|
365
|
+
cursorPaging: "$[0].cursorPaging"
|
|
366
|
+
},
|
|
367
|
+
singleArgumentUnchanged: false
|
|
368
|
+
},
|
|
369
|
+
["options"]
|
|
370
|
+
);
|
|
371
|
+
sideEffects?.onError?.(err);
|
|
372
|
+
throw transformedError;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function queryBalances2() {
|
|
376
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
377
|
+
return queryBuilder({
|
|
378
|
+
func: async (payload) => {
|
|
379
|
+
const reqOpts = queryBalances(payload);
|
|
380
|
+
sideEffects?.onSiteCall?.();
|
|
381
|
+
try {
|
|
382
|
+
const result = await httpClient.request(reqOpts);
|
|
383
|
+
sideEffects?.onSuccess?.(result);
|
|
384
|
+
return result;
|
|
385
|
+
} catch (err) {
|
|
386
|
+
sideEffects?.onError?.(err);
|
|
387
|
+
throw err;
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
requestTransformer: (query) => {
|
|
391
|
+
const args = [query, {}];
|
|
392
|
+
return renameKeysFromSDKRequestToRESTRequest({
|
|
393
|
+
...args?.[1],
|
|
394
|
+
query: args?.[0]
|
|
395
|
+
});
|
|
396
|
+
},
|
|
397
|
+
responseTransformer: ({ data }) => {
|
|
398
|
+
const transformedData = renameKeysFromRESTResponseToSDKResponse(
|
|
399
|
+
transformPaths2(data, [])
|
|
400
|
+
);
|
|
401
|
+
return {
|
|
402
|
+
items: transformedData?.balances,
|
|
403
|
+
pagingMetadata: transformedData?.metadata
|
|
404
|
+
};
|
|
405
|
+
},
|
|
406
|
+
errorTransformer: (err) => {
|
|
407
|
+
const transformedError = sdkTransformError(err, {
|
|
408
|
+
spreadPathsToArguments: {},
|
|
409
|
+
explicitPathsToArguments: { query: "$[0]" },
|
|
410
|
+
singleArgumentUnchanged: false
|
|
411
|
+
});
|
|
412
|
+
throw transformedError;
|
|
413
|
+
},
|
|
414
|
+
pagingMethod: "CURSOR",
|
|
415
|
+
transformationPaths: {}
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
async function changeBalance2(poolId, idempotencyKey, options) {
|
|
419
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
420
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
421
|
+
poolId,
|
|
422
|
+
idempotencyKey,
|
|
423
|
+
instructingParty: options?.instructingParty,
|
|
424
|
+
type: options?.type,
|
|
425
|
+
adjustOptions: options?.adjustOptions,
|
|
426
|
+
setOptions: options?.setOptions,
|
|
427
|
+
transactionDetails: options?.transactionDetails
|
|
428
|
+
});
|
|
429
|
+
const reqOpts = changeBalance(payload);
|
|
430
|
+
sideEffects?.onSiteCall?.();
|
|
431
|
+
try {
|
|
432
|
+
const result = await httpClient.request(reqOpts);
|
|
433
|
+
sideEffects?.onSuccess?.(result);
|
|
434
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
435
|
+
} catch (err) {
|
|
436
|
+
const transformedError = sdkTransformError(
|
|
437
|
+
err,
|
|
438
|
+
{
|
|
439
|
+
spreadPathsToArguments: {},
|
|
440
|
+
explicitPathsToArguments: {
|
|
441
|
+
poolId: "$[0]",
|
|
442
|
+
idempotencyKey: "$[1]",
|
|
443
|
+
instructingParty: "$[2].instructingParty",
|
|
444
|
+
type: "$[2].type",
|
|
445
|
+
adjustOptions: "$[2].adjustOptions",
|
|
446
|
+
setOptions: "$[2].setOptions",
|
|
447
|
+
transactionDetails: "$[2].transactionDetails"
|
|
448
|
+
},
|
|
449
|
+
singleArgumentUnchanged: false
|
|
450
|
+
},
|
|
451
|
+
["poolId", "idempotencyKey", "options"]
|
|
452
|
+
);
|
|
453
|
+
sideEffects?.onError?.(err);
|
|
454
|
+
throw transformedError;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
async function revertBalanceChange2(transactionId, idempotencyKey, options) {
|
|
458
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
459
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
460
|
+
transactionId,
|
|
461
|
+
idempotencyKey,
|
|
462
|
+
instructingParty: options?.instructingParty
|
|
463
|
+
});
|
|
464
|
+
const reqOpts = revertBalanceChange(payload);
|
|
465
|
+
sideEffects?.onSiteCall?.();
|
|
466
|
+
try {
|
|
467
|
+
const result = await httpClient.request(reqOpts);
|
|
468
|
+
sideEffects?.onSuccess?.(result);
|
|
469
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
470
|
+
} catch (err) {
|
|
471
|
+
const transformedError = sdkTransformError(
|
|
472
|
+
err,
|
|
473
|
+
{
|
|
474
|
+
spreadPathsToArguments: {},
|
|
475
|
+
explicitPathsToArguments: {
|
|
476
|
+
transactionId: "$[0]",
|
|
477
|
+
idempotencyKey: "$[1]",
|
|
478
|
+
instructingParty: "$[2].instructingParty"
|
|
479
|
+
},
|
|
480
|
+
singleArgumentUnchanged: false
|
|
481
|
+
},
|
|
482
|
+
["transactionId", "idempotencyKey", "options"]
|
|
483
|
+
);
|
|
484
|
+
sideEffects?.onError?.(err);
|
|
485
|
+
throw transformedError;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
export {
|
|
489
|
+
ChangeBalanceRequestType,
|
|
490
|
+
IdentityType,
|
|
491
|
+
LimitRule,
|
|
492
|
+
PoolStatus,
|
|
493
|
+
SortOrder,
|
|
494
|
+
TransactionReversibility,
|
|
495
|
+
Type,
|
|
496
|
+
WebhookIdentityType,
|
|
497
|
+
changeBalance2 as changeBalance,
|
|
498
|
+
getBalance2 as getBalance,
|
|
499
|
+
listBalances2 as listBalances,
|
|
500
|
+
queryBalances2 as queryBalances,
|
|
501
|
+
revertBalanceChange2 as revertBalanceChange
|
|
502
|
+
};
|
|
503
|
+
//# sourceMappingURL=index.typings.mjs.map
|