1+ import { Relationship } from "./common"
2+
3+ type RewardStatus = "Sent" | "Rejected"
4+
5+ export interface Reward {
6+ /**
7+ * Identifier of the reward resource.
8+ */
9+ id : string
10+
11+ /**
12+ * Type of the reward resource. The value is always reward.
13+ */
14+ type : "reward"
15+
16+ /**
17+ * JSON object representing the reward data.
18+ */
19+ attributes : {
20+ /**
21+ * The date the reward was created.
22+ * RFC3339 format. For more information: https://en.wikipedia.org/wiki/ISO_8601#RFCs
23+ */
24+ createdAt : string
25+
26+ /**
27+ * The amount (in cents) of the reward.
28+ */
29+ amount : number
30+
31+ /**
32+ * Description of the reward.
33+ */
34+ description : string
35+
36+ /**
37+ * Either Sent or Rejected (see rejectReason for details).
38+ */
39+ status : RewardStatus
40+
41+ /**
42+ * Optional. More information about the status.
43+ */
44+ rejectReason : string
45+
46+ /**
47+ * See [Tags](https://developers.unit.co/#tags).
48+ */
49+ tags ?: object
50+ }
51+
52+ /**
53+ * Describes relationships between the reward resource and other resources (accounts, transaction, customer).
54+ */
55+ relationships : {
56+ /**
57+ * The account that received the funds.
58+ */
59+ receivingAccount : Relationship
60+
61+ /**
62+ * The account that sent the funds.
63+ */
64+ fundingAccount : Relationship
65+
66+ /**
67+ * Optional. The transaction that caused the reward.
68+ */
69+ rewardedTransaction ?: Relationship
70+
71+ /**
72+ * The [Customer](https://developers.unit.co/customers/) the deposit account belongs to.
73+ */
74+ customer : Relationship
75+
76+ /**
77+ * The [Reward Transaction](https://developers.unit.co/resources/#transaction-reward) generated by the reward.
78+ */
79+ transaction : Relationship
80+
81+ /**
82+ * Optional. The card the belongs to the rewardedTransaction (if exists)
83+ */
84+ card ?: Relationship
85+ }
86+ }
87+
88+ export interface CreateRewardRequest {
89+ type : "reward"
90+
91+ attributes : {
92+ /**
93+ * The amount (in cents) to reward the account.
94+ */
95+ amount : number
96+
97+ /**
98+ * Description of the reward (maximum of 50 characters).
99+ */
100+ description : string
101+
102+ /**
103+ * See [Tags](https://developers.unit.co/#tags).
104+ */
105+ tags ?: object
106+
107+ /**
108+ * See [Idempotency](https://developers.unit.co/#intro-idempotency).
109+ */
110+ idempotencyKey ?: string
111+ }
112+
113+ relationships : {
114+ /**
115+ * The account that will receive the reward.
116+ */
117+ receivingAccount : Relationship
118+
119+ /**
120+ * Optional. The account that will fund the reward, default is the revenue account.
121+ */
122+ fundingAccount ?: Relationship
123+
124+ /**
125+ * Optional. The transaction that triggered the reward (mostly relevant for cashback rewards).
126+ */
127+ rewardedTransaction ?: Relationship
128+ }
129+ }
130+
131+ export interface RewardListParams {
132+ /**
133+ * Maximum number of resources that will be returned. Maximum is 1000 resources. See Pagination.
134+ * default: 100
135+ */
136+ limit ?: number
137+
138+ /**
139+ * Number of resources to skip. See Pagination.
140+ * default: 0
141+ */
142+ offset ?: number
143+
144+ /**
145+ * Optional. Filters the results by the specified transaction id.
146+ */
147+ transactionId ?: string
148+
149+ /**
150+ * Optional. Filters the results by the specified rewarded transaction id.
151+ */
152+ rewardedTransactionId ?: string
153+
154+ /**
155+ * Optional. Filters the results by the specified account id.
156+ */
157+ receivingAccountId ?: string
158+
159+ /**
160+ * Optional. Filters the results by the specified customer id.
161+ */
162+ customerId ?: string
163+
164+ /**
165+ * Optional. Filters the results by the specified card id.
166+ */
167+ cardId ?: string
168+
169+ /**
170+ * Optional. Filter by reward Status. Usage example: filter[status][0]=Rejected.
171+ */
172+ status ?: string [ ]
173+
174+ /**
175+ * Optional. Filters the rewards that occurred after the specified date. e.g. 2020-01-13T16:01:19.346Z
176+ */
177+ since ?: string
178+
179+ /**
180+ * Optional. Filters the rewards that occurred before the specified date. e.g. 2020-01-02T20:06:23.486Z
181+ */
182+ until ?: string
183+
184+ /**
185+ * Optional. Filter rewards by [Tags](https://developers.unit.co/#tags).
186+ */
187+ tags ?: object
188+
189+ /**
190+ * Optional. Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
191+ * default: sort=-createdAt
192+ */
193+ sort ?: string
194+
195+ /**
196+ * Optional. A comma-separated list of related resources to include in the response.
197+ * Related resources include: customer, account. [See Getting Related Resources](https://developers.unit.co/#intro-getting-related-resources)
198+ */
199+ include ?: string
200+ }
0 commit comments