@better-giving/donation 3.0.4 → 3.0.5
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/donation-msgs-db.d.mts +51 -0
- package/dist/donation-msgs-db.mjs +29 -0
- package/dist/donations-db.d.mts +18 -0
- package/dist/donations-db.mjs +108 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +2 -0
- package/dist/interfaces.d.mts +300 -0
- package/dist/interfaces.mjs +1 -0
- package/dist/onhold-db.d.mts +17 -0
- package/dist/onhold-db.mjs +88 -0
- package/dist/paypal.d.mts +73 -0
- package/dist/paypal.mjs +1 -0
- package/dist/schema.d.mts +38 -4
- package/dist/schema.mjs +14 -0
- package/dist/subscriptions-db.d.mts +11 -0
- package/dist/subscriptions-db.mjs +35 -0
- package/package.json +6 -3
- package/src/donation-msgs-db.mts +73 -0
- package/src/donations-db.mts +133 -0
- package/src/index.mts +14 -0
- package/src/interfaces.mts +316 -0
- package/src/onhold-db.mts +118 -0
- package/src/paypal.mts +85 -0
- package/src/schema.mts +36 -4
- package/src/subscriptions-db.mts +50 -0
- package/src/donation-message.mts +0 -39
- package/src/donation.mts +0 -483
- package/src/subscription.mts +0 -34
package/src/donation.mts
DELETED
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
import type { ISODate } from "@better-giving/types/alias";
|
|
2
|
-
import type { ChainID, Environment } from "@better-giving/types/list";
|
|
3
|
-
import type { EmptyObject, OrStr } from "@better-giving/types/utils";
|
|
4
|
-
import type { Allocation, DonorTitle, Frequency } from "./schema.mjs";
|
|
5
|
-
|
|
6
|
-
export declare namespace Donation {
|
|
7
|
-
type Index =
|
|
8
|
-
| "AppUsed_Index"
|
|
9
|
-
| "Checked-8283_Index"
|
|
10
|
-
| "Email_Index"
|
|
11
|
-
| "EndowmentId_Index"
|
|
12
|
-
| "FundDeposits_Index"
|
|
13
|
-
| "Tax-Receipt-Sent_Index"
|
|
14
|
-
| "Network-FinalizedDate_Index"
|
|
15
|
-
| "WalletAddress_Index"
|
|
16
|
-
| "Referrer-FinalizedDate_index";
|
|
17
|
-
|
|
18
|
-
type App =
|
|
19
|
-
| "aging"
|
|
20
|
-
| "angel-protocol"
|
|
21
|
-
| "bg-marketplace"
|
|
22
|
-
| "bg-widget"
|
|
23
|
-
| "black-history-month"
|
|
24
|
-
| "make-whole"
|
|
25
|
-
| "mental-health"
|
|
26
|
-
| "restore-earth"
|
|
27
|
-
| "tester-app"
|
|
28
|
-
| "ukraine-portal";
|
|
29
|
-
|
|
30
|
-
type Source = Extract<
|
|
31
|
-
Donation.App,
|
|
32
|
-
"bg-marketplace" | "bg-widget" | "tester-app"
|
|
33
|
-
>;
|
|
34
|
-
|
|
35
|
-
type Client = "apes" | "normal";
|
|
36
|
-
|
|
37
|
-
type ApesComplianceReviewStatus = "pending" | "approved";
|
|
38
|
-
|
|
39
|
-
type PrimaryKey = {
|
|
40
|
-
transactionId: string; //PK
|
|
41
|
-
};
|
|
42
|
-
/** AppUsed_Index */
|
|
43
|
-
type AppUsed_IndexKey = {
|
|
44
|
-
appUsed?: App; //PK
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/** Checked-8283_Index */
|
|
48
|
-
type Checked_8283_IndexKey = {
|
|
49
|
-
checked8283?: "yes" | "no"; //PK
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/** Email_Index */
|
|
53
|
-
type EmailIndexKey = {
|
|
54
|
-
/** donor email */
|
|
55
|
-
email?: string; //PK
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** EndowmentId_Index */
|
|
59
|
-
type EndowmentId_IndexKey = {
|
|
60
|
-
endowmentId?: number; //PK
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
type FiatRamp_IndexKey = {
|
|
64
|
-
fiatRamp?: "STRIPE" | "PAYPAL" | "CHARIOT";
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/** FundDeposits_Index */
|
|
68
|
-
type FundDeposits_IndexKey = {
|
|
69
|
-
fundDepositTxHash?: string; //PK
|
|
70
|
-
donationFinalTxHash?: string; //SK
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/** Network-FinalizedDate_Index */
|
|
74
|
-
type Network_FinalizedDate_IndexKey = {
|
|
75
|
-
network: Environment; //PK
|
|
76
|
-
donationFinalTxDate: ISODate; //SK
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/** Referrer-FinalizedDate_Index */
|
|
80
|
-
type Referrer_FinalizedDate_IndexKey = {
|
|
81
|
-
referrer?: string; //PK
|
|
82
|
-
donationFinalTxDate: ISODate; //SK
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/** Tax-Receipt-Sent_Index */
|
|
86
|
-
type Tax_Receipt_Sent_IndexKey = {
|
|
87
|
-
taxReceiptSent?: "yes" | "no"; //PK
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/** WalletAddress_Index */
|
|
91
|
-
type WalletAddress_Index = {
|
|
92
|
-
walletAddress?: string; //PK
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
type DonorBasicInfo = {
|
|
96
|
-
/** may be empty */
|
|
97
|
-
title?: DonorTitle;
|
|
98
|
-
fullName: string;
|
|
99
|
-
kycEmail: string;
|
|
100
|
-
/** signifies eligibility to UK Gift Aid, defaults to `false` for crypto donations */
|
|
101
|
-
ukGiftAid: boolean;
|
|
102
|
-
};
|
|
103
|
-
type DonorAddress = {
|
|
104
|
-
streetAddress: string;
|
|
105
|
-
/** may be empty `''` */
|
|
106
|
-
city: string;
|
|
107
|
-
/** optional */
|
|
108
|
-
state?: string;
|
|
109
|
-
zipCode: string;
|
|
110
|
-
country: string;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
type V2FullKyc = DonorBasicInfo & DonorAddress;
|
|
114
|
-
type V2Kyc = DonorBasicInfo | V2FullKyc;
|
|
115
|
-
type PartialV2Kyc = Partial<V2FullKyc>;
|
|
116
|
-
|
|
117
|
-
interface ReferrerCommission {
|
|
118
|
-
from_tip: number;
|
|
119
|
-
from_fee: number;
|
|
120
|
-
/** exist when paid */
|
|
121
|
-
transfer_id?: number;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
type V2NonKeyAttributes = {
|
|
125
|
-
/** program which the donation is attributed: may be empty `""` */
|
|
126
|
-
programId?: string;
|
|
127
|
-
programName?: string;
|
|
128
|
-
/** honorary full name - may be empty `""` */
|
|
129
|
-
inHonorOf?: string;
|
|
130
|
-
/** only allowed if honoree is provided */
|
|
131
|
-
tributeNotif?: Donation.TributeNotif;
|
|
132
|
-
transactionDate: ISODate;
|
|
133
|
-
/** if tipAmount is present, value includes tipAmount */
|
|
134
|
-
amount: number;
|
|
135
|
-
/** USD value at the time of donation */
|
|
136
|
-
usdValue: number;
|
|
137
|
-
/**
|
|
138
|
-
* settled USD amount before fsa,base fees
|
|
139
|
-
*
|
|
140
|
-
* Crypto: post-swaps USDC amount and converted to USD equivalent
|
|
141
|
-
*
|
|
142
|
-
* Fiat: 1:1 for USD donations while post-FX conversion for non USD donations
|
|
143
|
-
*/
|
|
144
|
-
settledUsdAmount: number;
|
|
145
|
-
feeAllowance: number;
|
|
146
|
-
/** what's left of feeAllowance after covering processing fee, could be less than 0 (loss) */
|
|
147
|
-
excessFeeAllowanceUsd: number;
|
|
148
|
-
/** indicates DB record is not yet separated into endow-record & tip-record */
|
|
149
|
-
tipAmount?: number;
|
|
150
|
-
/** indicates this is a tip record extracted from parent */
|
|
151
|
-
parentTx?: string;
|
|
152
|
-
|
|
153
|
-
denomination: string;
|
|
154
|
-
chainId: ChainID.V2SupportedChainID;
|
|
155
|
-
chainName: string;
|
|
156
|
-
/** 0 - 100 */
|
|
157
|
-
splitLiq: string;
|
|
158
|
-
|
|
159
|
-
charityName: string;
|
|
160
|
-
nonProfitMsg?: string;
|
|
161
|
-
msg_to_npo?: string;
|
|
162
|
-
claimed: boolean;
|
|
163
|
-
fiscalSponsored: boolean;
|
|
164
|
-
client: Client;
|
|
165
|
-
network: Environment;
|
|
166
|
-
paymentMethod: string;
|
|
167
|
-
isRecurring: boolean;
|
|
168
|
-
|
|
169
|
-
//finalized
|
|
170
|
-
destinationChainId: OrStr<ChainID.V2DestinationChainID>;
|
|
171
|
-
donationFinalAmount: number;
|
|
172
|
-
donationFinalChainId: OrStr<ChainID.V2DestinationChainID>;
|
|
173
|
-
donationFinalDenom: string;
|
|
174
|
-
donationFinalTxDate: ISODate;
|
|
175
|
-
donationFinalTxHash: string;
|
|
176
|
-
|
|
177
|
-
//fees
|
|
178
|
-
baseFee: number;
|
|
179
|
-
processingFee: number;
|
|
180
|
-
fiscalSponsorFee: number;
|
|
181
|
-
referrer_commission?: ReferrerCommission;
|
|
182
|
-
|
|
183
|
-
/// fundraiser this donation is attributed to
|
|
184
|
-
fund_id?: string;
|
|
185
|
-
fund_name?: string;
|
|
186
|
-
fund_tx?: string;
|
|
187
|
-
|
|
188
|
-
company_name?: string;
|
|
189
|
-
allocation?: Allocation;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
type NonKeyAttributes = {
|
|
193
|
-
addressComplement?: " ";
|
|
194
|
-
/** one record with this value */
|
|
195
|
-
apesComplianceNewRecipient?: 4;
|
|
196
|
-
apesComplianceReviewStatus?: ApesComplianceReviewStatus;
|
|
197
|
-
apesComplianceTimeWindow?: ISODate;
|
|
198
|
-
/** source chainID */
|
|
199
|
-
chainId?:
|
|
200
|
-
| ChainID.V2SupportedChainID
|
|
201
|
-
/** terra */
|
|
202
|
-
| "bombay-12"
|
|
203
|
-
| "columbus-5"
|
|
204
|
-
//juno
|
|
205
|
-
| "uni-4"
|
|
206
|
-
| "uni-5";
|
|
207
|
-
|
|
208
|
-
/** string charityId is terra endow address */
|
|
209
|
-
charityId?: string | number;
|
|
210
|
-
|
|
211
|
-
consent_marketing?: boolean;
|
|
212
|
-
consent_tax?: boolean;
|
|
213
|
-
cryptoFee?: number;
|
|
214
|
-
donationFinalChainId?:
|
|
215
|
-
| ChainID.V2DestinationChainID
|
|
216
|
-
| "juno-1"
|
|
217
|
-
| "staging"
|
|
218
|
-
| "uni-4"
|
|
219
|
-
| "uni-5";
|
|
220
|
-
|
|
221
|
-
fiscalSponsorshipFee?: number;
|
|
222
|
-
/** @deprecated */
|
|
223
|
-
fundId?: number;
|
|
224
|
-
/** @deprecated only one record with this value */
|
|
225
|
-
fundMembers?: string[];
|
|
226
|
-
name?: string;
|
|
227
|
-
nftAddress?: string;
|
|
228
|
-
nftRequested?: boolean;
|
|
229
|
-
receiptRequested?: boolean;
|
|
230
|
-
|
|
231
|
-
stateAddress?: string;
|
|
232
|
-
/** initialized as "null" */
|
|
233
|
-
swapDenomination?: string;
|
|
234
|
-
swapFinalAmount?: number;
|
|
235
|
-
swapFinished?: boolean;
|
|
236
|
-
swapStarted?: boolean;
|
|
237
|
-
taxReceiptId?: string;
|
|
238
|
-
tcaAssociation?: string;
|
|
239
|
-
transactionDate: ISODate;
|
|
240
|
-
ustFinal?: number;
|
|
241
|
-
} & PartialV2Kyc &
|
|
242
|
-
// omitted attributes, to not override broader definition
|
|
243
|
-
Partial<
|
|
244
|
-
Omit<
|
|
245
|
-
V2NonKeyAttributes,
|
|
246
|
-
"chainId" | "donationFinalChainId" | "transactionDate"
|
|
247
|
-
>
|
|
248
|
-
>;
|
|
249
|
-
|
|
250
|
-
type DBRecord = PrimaryKey &
|
|
251
|
-
AppUsed_IndexKey &
|
|
252
|
-
Checked_8283_IndexKey &
|
|
253
|
-
EmailIndexKey &
|
|
254
|
-
EndowmentId_IndexKey &
|
|
255
|
-
FiatRamp_IndexKey &
|
|
256
|
-
FundDeposits_IndexKey &
|
|
257
|
-
Network_FinalizedDate_IndexKey &
|
|
258
|
-
Tax_Receipt_Sent_IndexKey &
|
|
259
|
-
WalletAddress_Index &
|
|
260
|
-
NonKeyAttributes;
|
|
261
|
-
|
|
262
|
-
type WithoutKYC = { kycEmail?: never };
|
|
263
|
-
type WithKYC = V2Kyc;
|
|
264
|
-
|
|
265
|
-
/** only use this definition on writes: for reads, it's safer to use DBRecord */
|
|
266
|
-
type V2DBRecord = PrimaryKey &
|
|
267
|
-
EmailIndexKey &
|
|
268
|
-
FiatRamp_IndexKey &
|
|
269
|
-
/** be sure to include in crypto donation */
|
|
270
|
-
WalletAddress_Index &
|
|
271
|
-
Referrer_FinalizedDate_IndexKey &
|
|
272
|
-
Required<EndowmentId_IndexKey> &
|
|
273
|
-
Required<AppUsed_IndexKey> &
|
|
274
|
-
(WithKYC | WithoutKYC) &
|
|
275
|
-
V2NonKeyAttributes;
|
|
276
|
-
|
|
277
|
-
/** only use this definition on writes: for reads, it's safer to use DBRecord */
|
|
278
|
-
type V2InitCryptoDBRecord = PrimaryKey &
|
|
279
|
-
EmailIndexKey &
|
|
280
|
-
/** be sure to include in crypto donation */
|
|
281
|
-
WalletAddress_Index &
|
|
282
|
-
Required<EndowmentId_IndexKey> &
|
|
283
|
-
Required<AppUsed_IndexKey> &
|
|
284
|
-
(WithKYC | WithoutKYC);
|
|
285
|
-
|
|
286
|
-
type TributeNotif = {
|
|
287
|
-
toFullName: string;
|
|
288
|
-
toEmail: string;
|
|
289
|
-
/** may be empty `""` */
|
|
290
|
-
fromMsg: string;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
/** web-app determinant: show signup page or not*/
|
|
294
|
-
type GuestDonor = {
|
|
295
|
-
email: string;
|
|
296
|
-
fullName: string;
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export declare namespace OnHoldDonation {
|
|
301
|
-
type PrimaryKey = {
|
|
302
|
-
transactionId: string; //PK
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
type Index = "Email_Index" | "EndowmentId_Index" | "fiatRamp_Index";
|
|
306
|
-
|
|
307
|
-
type ApesAttributes = {
|
|
308
|
-
client: Extract<Donation.Client, "apes">;
|
|
309
|
-
apesComplianceReviewStatus: Donation.ApesComplianceReviewStatus;
|
|
310
|
-
apesComplianceTimeWindow: ISODate;
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
type CryptoAttributes = {
|
|
314
|
-
chainId: ChainID.V2CryptoChainID;
|
|
315
|
-
destinationChainId: Exclude<ChainID.V2DestinationChainID, "fiat">;
|
|
316
|
-
walletAddress: string;
|
|
317
|
-
/** status of this record should NOT be changed by our pipelines */
|
|
318
|
-
third_party?: true;
|
|
319
|
-
/** Nowpayments: number, custom: uuid */
|
|
320
|
-
payment_id?: number | string;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
type FiatAttributes = {
|
|
324
|
-
chainId: ChainID.V2FiatChainID;
|
|
325
|
-
destinationChainId: Extract<ChainID.V2DestinationChainID, "fiat">;
|
|
326
|
-
/** we can only know the method once it's confirmed by webhook */
|
|
327
|
-
paymentMethod?: string;
|
|
328
|
-
/** only exists if donor opts for manual bank verification */
|
|
329
|
-
stripeDepositVerifyUrl?: string;
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
type NonKeyAttributes = {
|
|
333
|
-
/** tip, fee-allowance is included*/
|
|
334
|
-
amount: number;
|
|
335
|
-
/** tip, fee-allowance is included*/
|
|
336
|
-
usdValue: number;
|
|
337
|
-
/** same denomination as amount */
|
|
338
|
-
tipAmount?: number;
|
|
339
|
-
/** same denomination as amount */
|
|
340
|
-
feeAllowance?: number;
|
|
341
|
-
appUsed: Donation.App;
|
|
342
|
-
chainName: string;
|
|
343
|
-
/** fund name or npo name, as onhold records not yet distributed */
|
|
344
|
-
charityName: string;
|
|
345
|
-
nonProfitMsg?: string;
|
|
346
|
-
/** upper case */
|
|
347
|
-
denomination: string;
|
|
348
|
-
donationFinalized: boolean;
|
|
349
|
-
endowmentId: number;
|
|
350
|
-
/** donation to fund */
|
|
351
|
-
fund_id?: string;
|
|
352
|
-
/** donation to fund */
|
|
353
|
-
fund_name?: string;
|
|
354
|
-
/** endowment ids */
|
|
355
|
-
fund_members?: number[];
|
|
356
|
-
/** program donation: may be empty `""`*/
|
|
357
|
-
programId?: string;
|
|
358
|
-
programName?: string;
|
|
359
|
-
claimed: boolean;
|
|
360
|
-
fiscalSponsored: boolean;
|
|
361
|
-
hideBgTip?: boolean;
|
|
362
|
-
network: Environment;
|
|
363
|
-
/** "0" - "100" */
|
|
364
|
-
splitLiq: string;
|
|
365
|
-
status?: "intent" | "pending";
|
|
366
|
-
transactionDate: ISODate;
|
|
367
|
-
/** TTL attribute */
|
|
368
|
-
expireAt?: number;
|
|
369
|
-
/** for new records only: `true` is recurring */
|
|
370
|
-
isRecurring?: boolean;
|
|
371
|
-
/** honorary full name - may be empty `''` */
|
|
372
|
-
inHonorOf?: string;
|
|
373
|
-
/** only allowed if honoree is provided */
|
|
374
|
-
tributeNotif?: Donation.TributeNotif;
|
|
375
|
-
donor_message?: string;
|
|
376
|
-
msg_to_npo?: string;
|
|
377
|
-
donor_public?: boolean;
|
|
378
|
-
company_name?: string;
|
|
379
|
-
allocation?: Allocation;
|
|
380
|
-
} & (ApesAttributes | EmptyObject) &
|
|
381
|
-
(Donation.WithKYC | Donation.WithoutKYC);
|
|
382
|
-
|
|
383
|
-
type CryptoDBRecord = PrimaryKey &
|
|
384
|
-
NonKeyAttributes &
|
|
385
|
-
CryptoAttributes &
|
|
386
|
-
Donation.EmailIndexKey;
|
|
387
|
-
|
|
388
|
-
type FiatDBRecord = PrimaryKey &
|
|
389
|
-
Required<Donation.FiatRamp_IndexKey> &
|
|
390
|
-
NonKeyAttributes &
|
|
391
|
-
FiatAttributes &
|
|
392
|
-
Required<Donation.EmailIndexKey>; //email is required for fiat donations
|
|
393
|
-
|
|
394
|
-
type DBRecord = CryptoDBRecord | FiatDBRecord;
|
|
395
|
-
|
|
396
|
-
/** Only used when donation is finalized and ready for transfer to Donations DB */
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
export declare namespace FiatDonations {
|
|
400
|
-
type Currency = {
|
|
401
|
-
/** lowercase ISO 4217 code */
|
|
402
|
-
currency_code: string;
|
|
403
|
-
minimum_amount: number;
|
|
404
|
-
rate: number;
|
|
405
|
-
timestamp: string;
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
export declare namespace PayPalDonation {
|
|
410
|
-
type CreateOrder = {
|
|
411
|
-
purchase_units: PurchaseUnit[];
|
|
412
|
-
intent: Intent;
|
|
413
|
-
payment_source?: PaymentSource;
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
// see Response object description in official docs
|
|
417
|
-
// https://developer.paypal.com/docs/api/orders/v2/#orders_create
|
|
418
|
-
type Order = {
|
|
419
|
-
id: string;
|
|
420
|
-
status: Status;
|
|
421
|
-
intent: Intent;
|
|
422
|
-
payment_source: PaymentSource;
|
|
423
|
-
purchase_units: PurchaseUnit[];
|
|
424
|
-
payer: Payer;
|
|
425
|
-
create_time: Date;
|
|
426
|
-
links: Link[];
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
type Link = {
|
|
430
|
-
href: string;
|
|
431
|
-
rel: string;
|
|
432
|
-
method: string;
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
type Payer = {
|
|
436
|
-
name: Name;
|
|
437
|
-
email_address: string;
|
|
438
|
-
payer_id: string;
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
type PaymentSource = {
|
|
442
|
-
paypal: {
|
|
443
|
-
name: Name;
|
|
444
|
-
email_address: string;
|
|
445
|
-
account_id: string;
|
|
446
|
-
};
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
type Name = {
|
|
450
|
-
given_name: string;
|
|
451
|
-
surname: string;
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
type PurchaseUnit = {
|
|
455
|
-
// don't need 'reference_id'
|
|
456
|
-
amount: {
|
|
457
|
-
/** Three-character ISO-4217 code. */
|
|
458
|
-
currency_code: string;
|
|
459
|
-
value: string;
|
|
460
|
-
};
|
|
461
|
-
/** @link https://developer.paypal.com/docs/api/orders/v2/#orders_get */
|
|
462
|
-
payments?: {
|
|
463
|
-
captures: CapturedPayment[];
|
|
464
|
-
};
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
type CapturedPayment = {
|
|
468
|
-
seller_receivable_breakdown: {
|
|
469
|
-
gross_amount: { value: number };
|
|
470
|
-
paypal_fee: { value: number };
|
|
471
|
-
net_amount: { value: number };
|
|
472
|
-
};
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
type Intent = "CAPTURE" | "AUTHORIZE";
|
|
476
|
-
type Status =
|
|
477
|
-
| "CREATED"
|
|
478
|
-
| "SAVED"
|
|
479
|
-
| "APPROVED"
|
|
480
|
-
| "VOIDED"
|
|
481
|
-
| "COMPLETED"
|
|
482
|
-
| "PAYER_ACTION_REQUIRED";
|
|
483
|
-
}
|
package/src/subscription.mts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Environment } from "@better-giving/types/list";
|
|
2
|
-
import type { Donation } from "./donation.mjs";
|
|
3
|
-
|
|
4
|
-
export declare namespace Subscription {
|
|
5
|
-
interface PrimaryKey {
|
|
6
|
-
subscription_id: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface NonKeyAttributes {
|
|
10
|
-
app_used: Donation.App;
|
|
11
|
-
charity_name: string;
|
|
12
|
-
customer_id: string;
|
|
13
|
-
email: string;
|
|
14
|
-
endowment_id: number;
|
|
15
|
-
fiat_ramp: "STRIPE";
|
|
16
|
-
fiscal_sponsored: boolean;
|
|
17
|
-
hide_bg_tip: boolean;
|
|
18
|
-
/** URL link to latest invoice */
|
|
19
|
-
latest_invoice?: string;
|
|
20
|
-
network: Environment;
|
|
21
|
-
product_id: string;
|
|
22
|
-
/**
|
|
23
|
-
* Determines overall price the user has to pay
|
|
24
|
-
* For example, we have a recurring subscription plan of $1 per month.
|
|
25
|
-
* If quantity is set to 2 then the user pays $2 per month
|
|
26
|
-
*/
|
|
27
|
-
quantity: number;
|
|
28
|
-
split_liq: string;
|
|
29
|
-
/** @link https://docs.stripe.com/billing/subscriptions/overview#payment-status */
|
|
30
|
-
status: "active" | "incomplete";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface DBRecord extends PrimaryKey, NonKeyAttributes {}
|
|
34
|
-
}
|