@better-giving/donation 3.0.29 → 3.0.31

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.
@@ -1,7 +1,7 @@
1
1
  import { type QueryCommandInput } from "@aws-sdk/lib-dynamodb";
2
2
  import { Db, type TxType } from "@better-giving/db";
3
3
  import type { IPageKeyed } from "@better-giving/types/api";
4
- import type { IDonationFinal, IDonationFinalAttr } from "./interfaces.mjs";
4
+ import type { IDonationFinal, IDonationFinalAttr, IDonationFinalUpdate } from "./interfaces.mjs";
5
5
  import type { IDonationsSearch, IPageOpts } from "./schema.mjs";
6
6
  export declare class DonationsDb extends Db {
7
7
  static readonly gsi_referrer$settled_date = "Referrer-FinalizedDate_Index";
@@ -13,8 +13,8 @@ export declare class DonationsDb extends Db {
13
13
  };
14
14
  item(id: string): Promise<IDonationFinal | undefined>;
15
15
  put_txi(data: IDonationFinalAttr): TxType["Put"];
16
- update(id: string, data: Partial<Omit<IDonationFinalAttr, "transactionId">>): Promise<IDonationFinal>;
17
- update_txi(id: string, data: Partial<Omit<IDonationFinalAttr, "transactionId">>): TxType["Update"];
16
+ update(id: string, data: IDonationFinalUpdate): Promise<IDonationFinal>;
17
+ update_txi(id: string, data: IDonationFinalUpdate): TxType["Update"];
18
18
  referred_by_q(referrer: string, opts?: IPageOpts): QueryCommandInput;
19
19
  referred_by(referrer: string, opts?: IPageOpts): Promise<IPageKeyed<IDonationFinal>>;
20
20
  list_to_npo(npo: number, opts?: IDonationsSearch & {
package/dist/index.d.mts CHANGED
@@ -1,7 +1,5 @@
1
1
  export type { IAllocation, TDonationSource, TDonorTitle, TFrequency, IDonationsSearch, IPageOpts, } from "./schema.mjs";
2
- export type * from "./paypal.mjs";
3
2
  export type * from "./interfaces.mjs";
4
3
  export { DonationsDb } from "./donations-db.mjs";
5
4
  export { OnHoldDonationsDb } from "./onhold-db.mjs";
6
- export { SubsDb } from "./subscriptions-db.mjs";
7
5
  export { DonationDonorsDb } from "./donation-msgs-db.mjs";
package/dist/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
1
  export { DonationsDb } from "./donations-db.mjs";
2
2
  export { OnHoldDonationsDb } from "./onhold-db.mjs";
3
- export { SubsDb } from "./subscriptions-db.mjs";
4
3
  export { DonationDonorsDb } from "./donation-msgs-db.mjs";
@@ -86,8 +86,6 @@ export interface IDonationOnHoldAttr {
86
86
  appUsed: TDonationSource;
87
87
  /** nanoid */
88
88
  form_id?: string;
89
- /** form tag at the time of settlement */
90
- form_tag?: string;
91
89
  /** "fiat", "trx", "hbar", "eth", "matic", "xrp-mainnet" */
92
90
  chainId: string;
93
91
  /** "Fiat", "TRON", "Hedera", "Ethereum", "", "Polygon", "Stripe", "XRP Ledger" */
@@ -101,6 +99,8 @@ export interface IDonationOnHoldAttr {
101
99
  inHonorOf?: string;
102
100
  tributeNotif?: ITributeNotif;
103
101
  }
102
+ export interface IDonationOnholdUpdate extends Partial<Omit<IDonationOnHoldAttr, "transactionId">> {
103
+ }
104
104
  export interface IDonationOnHold extends IDonationOnHoldAttr, IDonationOnHoldAttrLegacy {
105
105
  }
106
106
  export interface IDonationFinalAttrLegacy {
@@ -184,6 +184,8 @@ export interface IDonationFinalAttr {
184
184
  appUsed?: TDonationSource | (string & {});
185
185
  /** nanoid | `${number}` - bg form */
186
186
  form_id?: string;
187
+ /** form tag at the time of settlement */
188
+ form_tag?: string;
187
189
  /**
188
190
  "fiat", "columbus-5", "eth", "matic", "juno-1", "ltc", undefined, "btc", "phoenix-1", "56", "1", "137",
189
191
  "xrp-mainnet", "zec", "sol", "bch", "bsc", "cchain", "xvg", "xrp", "sei-1", "icx", "base",
@@ -266,6 +268,8 @@ export interface IDonationFinalAttr {
266
268
  referrer?: string;
267
269
  taxReceiptId?: string;
268
270
  }
271
+ export interface IDonationFinalUpdate extends Partial<Omit<IDonationFinalAttr, "transactionId">> {
272
+ }
269
273
  export interface IDonationFinal extends IDonationFinalAttr, IDonationFinalAttrLegacy {
270
274
  }
271
275
  export interface IPublicDonor {
@@ -1,6 +1,6 @@
1
1
  import { Db, type TxType } from "@better-giving/db";
2
2
  import type { IPageKeyed } from "@better-giving/types/api";
3
- import type { IDonationOnHold, IDonationOnHoldAttr } from "./interfaces.mjs";
3
+ import type { IDonationOnHold, IDonationOnHoldAttr, IDonationOnholdUpdate } from "./interfaces.mjs";
4
4
  import type { IDonationsSearch } from "./schema.mjs";
5
5
  export declare class OnHoldDonationsDb extends Db {
6
6
  static readonly gsi_email$tx_date = "email-tx_date-gsi";
@@ -9,8 +9,8 @@ export declare class OnHoldDonationsDb extends Db {
9
9
  transactionId: string;
10
10
  };
11
11
  put(data: IDonationOnHoldAttr): Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput>;
12
- update(id: string, data: Partial<Omit<IDonationOnHoldAttr, "transactionId">>): Promise<IDonationOnHold>;
13
- update_txi(id: string, data: Partial<Omit<IDonationOnHoldAttr, "transactionId">>): TxType["Update"];
12
+ update(id: string, data: IDonationOnholdUpdate): Promise<IDonationOnHold>;
13
+ update_txi(id: string, data: IDonationOnholdUpdate): TxType["Update"];
14
14
  item(id: string): Promise<IDonationOnHold | undefined>;
15
15
  put_txi(data: IDonationOnHoldAttr): Promise<import("@aws-sdk/lib-dynamodb").PutCommandOutput>;
16
16
  del_txi(id: string): TxType["Delete"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-giving/donation",
3
- "version": "3.0.29",
3
+ "version": "3.0.31",
4
4
  "devDependencies": {
5
5
  "@better-giving/config": "1.1.2"
6
6
  },
@@ -6,7 +6,11 @@ import {
6
6
  } from "@aws-sdk/lib-dynamodb";
7
7
  import { Db, type TxType, UpdateBuilder } from "@better-giving/db";
8
8
  import type { IPageKeyed } from "@better-giving/types/api";
9
- import type { IDonationFinal, IDonationFinalAttr } from "./interfaces.mjs";
9
+ import type {
10
+ IDonationFinal,
11
+ IDonationFinalAttr,
12
+ IDonationFinalUpdate,
13
+ } from "./interfaces.mjs";
10
14
  import type { IDonationsSearch, IPageOpts } from "./schema.mjs";
11
15
 
12
16
  type K = keyof IDonationFinalAttr;
@@ -45,7 +49,7 @@ export class DonationsDb extends Db {
45
49
 
46
50
  async update(
47
51
  id: string,
48
- data: Partial<Omit<IDonationFinalAttr, "transactionId">>
52
+ data: IDonationFinalUpdate
49
53
  ): Promise<IDonationFinal> {
50
54
  const upd8 = new UpdateBuilder();
51
55
  for (const k in data) {
@@ -59,10 +63,7 @@ export class DonationsDb extends Db {
59
63
  return this.client.send(cmd).then((r) => r.Attributes as any);
60
64
  }
61
65
 
62
- update_txi(
63
- id: string,
64
- data: Partial<Omit<IDonationFinalAttr, "transactionId">>
65
- ): TxType["Update"] {
66
+ update_txi(id: string, data: IDonationFinalUpdate): TxType["Update"] {
66
67
  const upd8 = new UpdateBuilder();
67
68
  for (const k in data) {
68
69
  upd8.set(k as K, (data as any)[k]);
package/src/index.mts CHANGED
@@ -7,10 +7,8 @@ export type {
7
7
  IPageOpts,
8
8
  } from "./schema.mjs";
9
9
 
10
- export type * from "./paypal.mjs";
11
10
  export type * from "./interfaces.mjs";
12
11
 
13
12
  export { DonationsDb } from "./donations-db.mjs";
14
13
  export { OnHoldDonationsDb } from "./onhold-db.mjs";
15
- export { SubsDb } from "./subscriptions-db.mjs";
16
14
  export { DonationDonorsDb } from "./donation-msgs-db.mjs";
@@ -99,8 +99,6 @@ export interface IDonationOnHoldAttr {
99
99
  appUsed: TDonationSource;
100
100
  /** nanoid */
101
101
  form_id?: string;
102
- /** form tag at the time of settlement */
103
- form_tag?: string;
104
102
  /** "fiat", "trx", "hbar", "eth", "matic", "xrp-mainnet" */
105
103
  chainId: string;
106
104
  /** "Fiat", "TRON", "Hedera", "Ethereum", "", "Polygon", "Stripe", "XRP Ledger" */
@@ -117,6 +115,9 @@ export interface IDonationOnHoldAttr {
117
115
  tributeNotif?: ITributeNotif;
118
116
  }
119
117
 
118
+ export interface IDonationOnholdUpdate
119
+ extends Partial<Omit<IDonationOnHoldAttr, "transactionId">> {}
120
+
120
121
  export interface IDonationOnHold
121
122
  extends IDonationOnHoldAttr,
122
123
  IDonationOnHoldAttrLegacy {}
@@ -205,6 +206,8 @@ export interface IDonationFinalAttr {
205
206
  appUsed?: TDonationSource | (string & {});
206
207
  /** nanoid | `${number}` - bg form */
207
208
  form_id?: string;
209
+ /** form tag at the time of settlement */
210
+ form_tag?: string;
208
211
  /**
209
212
  "fiat", "columbus-5", "eth", "matic", "juno-1", "ltc", undefined, "btc", "phoenix-1", "56", "1", "137",
210
213
  "xrp-mainnet", "zec", "sol", "bch", "bsc", "cchain", "xvg", "xrp", "sei-1", "icx", "base",
@@ -300,6 +303,9 @@ export interface IDonationFinalAttr {
300
303
  taxReceiptId?: string;
301
304
  }
302
305
 
306
+ export interface IDonationFinalUpdate
307
+ extends Partial<Omit<IDonationFinalAttr, "transactionId">> {}
308
+
303
309
  export interface IDonationFinal
304
310
  extends IDonationFinalAttr,
305
311
  IDonationFinalAttrLegacy {}
package/src/onhold-db.mts CHANGED
@@ -7,7 +7,11 @@ import {
7
7
  } from "@aws-sdk/lib-dynamodb";
8
8
  import { Db, type TxType, UpdateBuilder } from "@better-giving/db";
9
9
  import type { IPageKeyed } from "@better-giving/types/api";
10
- import type { IDonationOnHold, IDonationOnHoldAttr } from "./interfaces.mjs";
10
+ import type {
11
+ IDonationOnHold,
12
+ IDonationOnHoldAttr,
13
+ IDonationOnholdUpdate,
14
+ } from "./interfaces.mjs";
11
15
  import type { IDonationsSearch } from "./schema.mjs";
12
16
 
13
17
  type K = keyof IDonationOnHoldAttr;
@@ -39,7 +43,7 @@ export class OnHoldDonationsDb extends Db {
39
43
 
40
44
  async update(
41
45
  id: string,
42
- data: Partial<Omit<IDonationOnHoldAttr, "transactionId">>
46
+ data: IDonationOnholdUpdate
43
47
  ): Promise<IDonationOnHold> {
44
48
  const upd8 = new UpdateBuilder();
45
49
  for (const k in data) {
@@ -53,10 +57,7 @@ export class OnHoldDonationsDb extends Db {
53
57
  return this.client.send(cmd).then((r) => r.Attributes as any);
54
58
  }
55
59
 
56
- update_txi(
57
- id: string,
58
- data: Partial<Omit<IDonationOnHoldAttr, "transactionId">>
59
- ): TxType["Update"] {
60
+ update_txi(id: string, data: IDonationOnholdUpdate): TxType["Update"] {
60
61
  const upd8 = new UpdateBuilder();
61
62
  for (const k in data) {
62
63
  upd8.set(k as K, (data as any)[k]);
package/src/paypal.mts DELETED
@@ -1,85 +0,0 @@
1
- export declare namespace FiatDonations {
2
- type Currency = {
3
- /** lowercase ISO 4217 code */
4
- currency_code: string;
5
- minimum_amount: number;
6
- rate: number;
7
- timestamp: string;
8
- };
9
- }
10
-
11
- export declare namespace PayPalDonation {
12
- type CreateOrder = {
13
- purchase_units: PurchaseUnit[];
14
- intent: Intent;
15
- payment_source?: PaymentSource;
16
- };
17
-
18
- // see Response object description in official docs
19
- // https://developer.paypal.com/docs/api/orders/v2/#orders_create
20
- type Order = {
21
- id: string;
22
- status: Status;
23
- intent: Intent;
24
- payment_source: PaymentSource;
25
- purchase_units: PurchaseUnit[];
26
- payer: Payer;
27
- create_time: Date;
28
- links: Link[];
29
- };
30
-
31
- type Link = {
32
- href: string;
33
- rel: string;
34
- method: string;
35
- };
36
-
37
- type Payer = {
38
- name: Name;
39
- email_address: string;
40
- payer_id: string;
41
- };
42
-
43
- type PaymentSource = {
44
- paypal: {
45
- name: Name;
46
- email_address: string;
47
- account_id: string;
48
- };
49
- };
50
-
51
- type Name = {
52
- given_name: string;
53
- surname: string;
54
- };
55
-
56
- type PurchaseUnit = {
57
- // don't need 'reference_id'
58
- amount: {
59
- /** Three-character ISO-4217 code. */
60
- currency_code: string;
61
- value: string;
62
- };
63
- /** @link https://developer.paypal.com/docs/api/orders/v2/#orders_get */
64
- payments?: {
65
- captures: CapturedPayment[];
66
- };
67
- };
68
-
69
- type CapturedPayment = {
70
- seller_receivable_breakdown: {
71
- gross_amount: { value: number };
72
- paypal_fee: { value: number };
73
- net_amount: { value: number };
74
- };
75
- };
76
-
77
- type Intent = "CAPTURE" | "AUTHORIZE";
78
- type Status =
79
- | "CREATED"
80
- | "SAVED"
81
- | "APPROVED"
82
- | "VOIDED"
83
- | "COMPLETED"
84
- | "PAYER_ACTION_REQUIRED";
85
- }
@@ -1,50 +0,0 @@
1
- import {
2
- DeleteCommand,
3
- PutCommand,
4
- UpdateCommand,
5
- } from "@aws-sdk/lib-dynamodb";
6
- import { Db, UpdateBuilder } from "@better-giving/db";
7
- import type { ISubscription } from "./interfaces.mjs";
8
-
9
- type K = keyof ISubscription;
10
- export class SubsDb extends Db {
11
- static readonly table = "subscriptions";
12
-
13
- key(id: string) {
14
- return { subscription_id: id } satisfies Pick<
15
- ISubscription,
16
- "subscription_id"
17
- >;
18
- }
19
- async put(data: ISubscription) {
20
- const cmd = new PutCommand({
21
- TableName: SubsDb.table,
22
- Item: data,
23
- ConditionExpression: `attribute_not_exists(${"subscription_id" satisfies K})`,
24
- });
25
- return this.client.send(cmd);
26
- }
27
- async update(
28
- id: string,
29
- data: Partial<Omit<ISubscription, "subscription_id">>
30
- ): Promise<ISubscription> {
31
- const upd8 = new UpdateBuilder();
32
- for (const k in data) {
33
- upd8.set(k as K, (data as any)[k]);
34
- }
35
- const cmd = new UpdateCommand({
36
- TableName: SubsDb.table,
37
- Key: this.key(id),
38
- ...upd8.collect(),
39
- });
40
- return this.client.send(cmd).then((r) => r.Attributes as any);
41
- }
42
-
43
- async del(id: string) {
44
- const cmd = new DeleteCommand({
45
- TableName: SubsDb.table,
46
- Key: this.key(id),
47
- });
48
- return this.client.send(cmd);
49
- }
50
- }