@better-giving/donation 3.0.17 → 3.0.18
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 +0 -32
- package/dist/donations-db.mjs +1 -1
- package/package.json +1 -1
- package/src/donation-msgs-db.mts +0 -35
- package/src/donations-db.mts +1 -1
- package/dist/donation-message.d.mts +0 -34
- package/dist/donation-message.mjs +0 -1
- package/dist/donation.d.mts +0 -355
- package/dist/donation.mjs +0 -1
- package/dist/final-recorder.d.mts +0 -18
- package/dist/final-recorder.mjs +0 -1
- package/dist/get-min-fee-allowance.d.mts +0 -7
- package/dist/get-min-fee-allowance.mjs +0 -16
- package/dist/intent.d.mts +0 -110
- package/dist/intent.mjs +0 -65
- package/dist/old-intent.d.mts +0 -112
- package/dist/old-intent.mjs +0 -89
- package/dist/subscription.d.mts +0 -32
- package/dist/subscription.mjs +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Db } from "@better-giving/db";
|
|
2
2
|
import type { ISODate } from "@better-giving/types/alias";
|
|
3
3
|
import type { IPageKeyed } from "@better-giving/types/api";
|
|
4
|
-
import type { Environment } from "@better-giving/types/list";
|
|
5
4
|
import type { IPublicDonor } from "./interfaces.mjs";
|
|
6
5
|
import type { IPageOpts } from "./schema.mjs";
|
|
7
6
|
export type DMKey = `DM#${string}`;
|
|
@@ -18,34 +17,3 @@ export declare class DonationDonorsDb extends Db {
|
|
|
18
17
|
};
|
|
19
18
|
list(recipient: string, opts?: IPageOpts): Promise<IPageKeyed<IPublicDonor>>;
|
|
20
19
|
}
|
|
21
|
-
export declare namespace GSI1 {
|
|
22
|
-
type Name = "recipient-env-gsi";
|
|
23
|
-
interface Key {
|
|
24
|
-
/** `Recipient#{recipient_id}#{env}` */
|
|
25
|
-
gsi1PK: `Recipient#${string}#${Environment}`;
|
|
26
|
-
gsi1SK: ISODate;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export declare namespace DonationMessage {
|
|
30
|
-
/** `DM#{uuid}` */
|
|
31
|
-
interface PrimaryKey {
|
|
32
|
-
PK: DMKey;
|
|
33
|
-
SK: DMKey;
|
|
34
|
-
}
|
|
35
|
-
interface NonKeyAttributes {
|
|
36
|
-
/** USD amount at the time of donation */
|
|
37
|
-
amount: number;
|
|
38
|
-
date: ISODate;
|
|
39
|
-
donation_id: string;
|
|
40
|
-
donor_id: string;
|
|
41
|
-
donor_message: string;
|
|
42
|
-
donor_name: string;
|
|
43
|
-
env: Environment;
|
|
44
|
-
/** uuidv4 */
|
|
45
|
-
id: string;
|
|
46
|
-
/** Endow or fund ID */
|
|
47
|
-
recipient_id: string;
|
|
48
|
-
}
|
|
49
|
-
interface DBRecord extends PrimaryKey, NonKeyAttributes, GSI1.Key {
|
|
50
|
-
}
|
|
51
|
-
}
|
package/dist/donations-db.mjs
CHANGED
package/package.json
CHANGED
package/src/donation-msgs-db.mts
CHANGED
|
@@ -36,38 +36,3 @@ export class DonationDonorsDb extends Db {
|
|
|
36
36
|
return this.client.send(cmd).then(this.to_page<IPublicDonor>);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
export declare namespace GSI1 {
|
|
41
|
-
type Name = "recipient-env-gsi";
|
|
42
|
-
|
|
43
|
-
interface Key {
|
|
44
|
-
/** `Recipient#{recipient_id}#{env}` */
|
|
45
|
-
gsi1PK: `Recipient#${string}#${Environment}`;
|
|
46
|
-
gsi1SK: ISODate;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export declare namespace DonationMessage {
|
|
51
|
-
/** `DM#{uuid}` */
|
|
52
|
-
interface PrimaryKey {
|
|
53
|
-
PK: DMKey;
|
|
54
|
-
SK: DMKey;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
interface NonKeyAttributes {
|
|
58
|
-
/** USD amount at the time of donation */
|
|
59
|
-
amount: number;
|
|
60
|
-
date: ISODate;
|
|
61
|
-
donation_id: string;
|
|
62
|
-
donor_id: string;
|
|
63
|
-
donor_message: string;
|
|
64
|
-
donor_name: string;
|
|
65
|
-
env: Environment;
|
|
66
|
-
/** uuidv4 */
|
|
67
|
-
id: string;
|
|
68
|
-
/** Endow or fund ID */
|
|
69
|
-
recipient_id: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
interface DBRecord extends PrimaryKey, NonKeyAttributes, GSI1.Key {}
|
|
73
|
-
}
|
package/src/donations-db.mts
CHANGED
|
@@ -39,7 +39,7 @@ export class DonationsDb extends Db {
|
|
|
39
39
|
return this.client.send(cmd).then((r) => r.Item as any);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
put_txi(data: TExplicit<IDonationFinalAttr>) {
|
|
43
43
|
const cmd = new PutCommand({
|
|
44
44
|
TableName: this.table,
|
|
45
45
|
Item: data,
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ISODate } from "@better-giving/types/alias";
|
|
2
|
-
import type { Environment } from "@better-giving/types/list";
|
|
3
|
-
export type DMKey = `DM#${string}`;
|
|
4
|
-
export declare namespace GSI1 {
|
|
5
|
-
type Name = "recipient-env-gsi";
|
|
6
|
-
interface Key {
|
|
7
|
-
/** `Recipient#{recipient_id}#{env}` */
|
|
8
|
-
gsi1PK: `Recipient#${string}#${Environment}`;
|
|
9
|
-
gsi1SK: ISODate;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export declare namespace DonationMessage {
|
|
13
|
-
/** `DM#{uuid}` */
|
|
14
|
-
interface PrimaryKey {
|
|
15
|
-
PK: DMKey;
|
|
16
|
-
SK: DMKey;
|
|
17
|
-
}
|
|
18
|
-
interface NonKeyAttributes {
|
|
19
|
-
/** USD amount at the time of donation */
|
|
20
|
-
amount: number;
|
|
21
|
-
date: ISODate;
|
|
22
|
-
donation_id: string;
|
|
23
|
-
donor_id: string;
|
|
24
|
-
donor_message: string;
|
|
25
|
-
donor_name: string;
|
|
26
|
-
env: Environment;
|
|
27
|
-
/** uuidv4 */
|
|
28
|
-
id: string;
|
|
29
|
-
/** Endow or fund ID */
|
|
30
|
-
recipient_id: string;
|
|
31
|
-
}
|
|
32
|
-
interface DBRecord extends PrimaryKey, NonKeyAttributes, GSI1.Key {
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/donation.d.mts
DELETED
|
@@ -1,355 +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 } from "./schema.mjs";
|
|
5
|
-
export declare namespace Donation {
|
|
6
|
-
type Index = "AppUsed_Index" | "Checked-8283_Index" | "Email_Index" | "EndowmentId_Index" | "FundDeposits_Index" | "Tax-Receipt-Sent_Index" | "Network-FinalizedDate_Index" | "WalletAddress_Index" | "Referrer-FinalizedDate_index";
|
|
7
|
-
type App = "aging" | "angel-protocol" | "bg-marketplace" | "bg-widget" | "black-history-month" | "make-whole" | "mental-health" | "restore-earth" | "tester-app" | "ukraine-portal";
|
|
8
|
-
type Source = Extract<Donation.App, "bg-marketplace" | "bg-widget" | "tester-app">;
|
|
9
|
-
type Client = "apes" | "normal";
|
|
10
|
-
type ApesComplianceReviewStatus = "pending" | "approved";
|
|
11
|
-
type PrimaryKey = {
|
|
12
|
-
transactionId: string;
|
|
13
|
-
};
|
|
14
|
-
/** AppUsed_Index */
|
|
15
|
-
type AppUsed_IndexKey = {
|
|
16
|
-
appUsed?: App;
|
|
17
|
-
};
|
|
18
|
-
/** Checked-8283_Index */
|
|
19
|
-
type Checked_8283_IndexKey = {
|
|
20
|
-
checked8283?: "yes" | "no";
|
|
21
|
-
};
|
|
22
|
-
/** Email_Index */
|
|
23
|
-
type EmailIndexKey = {
|
|
24
|
-
/** donor email */
|
|
25
|
-
email?: string;
|
|
26
|
-
};
|
|
27
|
-
/** EndowmentId_Index */
|
|
28
|
-
type EndowmentId_IndexKey = {
|
|
29
|
-
endowmentId?: number;
|
|
30
|
-
};
|
|
31
|
-
type FiatRamp_IndexKey = {
|
|
32
|
-
fiatRamp?: "STRIPE" | "PAYPAL" | "CHARIOT";
|
|
33
|
-
};
|
|
34
|
-
/** FundDeposits_Index */
|
|
35
|
-
type FundDeposits_IndexKey = {
|
|
36
|
-
fundDepositTxHash?: string;
|
|
37
|
-
donationFinalTxHash?: string;
|
|
38
|
-
};
|
|
39
|
-
/** Network-FinalizedDate_Index */
|
|
40
|
-
type Network_FinalizedDate_IndexKey = {
|
|
41
|
-
network: Environment;
|
|
42
|
-
donationFinalTxDate: ISODate;
|
|
43
|
-
};
|
|
44
|
-
/** Referrer-FinalizedDate_Index */
|
|
45
|
-
type Referrer_FinalizedDate_IndexKey = {
|
|
46
|
-
referrer?: string;
|
|
47
|
-
donationFinalTxDate: ISODate;
|
|
48
|
-
};
|
|
49
|
-
/** Tax-Receipt-Sent_Index */
|
|
50
|
-
type Tax_Receipt_Sent_IndexKey = {
|
|
51
|
-
taxReceiptSent?: "yes" | "no";
|
|
52
|
-
};
|
|
53
|
-
/** WalletAddress_Index */
|
|
54
|
-
type WalletAddress_Index = {
|
|
55
|
-
walletAddress?: string;
|
|
56
|
-
};
|
|
57
|
-
type DonorBasicInfo = {
|
|
58
|
-
/** may be empty */
|
|
59
|
-
title?: DonorTitle;
|
|
60
|
-
fullName: string;
|
|
61
|
-
kycEmail: string;
|
|
62
|
-
/** signifies eligibility to UK Gift Aid, defaults to `false` for crypto donations */
|
|
63
|
-
ukGiftAid: boolean;
|
|
64
|
-
};
|
|
65
|
-
type DonorAddress = {
|
|
66
|
-
streetAddress: string;
|
|
67
|
-
/** may be empty `''` */
|
|
68
|
-
city: string;
|
|
69
|
-
/** optional */
|
|
70
|
-
state?: string;
|
|
71
|
-
zipCode: string;
|
|
72
|
-
country: string;
|
|
73
|
-
};
|
|
74
|
-
type V2FullKyc = DonorBasicInfo & DonorAddress;
|
|
75
|
-
type V2Kyc = DonorBasicInfo | V2FullKyc;
|
|
76
|
-
type PartialV2Kyc = Partial<V2FullKyc>;
|
|
77
|
-
interface ReferrerCommission {
|
|
78
|
-
from_tip: number;
|
|
79
|
-
from_fee: number;
|
|
80
|
-
/** exist when paid */
|
|
81
|
-
transfer_id?: number;
|
|
82
|
-
}
|
|
83
|
-
type V2NonKeyAttributes = {
|
|
84
|
-
/** program which the donation is attributed: may be empty `""` */
|
|
85
|
-
programId?: string;
|
|
86
|
-
programName?: string;
|
|
87
|
-
/** honorary full name - may be empty `""` */
|
|
88
|
-
inHonorOf?: string;
|
|
89
|
-
/** only allowed if honoree is provided */
|
|
90
|
-
tributeNotif?: Donation.TributeNotif;
|
|
91
|
-
transactionDate: ISODate;
|
|
92
|
-
/** if tipAmount is present, value includes tipAmount */
|
|
93
|
-
amount: number;
|
|
94
|
-
/** USD value at the time of donation */
|
|
95
|
-
usdValue: number;
|
|
96
|
-
/**
|
|
97
|
-
* settled USD amount before fsa,base fees
|
|
98
|
-
*
|
|
99
|
-
* Crypto: post-swaps USDC amount and converted to USD equivalent
|
|
100
|
-
*
|
|
101
|
-
* Fiat: 1:1 for USD donations while post-FX conversion for non USD donations
|
|
102
|
-
*/
|
|
103
|
-
settledUsdAmount: number;
|
|
104
|
-
feeAllowance: number;
|
|
105
|
-
/** what's left of feeAllowance after covering processing fee, could be less than 0 (loss) */
|
|
106
|
-
excessFeeAllowanceUsd: number;
|
|
107
|
-
/** indicates DB record is not yet separated into endow-record & tip-record */
|
|
108
|
-
tipAmount?: number;
|
|
109
|
-
/** indicates this is a tip record extracted from parent */
|
|
110
|
-
parentTx?: string;
|
|
111
|
-
denomination: string;
|
|
112
|
-
chainId: ChainID.V2SupportedChainID;
|
|
113
|
-
chainName: string;
|
|
114
|
-
/** 0 - 100 */
|
|
115
|
-
splitLiq: string;
|
|
116
|
-
charityName: string;
|
|
117
|
-
nonProfitMsg?: string;
|
|
118
|
-
msg_to_npo?: string;
|
|
119
|
-
claimed: boolean;
|
|
120
|
-
fiscalSponsored: boolean;
|
|
121
|
-
client: Client;
|
|
122
|
-
network: Environment;
|
|
123
|
-
paymentMethod: string;
|
|
124
|
-
isRecurring: boolean;
|
|
125
|
-
destinationChainId: OrStr<ChainID.V2DestinationChainID>;
|
|
126
|
-
donationFinalAmount: number;
|
|
127
|
-
donationFinalChainId: OrStr<ChainID.V2DestinationChainID>;
|
|
128
|
-
donationFinalDenom: string;
|
|
129
|
-
donationFinalTxDate: ISODate;
|
|
130
|
-
donationFinalTxHash: string;
|
|
131
|
-
baseFee: number;
|
|
132
|
-
processingFee: number;
|
|
133
|
-
fiscalSponsorFee: number;
|
|
134
|
-
referrer_commission?: ReferrerCommission;
|
|
135
|
-
fund_id?: string;
|
|
136
|
-
fund_name?: string;
|
|
137
|
-
fund_tx?: string;
|
|
138
|
-
company_name?: string;
|
|
139
|
-
allocation?: Allocation;
|
|
140
|
-
};
|
|
141
|
-
type NonKeyAttributes = {
|
|
142
|
-
addressComplement?: " ";
|
|
143
|
-
/** one record with this value */
|
|
144
|
-
apesComplianceNewRecipient?: 4;
|
|
145
|
-
apesComplianceReviewStatus?: ApesComplianceReviewStatus;
|
|
146
|
-
apesComplianceTimeWindow?: ISODate;
|
|
147
|
-
/** source chainID */
|
|
148
|
-
chainId?: ChainID.V2SupportedChainID
|
|
149
|
-
/** terra */
|
|
150
|
-
| "bombay-12" | "columbus-5" | "uni-4" | "uni-5";
|
|
151
|
-
/** string charityId is terra endow address */
|
|
152
|
-
charityId?: string | number;
|
|
153
|
-
consent_marketing?: boolean;
|
|
154
|
-
consent_tax?: boolean;
|
|
155
|
-
cryptoFee?: number;
|
|
156
|
-
donationFinalChainId?: ChainID.V2DestinationChainID | "juno-1" | "staging" | "uni-4" | "uni-5";
|
|
157
|
-
fiscalSponsorshipFee?: number;
|
|
158
|
-
/** @deprecated */
|
|
159
|
-
fundId?: number;
|
|
160
|
-
/** @deprecated only one record with this value */
|
|
161
|
-
fundMembers?: string[];
|
|
162
|
-
name?: string;
|
|
163
|
-
nftAddress?: string;
|
|
164
|
-
nftRequested?: boolean;
|
|
165
|
-
receiptRequested?: boolean;
|
|
166
|
-
stateAddress?: string;
|
|
167
|
-
/** initialized as "null" */
|
|
168
|
-
swapDenomination?: string;
|
|
169
|
-
swapFinalAmount?: number;
|
|
170
|
-
swapFinished?: boolean;
|
|
171
|
-
swapStarted?: boolean;
|
|
172
|
-
taxReceiptId?: string;
|
|
173
|
-
tcaAssociation?: string;
|
|
174
|
-
transactionDate: ISODate;
|
|
175
|
-
ustFinal?: number;
|
|
176
|
-
} & PartialV2Kyc & Partial<Omit<V2NonKeyAttributes, "chainId" | "donationFinalChainId" | "transactionDate">>;
|
|
177
|
-
type DBRecord = PrimaryKey & AppUsed_IndexKey & Checked_8283_IndexKey & EmailIndexKey & EndowmentId_IndexKey & FiatRamp_IndexKey & FundDeposits_IndexKey & Network_FinalizedDate_IndexKey & Tax_Receipt_Sent_IndexKey & WalletAddress_Index & NonKeyAttributes;
|
|
178
|
-
type WithoutKYC = {
|
|
179
|
-
kycEmail?: never;
|
|
180
|
-
};
|
|
181
|
-
type WithKYC = V2Kyc;
|
|
182
|
-
/** only use this definition on writes: for reads, it's safer to use DBRecord */
|
|
183
|
-
type V2DBRecord = PrimaryKey & EmailIndexKey & FiatRamp_IndexKey &
|
|
184
|
-
/** be sure to include in crypto donation */
|
|
185
|
-
WalletAddress_Index & Referrer_FinalizedDate_IndexKey & Required<EndowmentId_IndexKey> & Required<AppUsed_IndexKey> & (WithKYC | WithoutKYC) & V2NonKeyAttributes;
|
|
186
|
-
/** only use this definition on writes: for reads, it's safer to use DBRecord */
|
|
187
|
-
type V2InitCryptoDBRecord = PrimaryKey & EmailIndexKey &
|
|
188
|
-
/** be sure to include in crypto donation */
|
|
189
|
-
WalletAddress_Index & Required<EndowmentId_IndexKey> & Required<AppUsed_IndexKey> & (WithKYC | WithoutKYC);
|
|
190
|
-
type TributeNotif = {
|
|
191
|
-
toFullName: string;
|
|
192
|
-
toEmail: string;
|
|
193
|
-
/** may be empty `""` */
|
|
194
|
-
fromMsg: string;
|
|
195
|
-
};
|
|
196
|
-
/** web-app determinant: show signup page or not*/
|
|
197
|
-
type GuestDonor = {
|
|
198
|
-
email: string;
|
|
199
|
-
fullName: string;
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
export declare namespace OnHoldDonation {
|
|
203
|
-
type PrimaryKey = {
|
|
204
|
-
transactionId: string;
|
|
205
|
-
};
|
|
206
|
-
type Index = "Email_Index" | "EndowmentId_Index" | "fiatRamp_Index";
|
|
207
|
-
type ApesAttributes = {
|
|
208
|
-
client: Extract<Donation.Client, "apes">;
|
|
209
|
-
apesComplianceReviewStatus: Donation.ApesComplianceReviewStatus;
|
|
210
|
-
apesComplianceTimeWindow: ISODate;
|
|
211
|
-
};
|
|
212
|
-
type CryptoAttributes = {
|
|
213
|
-
chainId: ChainID.V2CryptoChainID;
|
|
214
|
-
destinationChainId: Exclude<ChainID.V2DestinationChainID, "fiat">;
|
|
215
|
-
walletAddress: string;
|
|
216
|
-
/** status of this record should NOT be changed by our pipelines */
|
|
217
|
-
third_party?: true;
|
|
218
|
-
/** Nowpayments: number, custom: uuid */
|
|
219
|
-
payment_id?: number | string;
|
|
220
|
-
};
|
|
221
|
-
type FiatAttributes = {
|
|
222
|
-
chainId: ChainID.V2FiatChainID;
|
|
223
|
-
destinationChainId: Extract<ChainID.V2DestinationChainID, "fiat">;
|
|
224
|
-
/** we can only know the method once it's confirmed by webhook */
|
|
225
|
-
paymentMethod?: string;
|
|
226
|
-
/** only exists if donor opts for manual bank verification */
|
|
227
|
-
stripeDepositVerifyUrl?: string;
|
|
228
|
-
};
|
|
229
|
-
type NonKeyAttributes = {
|
|
230
|
-
/** tip, fee-allowance is included*/
|
|
231
|
-
amount: number;
|
|
232
|
-
/** tip, fee-allowance is included*/
|
|
233
|
-
usdValue: number;
|
|
234
|
-
/** same denomination as amount */
|
|
235
|
-
tipAmount?: number;
|
|
236
|
-
/** same denomination as amount */
|
|
237
|
-
feeAllowance?: number;
|
|
238
|
-
appUsed: Donation.App;
|
|
239
|
-
chainName: string;
|
|
240
|
-
/** fund name or npo name, as onhold records not yet distributed */
|
|
241
|
-
charityName: string;
|
|
242
|
-
nonProfitMsg?: string;
|
|
243
|
-
/** upper case */
|
|
244
|
-
denomination: string;
|
|
245
|
-
donationFinalized: boolean;
|
|
246
|
-
endowmentId: number;
|
|
247
|
-
/** donation to fund */
|
|
248
|
-
fund_id?: string;
|
|
249
|
-
/** donation to fund */
|
|
250
|
-
fund_name?: string;
|
|
251
|
-
/** endowment ids */
|
|
252
|
-
fund_members?: number[];
|
|
253
|
-
/** program donation: may be empty `""`*/
|
|
254
|
-
programId?: string;
|
|
255
|
-
programName?: string;
|
|
256
|
-
claimed: boolean;
|
|
257
|
-
fiscalSponsored: boolean;
|
|
258
|
-
hideBgTip?: boolean;
|
|
259
|
-
network: Environment;
|
|
260
|
-
/** "0" - "100" */
|
|
261
|
-
splitLiq: string;
|
|
262
|
-
status?: "intent" | "pending";
|
|
263
|
-
transactionDate: ISODate;
|
|
264
|
-
/** TTL attribute */
|
|
265
|
-
expireAt?: number;
|
|
266
|
-
/** for new records only: `true` is recurring */
|
|
267
|
-
isRecurring?: boolean;
|
|
268
|
-
/** honorary full name - may be empty `''` */
|
|
269
|
-
inHonorOf?: string;
|
|
270
|
-
/** only allowed if honoree is provided */
|
|
271
|
-
tributeNotif?: Donation.TributeNotif;
|
|
272
|
-
donor_message?: string;
|
|
273
|
-
msg_to_npo?: string;
|
|
274
|
-
donor_public?: boolean;
|
|
275
|
-
company_name?: string;
|
|
276
|
-
allocation?: Allocation;
|
|
277
|
-
} & (ApesAttributes | EmptyObject) & (Donation.WithKYC | Donation.WithoutKYC);
|
|
278
|
-
type CryptoDBRecord = PrimaryKey & NonKeyAttributes & CryptoAttributes & Donation.EmailIndexKey;
|
|
279
|
-
type FiatDBRecord = PrimaryKey & Required<Donation.FiatRamp_IndexKey> & NonKeyAttributes & FiatAttributes & Required<Donation.EmailIndexKey>;
|
|
280
|
-
type DBRecord = CryptoDBRecord | FiatDBRecord;
|
|
281
|
-
/** Only used when donation is finalized and ready for transfer to Donations DB */
|
|
282
|
-
}
|
|
283
|
-
export declare namespace FiatDonations {
|
|
284
|
-
type Currency = {
|
|
285
|
-
/** lowercase ISO 4217 code */
|
|
286
|
-
currency_code: string;
|
|
287
|
-
minimum_amount: number;
|
|
288
|
-
rate: number;
|
|
289
|
-
timestamp: string;
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
export declare namespace PayPalDonation {
|
|
293
|
-
type CreateOrder = {
|
|
294
|
-
purchase_units: PurchaseUnit[];
|
|
295
|
-
intent: Intent;
|
|
296
|
-
payment_source?: PaymentSource;
|
|
297
|
-
};
|
|
298
|
-
type Order = {
|
|
299
|
-
id: string;
|
|
300
|
-
status: Status;
|
|
301
|
-
intent: Intent;
|
|
302
|
-
payment_source: PaymentSource;
|
|
303
|
-
purchase_units: PurchaseUnit[];
|
|
304
|
-
payer: Payer;
|
|
305
|
-
create_time: Date;
|
|
306
|
-
links: Link[];
|
|
307
|
-
};
|
|
308
|
-
type Link = {
|
|
309
|
-
href: string;
|
|
310
|
-
rel: string;
|
|
311
|
-
method: string;
|
|
312
|
-
};
|
|
313
|
-
type Payer = {
|
|
314
|
-
name: Name;
|
|
315
|
-
email_address: string;
|
|
316
|
-
payer_id: string;
|
|
317
|
-
};
|
|
318
|
-
type PaymentSource = {
|
|
319
|
-
paypal: {
|
|
320
|
-
name: Name;
|
|
321
|
-
email_address: string;
|
|
322
|
-
account_id: string;
|
|
323
|
-
};
|
|
324
|
-
};
|
|
325
|
-
type Name = {
|
|
326
|
-
given_name: string;
|
|
327
|
-
surname: string;
|
|
328
|
-
};
|
|
329
|
-
type PurchaseUnit = {
|
|
330
|
-
amount: {
|
|
331
|
-
/** Three-character ISO-4217 code. */
|
|
332
|
-
currency_code: string;
|
|
333
|
-
value: string;
|
|
334
|
-
};
|
|
335
|
-
/** @link https://developer.paypal.com/docs/api/orders/v2/#orders_get */
|
|
336
|
-
payments?: {
|
|
337
|
-
captures: CapturedPayment[];
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
type CapturedPayment = {
|
|
341
|
-
seller_receivable_breakdown: {
|
|
342
|
-
gross_amount: {
|
|
343
|
-
value: number;
|
|
344
|
-
};
|
|
345
|
-
paypal_fee: {
|
|
346
|
-
value: number;
|
|
347
|
-
};
|
|
348
|
-
net_amount: {
|
|
349
|
-
value: number;
|
|
350
|
-
};
|
|
351
|
-
};
|
|
352
|
-
};
|
|
353
|
-
type Intent = "CAPTURE" | "AUTHORIZE";
|
|
354
|
-
type Status = "CREATED" | "SAVED" | "APPROVED" | "VOIDED" | "COMPLETED" | "PAYER_ACTION_REQUIRED";
|
|
355
|
-
}
|
package/dist/donation.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Donation } from "./donation.mjs";
|
|
2
|
-
type FinalRecord = Pick<Donation.V2DBRecord, "amount" | "appUsed" | "chainName" | "charityName" | "claimed" | "denomination" | "email" | "endowmentId" | "feeAllowance" | "fiatRamp" | "fiscalSponsored" | "inHonorOf" | "isRecurring" | "network" | "nonProfitMsg" | "paymentMethod" | "programId" | "programName" | "splitLiq" | "tipAmount" | "transactionDate" | "transactionId" | "tributeNotif" | "usdValue">;
|
|
3
|
-
interface SettledAmounts {
|
|
4
|
-
settledFee: number;
|
|
5
|
-
settledNet: number;
|
|
6
|
-
}
|
|
7
|
-
/** donation is to fund */
|
|
8
|
-
interface Fund {
|
|
9
|
-
fund_id?: string;
|
|
10
|
-
fund_name?: string;
|
|
11
|
-
fund_members?: number[];
|
|
12
|
-
}
|
|
13
|
-
export type FinalRecorderPayload = {
|
|
14
|
-
/** intent to delete */
|
|
15
|
-
intentId?: string;
|
|
16
|
-
hideBgTip: boolean;
|
|
17
|
-
} & FinalRecord & SettledAmounts & Fund & (Donation.WithKYC | Donation.WithoutKYC);
|
|
18
|
-
export {};
|
package/dist/final-recorder.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param amount endow amount + tip
|
|
3
|
-
* @param rate 0-1, to be applied to amount @example `amount * rate`
|
|
4
|
-
* @param flat flat amount added to `amount * rate`. NOTE: make sure that this is in the same unit as `amount`
|
|
5
|
-
* @returns number
|
|
6
|
-
*/
|
|
7
|
-
export declare const getMinFeeAllowance: (amount: number, rate: number, flat?: number) => number;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param amount endow amount + tip
|
|
3
|
-
* @param rate 0-1, to be applied to amount @example `amount * rate`
|
|
4
|
-
* @param flat flat amount added to `amount * rate`. NOTE: make sure that this is in the same unit as `amount`
|
|
5
|
-
* @returns number
|
|
6
|
-
*/
|
|
7
|
-
export const getMinFeeAllowance = (amount, rate, flat = 0) => {
|
|
8
|
-
/**
|
|
9
|
-
* fee(1) = amount * rate + flat
|
|
10
|
-
* fee(2) = (amount + fee(1)) * rate + flat
|
|
11
|
-
* fee(3) = (amount + fee(2)) * rate + flat
|
|
12
|
-
* i.e. F₍ₙ₎ = a · ∑ᵏ⁼¹ⁿ (rᵏ) + f · ∑ᵏ⁼⁰ⁿ⁻¹ (rᵏ)
|
|
13
|
-
* which converges to this formula: n approaches infinity
|
|
14
|
-
*/
|
|
15
|
-
return (amount * rate + flat) / (1 - rate);
|
|
16
|
-
};
|
package/dist/intent.d.mts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
export declare const frequencies: readonly ["one-time", "recurring"];
|
|
3
|
-
export declare const frequency: v.PicklistSchema<readonly ["one-time", "recurring"], undefined>;
|
|
4
|
-
export type Frequency = v.InferOutput<typeof frequency>;
|
|
5
|
-
export declare const donationSources: readonly ["bg-marketplace", "bg-widget", "tester-app"];
|
|
6
|
-
export declare const donationSource: v.PicklistSchema<readonly ["bg-marketplace", "bg-widget", "tester-app"], undefined>;
|
|
7
|
-
export type DonationSource = v.InferOutput<typeof donationSource>;
|
|
8
|
-
export declare const donorTitles: readonly ["Mr", "Mrs", "Ms", "Mx", ""];
|
|
9
|
-
export declare const donorTitle: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
|
|
10
|
-
export type DonorTitle = v.InferOutput<typeof donorTitle>;
|
|
11
|
-
export declare const donorAddress: v.ObjectSchema<{
|
|
12
|
-
readonly street: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
13
|
-
readonly city: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
14
|
-
readonly state: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
15
|
-
readonly zipCode: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
16
|
-
/** country name */
|
|
17
|
-
readonly country: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
18
|
-
readonly ukGiftAid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
19
|
-
}, undefined>;
|
|
20
|
-
export type DonorAddress = v.InferOutput<typeof donorAddress>;
|
|
21
|
-
export declare const donor: v.ObjectSchema<{
|
|
22
|
-
readonly title: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
|
|
23
|
-
readonly firstName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
24
|
-
readonly lastName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
25
|
-
readonly email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
26
|
-
readonly address: v.OptionalSchema<v.ObjectSchema<{
|
|
27
|
-
readonly street: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
28
|
-
readonly city: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
29
|
-
readonly state: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
30
|
-
readonly zipCode: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
31
|
-
/** country name */
|
|
32
|
-
readonly country: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
33
|
-
readonly ukGiftAid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
34
|
-
}, undefined>, never>;
|
|
35
|
-
}, undefined>;
|
|
36
|
-
export type Donor = v.InferOutput<typeof donor>;
|
|
37
|
-
export declare const amount: v.ObjectSchema<{
|
|
38
|
-
readonly amount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
39
|
-
readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
40
|
-
readonly tip: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
41
|
-
readonly feeAllowance: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
42
|
-
}, undefined>;
|
|
43
|
-
export type Amount = v.InferOutput<typeof amount>;
|
|
44
|
-
export declare const endowId: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
45
|
-
export declare const uuid: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>;
|
|
46
|
-
export declare const program: v.ObjectSchema<{
|
|
47
|
-
readonly id: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>;
|
|
48
|
-
readonly name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
49
|
-
}, undefined>;
|
|
50
|
-
export type Program = v.InferOutput<typeof program>;
|
|
51
|
-
export declare const recipient: v.UnionSchema<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>], undefined>;
|
|
52
|
-
export type Recipient = v.InferOutput<typeof recipient>;
|
|
53
|
-
export declare const tributeNotif: v.ObjectSchema<{
|
|
54
|
-
readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
55
|
-
readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
56
|
-
readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
|
|
57
|
-
}, undefined>;
|
|
58
|
-
export type TributeNotif = v.InferOutput<typeof tributeNotif>;
|
|
59
|
-
export declare const tribute: v.ObjectSchema<{
|
|
60
|
-
readonly fullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
61
|
-
readonly notif: v.OptionalSchema<v.ObjectSchema<{
|
|
62
|
-
readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
63
|
-
readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
64
|
-
readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
|
|
65
|
-
}, undefined>, never>;
|
|
66
|
-
}, undefined>;
|
|
67
|
-
export type Tribute = v.InferOutput<typeof tribute>;
|
|
68
|
-
export declare const intent: v.ObjectSchema<{
|
|
69
|
-
readonly amount: v.ObjectSchema<{
|
|
70
|
-
readonly amount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
71
|
-
readonly currency: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
72
|
-
readonly tip: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
73
|
-
readonly feeAllowance: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
74
|
-
}, undefined>;
|
|
75
|
-
readonly recipient: v.UnionSchema<[v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>], undefined>;
|
|
76
|
-
readonly program: v.OptionalSchema<v.ObjectSchema<{
|
|
77
|
-
readonly id: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>;
|
|
78
|
-
readonly name: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
79
|
-
}, undefined>, never>;
|
|
80
|
-
readonly donor: v.ObjectSchema<{
|
|
81
|
-
readonly title: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
|
|
82
|
-
readonly firstName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
83
|
-
readonly lastName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
84
|
-
readonly email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
85
|
-
readonly address: v.OptionalSchema<v.ObjectSchema<{
|
|
86
|
-
readonly street: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
87
|
-
readonly city: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
88
|
-
readonly state: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
89
|
-
readonly zipCode: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>, never>;
|
|
90
|
-
/** country name */
|
|
91
|
-
readonly country: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
92
|
-
readonly ukGiftAid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
93
|
-
}, undefined>, never>;
|
|
94
|
-
}, undefined>;
|
|
95
|
-
readonly source: v.PicklistSchema<readonly ["bg-marketplace", "bg-widget", "tester-app"], undefined>;
|
|
96
|
-
readonly tribute: v.OptionalSchema<v.ObjectSchema<{
|
|
97
|
-
readonly fullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
98
|
-
readonly notif: v.OptionalSchema<v.ObjectSchema<{
|
|
99
|
-
readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
100
|
-
readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
101
|
-
readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
|
|
102
|
-
}, undefined>, never>;
|
|
103
|
-
}, undefined>, never>;
|
|
104
|
-
readonly frequency: v.PicklistSchema<readonly ["one-time", "recurring"], undefined>;
|
|
105
|
-
/** chain name, etc. */
|
|
106
|
-
readonly viaName: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
|
|
107
|
-
/** chain id, workflow-session-id, etc. */
|
|
108
|
-
readonly viaId: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
|
|
109
|
-
}, undefined>;
|
|
110
|
-
export type DonationIntent = v.InferOutput<typeof intent>;
|
package/dist/intent.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
const str = v.pipe(v.string(), v.trim());
|
|
3
|
-
const requiredStr = v.pipe(str, v.nonEmpty());
|
|
4
|
-
export const frequencies = ["one-time", "recurring"];
|
|
5
|
-
export const frequency = v.picklist(frequencies);
|
|
6
|
-
export const donationSources = [
|
|
7
|
-
"bg-marketplace",
|
|
8
|
-
"bg-widget",
|
|
9
|
-
"tester-app",
|
|
10
|
-
];
|
|
11
|
-
export const donationSource = v.picklist(donationSources);
|
|
12
|
-
export const donorTitles = ["Mr", "Mrs", "Ms", "Mx", ""];
|
|
13
|
-
export const donorTitle = v.picklist(donorTitles);
|
|
14
|
-
export const donorAddress = v.object({
|
|
15
|
-
street: requiredStr,
|
|
16
|
-
city: requiredStr,
|
|
17
|
-
state: v.optional(requiredStr),
|
|
18
|
-
zipCode: v.optional(requiredStr),
|
|
19
|
-
/** country name */
|
|
20
|
-
country: requiredStr,
|
|
21
|
-
ukGiftAid: v.optional(v.boolean()),
|
|
22
|
-
});
|
|
23
|
-
export const donor = v.object({
|
|
24
|
-
title: donorTitle,
|
|
25
|
-
firstName: requiredStr,
|
|
26
|
-
lastName: requiredStr,
|
|
27
|
-
email: v.pipe(str, v.email()),
|
|
28
|
-
address: v.optional(donorAddress),
|
|
29
|
-
});
|
|
30
|
-
const money = v.pipe(v.number(), v.minValue(0));
|
|
31
|
-
export const amount = v.object({
|
|
32
|
-
amount: money,
|
|
33
|
-
currency: requiredStr,
|
|
34
|
-
tip: money,
|
|
35
|
-
feeAllowance: money,
|
|
36
|
-
});
|
|
37
|
-
export const endowId = v.pipe(str, v.transform((x) => +x), v.number(), v.integer(), v.minValue(1));
|
|
38
|
-
export const uuid = v.pipe(str, v.uuid());
|
|
39
|
-
export const program = v.object({
|
|
40
|
-
id: uuid,
|
|
41
|
-
name: requiredStr,
|
|
42
|
-
});
|
|
43
|
-
export const recipient = v.union([endowId, uuid]);
|
|
44
|
-
export const tributeNotif = v.object({
|
|
45
|
-
toEmail: v.pipe(str, v.email()),
|
|
46
|
-
toFullName: v.pipe(str, v.nonEmpty()),
|
|
47
|
-
fromMsg: v.pipe(str, v.maxLength(250)),
|
|
48
|
-
});
|
|
49
|
-
export const tribute = v.object({
|
|
50
|
-
fullName: requiredStr,
|
|
51
|
-
notif: v.optional(tributeNotif),
|
|
52
|
-
});
|
|
53
|
-
export const intent = v.object({
|
|
54
|
-
amount,
|
|
55
|
-
recipient,
|
|
56
|
-
program: v.optional(program),
|
|
57
|
-
donor,
|
|
58
|
-
source: donationSource,
|
|
59
|
-
tribute: v.optional(tribute),
|
|
60
|
-
frequency,
|
|
61
|
-
/** chain name, etc. */
|
|
62
|
-
viaName: str,
|
|
63
|
-
/** chain id, workflow-session-id, etc. */
|
|
64
|
-
viaId: str,
|
|
65
|
-
});
|
package/dist/old-intent.d.mts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
import { type Frequency } from "./intent.mjs";
|
|
3
|
-
export declare const oldIntent: v.SchemaWithPipe<[v.ObjectSchema<{
|
|
4
|
-
readonly transactionId: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
5
|
-
readonly type: v.OptionalSchema<v.PicklistSchema<["one-time", "subscription"], undefined>, never>;
|
|
6
|
-
readonly amount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
7
|
-
readonly tipAmount: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
8
|
-
readonly feeAllowance: v.SchemaWithPipe<[v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9
|
-
readonly currency: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
10
|
-
readonly endowmentId: v.SchemaWithPipe<[v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, v.MinValueAction<number, 1, undefined>]>;
|
|
11
|
-
readonly programId: v.OptionalSchema<v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.UuidAction<string, undefined>]>, never>;
|
|
12
|
-
readonly programName: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
13
|
-
readonly splitLiq: v.SchemaWithPipe<[v.SchemaWithPipe<[v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 100, undefined>]>;
|
|
14
|
-
readonly donor: v.ObjectSchema<{
|
|
15
|
-
readonly title: v.PicklistSchema<readonly ["Mr", "Mrs", "Ms", "Mx", ""], undefined>;
|
|
16
|
-
readonly firstName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
17
|
-
readonly lastName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
18
|
-
readonly email: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
19
|
-
readonly address: v.OptionalSchema<v.ObjectSchema<{
|
|
20
|
-
readonly streetAddress: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
21
|
-
readonly city: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
|
|
22
|
-
readonly state: v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>;
|
|
23
|
-
readonly zipCode: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
24
|
-
/** country name */
|
|
25
|
-
readonly country: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
26
|
-
}, undefined>, never>;
|
|
27
|
-
readonly ukGiftAid: v.OptionalSchema<v.BooleanSchema<undefined>, never>;
|
|
28
|
-
}, undefined>;
|
|
29
|
-
readonly inHonorOf: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
30
|
-
readonly tributeNotif: v.OptionalSchema<v.ObjectSchema<{
|
|
31
|
-
readonly toEmail: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.EmailAction<string, undefined>]>;
|
|
32
|
-
readonly toFullName: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.NonEmptyAction<string, undefined>]>;
|
|
33
|
-
readonly fromMsg: v.SchemaWithPipe<[v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, v.MaxLengthAction<string, 250, undefined>]>;
|
|
34
|
-
}, undefined>, never>;
|
|
35
|
-
readonly source: v.PicklistSchema<readonly ["bg-marketplace", "bg-widget", "tester-app"], undefined>;
|
|
36
|
-
readonly denomination: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
37
|
-
readonly chainId: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
38
|
-
readonly chainName: v.OptionalSchema<v.SchemaWithPipe<[v.StringSchema<undefined>, v.TrimAction]>, never>;
|
|
39
|
-
}, undefined>, v.TransformAction<{
|
|
40
|
-
amount: number;
|
|
41
|
-
feeAllowance: number;
|
|
42
|
-
tipAmount: number;
|
|
43
|
-
splitLiq: number;
|
|
44
|
-
endowmentId: number;
|
|
45
|
-
donor: {
|
|
46
|
-
email: string;
|
|
47
|
-
title: "" | "Mr" | "Ms" | "Mrs" | "Mx";
|
|
48
|
-
firstName: string;
|
|
49
|
-
lastName: string;
|
|
50
|
-
ukGiftAid?: boolean | undefined;
|
|
51
|
-
address?: {
|
|
52
|
-
streetAddress: string;
|
|
53
|
-
city: string;
|
|
54
|
-
state: string;
|
|
55
|
-
zipCode: string;
|
|
56
|
-
country: string;
|
|
57
|
-
} | undefined;
|
|
58
|
-
};
|
|
59
|
-
source: "bg-marketplace" | "bg-widget" | "tester-app";
|
|
60
|
-
chainId?: string | undefined;
|
|
61
|
-
programId?: string | undefined;
|
|
62
|
-
programName?: string | undefined;
|
|
63
|
-
inHonorOf?: string | undefined;
|
|
64
|
-
tributeNotif?: {
|
|
65
|
-
toEmail: string;
|
|
66
|
-
toFullName: string;
|
|
67
|
-
fromMsg: string;
|
|
68
|
-
} | undefined;
|
|
69
|
-
denomination?: string | undefined;
|
|
70
|
-
chainName?: string | undefined;
|
|
71
|
-
transactionId?: string | undefined;
|
|
72
|
-
type?: "one-time" | "subscription" | undefined;
|
|
73
|
-
currency?: string | undefined;
|
|
74
|
-
}, {
|
|
75
|
-
amount: {
|
|
76
|
-
amount: number;
|
|
77
|
-
currency: string;
|
|
78
|
-
tip: number;
|
|
79
|
-
feeAllowance: number;
|
|
80
|
-
};
|
|
81
|
-
recipient: number;
|
|
82
|
-
program: {
|
|
83
|
-
id: string;
|
|
84
|
-
name: string;
|
|
85
|
-
} | undefined;
|
|
86
|
-
donor: {
|
|
87
|
-
title: "" | "Mr" | "Ms" | "Mrs" | "Mx";
|
|
88
|
-
firstName: string;
|
|
89
|
-
lastName: string;
|
|
90
|
-
email: string;
|
|
91
|
-
address: {
|
|
92
|
-
street: string;
|
|
93
|
-
city: string;
|
|
94
|
-
state: string;
|
|
95
|
-
zipCode: string;
|
|
96
|
-
country: string;
|
|
97
|
-
ukGiftAid: boolean | undefined;
|
|
98
|
-
} | undefined;
|
|
99
|
-
};
|
|
100
|
-
source: "bg-marketplace" | "bg-widget" | "tester-app";
|
|
101
|
-
tribute: {
|
|
102
|
-
fullName: string;
|
|
103
|
-
notif: {
|
|
104
|
-
toEmail: string;
|
|
105
|
-
toFullName: string;
|
|
106
|
-
fromMsg: string;
|
|
107
|
-
} | undefined;
|
|
108
|
-
} | undefined;
|
|
109
|
-
frequency: Frequency;
|
|
110
|
-
viaName: string;
|
|
111
|
-
viaId: string;
|
|
112
|
-
}>]>;
|
package/dist/old-intent.mjs
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
import { donationSource, donorTitle, tributeNotif, uuid, } from "./intent.mjs";
|
|
3
|
-
const str = v.pipe(v.string(), v.trim());
|
|
4
|
-
const requiredStr = v.pipe(str, v.nonEmpty());
|
|
5
|
-
const int = v.pipe(v.number(), v.integer());
|
|
6
|
-
const money = v.pipe(v.number(), v.minValue(0));
|
|
7
|
-
const donorAddress = v.object({
|
|
8
|
-
streetAddress: requiredStr,
|
|
9
|
-
city: str,
|
|
10
|
-
state: str,
|
|
11
|
-
zipCode: requiredStr,
|
|
12
|
-
/** country name */
|
|
13
|
-
country: requiredStr,
|
|
14
|
-
});
|
|
15
|
-
const donor = v.object({
|
|
16
|
-
title: donorTitle,
|
|
17
|
-
firstName: requiredStr,
|
|
18
|
-
lastName: requiredStr,
|
|
19
|
-
email: v.pipe(str, v.email()),
|
|
20
|
-
address: v.optional(donorAddress),
|
|
21
|
-
ukGiftAid: v.optional(v.boolean()),
|
|
22
|
-
});
|
|
23
|
-
export const oldIntent = v.pipe(v.object({
|
|
24
|
-
transactionId: v.optional(str),
|
|
25
|
-
type: v.optional(v.picklist(["one-time", "subscription"])),
|
|
26
|
-
amount: money,
|
|
27
|
-
tipAmount: money,
|
|
28
|
-
feeAllowance: money,
|
|
29
|
-
currency: v.optional(str),
|
|
30
|
-
endowmentId: v.pipe(int, v.minValue(1)),
|
|
31
|
-
programId: v.optional(uuid),
|
|
32
|
-
programName: v.optional(str),
|
|
33
|
-
splitLiq: v.pipe(int, v.minValue(0), v.maxValue(100)),
|
|
34
|
-
donor,
|
|
35
|
-
inHonorOf: v.optional(str),
|
|
36
|
-
tributeNotif: v.optional(tributeNotif),
|
|
37
|
-
source: donationSource,
|
|
38
|
-
denomination: v.optional(str),
|
|
39
|
-
chainId: v.optional(str),
|
|
40
|
-
chainName: v.optional(str),
|
|
41
|
-
}), v.transform((input) => ({
|
|
42
|
-
amount: {
|
|
43
|
-
amount: input.amount,
|
|
44
|
-
currency: input.currency ? input.currency : input.denomination ?? "",
|
|
45
|
-
tip: input.tipAmount,
|
|
46
|
-
feeAllowance: input.feeAllowance,
|
|
47
|
-
},
|
|
48
|
-
recipient: input.endowmentId,
|
|
49
|
-
program: input.programId && input.programName
|
|
50
|
-
? {
|
|
51
|
-
id: input.programId,
|
|
52
|
-
name: input.programName,
|
|
53
|
-
}
|
|
54
|
-
: undefined,
|
|
55
|
-
donor: {
|
|
56
|
-
title: input.donor.title,
|
|
57
|
-
firstName: input.donor.firstName,
|
|
58
|
-
lastName: input.donor.lastName,
|
|
59
|
-
email: input.donor.email,
|
|
60
|
-
address: input.donor.address
|
|
61
|
-
? {
|
|
62
|
-
street: input.donor.address.streetAddress,
|
|
63
|
-
city: input.donor.address.city,
|
|
64
|
-
state: input.donor.address.state,
|
|
65
|
-
zipCode: input.donor.address.zipCode,
|
|
66
|
-
country: input.donor.address.country,
|
|
67
|
-
ukGiftAid: input.donor.ukGiftAid,
|
|
68
|
-
}
|
|
69
|
-
: undefined,
|
|
70
|
-
},
|
|
71
|
-
source: input.source,
|
|
72
|
-
tribute: input.inHonorOf
|
|
73
|
-
? {
|
|
74
|
-
fullName: input.inHonorOf,
|
|
75
|
-
notif: input.tributeNotif
|
|
76
|
-
? {
|
|
77
|
-
toEmail: input.tributeNotif.toEmail,
|
|
78
|
-
toFullName: input.tributeNotif.toFullName,
|
|
79
|
-
fromMsg: input.tributeNotif.fromMsg,
|
|
80
|
-
}
|
|
81
|
-
: undefined,
|
|
82
|
-
}
|
|
83
|
-
: undefined,
|
|
84
|
-
frequency: (input.type === "subscription"
|
|
85
|
-
? "recurring"
|
|
86
|
-
: input.type ?? "one-time"),
|
|
87
|
-
viaName: input.chainName ?? "fiat",
|
|
88
|
-
viaId: input.chainId ? input.chainId : input.transactionId ?? "fiat",
|
|
89
|
-
})));
|
package/dist/subscription.d.mts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Environment } from "@better-giving/types/list";
|
|
2
|
-
import type { Donation } from "./donation.mjs";
|
|
3
|
-
export declare namespace Subscription {
|
|
4
|
-
interface PrimaryKey {
|
|
5
|
-
subscription_id: string;
|
|
6
|
-
}
|
|
7
|
-
interface NonKeyAttributes {
|
|
8
|
-
app_used: Donation.App;
|
|
9
|
-
charity_name: string;
|
|
10
|
-
customer_id: string;
|
|
11
|
-
email: string;
|
|
12
|
-
endowment_id: number;
|
|
13
|
-
fiat_ramp: "STRIPE";
|
|
14
|
-
fiscal_sponsored: boolean;
|
|
15
|
-
hide_bg_tip: boolean;
|
|
16
|
-
/** URL link to latest invoice */
|
|
17
|
-
latest_invoice?: string;
|
|
18
|
-
network: Environment;
|
|
19
|
-
product_id: string;
|
|
20
|
-
/**
|
|
21
|
-
* Determines overall price the user has to pay
|
|
22
|
-
* For example, we have a recurring subscription plan of $1 per month.
|
|
23
|
-
* If quantity is set to 2 then the user pays $2 per month
|
|
24
|
-
*/
|
|
25
|
-
quantity: number;
|
|
26
|
-
split_liq: string;
|
|
27
|
-
/** @link https://docs.stripe.com/billing/subscriptions/overview#payment-status */
|
|
28
|
-
status: "active" | "incomplete";
|
|
29
|
-
}
|
|
30
|
-
interface DBRecord extends PrimaryKey, NonKeyAttributes {
|
|
31
|
-
}
|
|
32
|
-
}
|
package/dist/subscription.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|