@internetarchive/donation-monthly-portal 0.0.0-processorid1 → 0.0.0-processorid3

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.
@@ -7,7 +7,7 @@ export declare type BtData = {
7
7
  oldDate?: string;
8
8
  };
9
9
  lastBillingDate: {
10
- date: string;
10
+ date: string | null;
11
11
  timezone_type: number;
12
12
  timezone: string;
13
13
  };
@@ -31,7 +31,7 @@ export declare type Plan = {
31
31
  oldDate?: string;
32
32
  oldPaymentMethod?: string;
33
33
  isCancelled?: boolean;
34
- processorId?: string;
34
+ processor_id?: string;
35
35
  oldProcessorId?: string;
36
36
  };
37
37
  export declare class MonthlyPlan {
@@ -50,8 +50,5 @@ export declare class MonthlyPlan {
50
50
  get hasBeenCancelled(): boolean;
51
51
  get isTest(): boolean;
52
52
  cancelPlan(): void;
53
- setNewProcessorId({ newProcessorId, oldProcessorId, }: {
54
- newProcessorId: string;
55
- oldProcessorId: string;
56
- }): void;
53
+ setNewProcessorId(newProcessorId: string): void;
57
54
  }
@@ -37,6 +37,9 @@ export class MonthlyPlan {
37
37
  return nextBillingDate !== null && nextBillingDate !== void 0 ? nextBillingDate : 'not found';
38
38
  }
39
39
  get lastBillingDateLocale() {
40
+ if (!this.payment.lastBillingDate.date) {
41
+ return '';
42
+ }
40
43
  const lastBillingDate = new Date(this.payment.lastBillingDate.date).toLocaleDateString(undefined, {
41
44
  year: 'numeric',
42
45
  month: 'short',
@@ -54,9 +57,10 @@ export class MonthlyPlan {
54
57
  cancelPlan() {
55
58
  this.plan.isCancelled = true;
56
59
  }
57
- setNewProcessorId({ newProcessorId, oldProcessorId, }) {
58
- this.plan.processorId = newProcessorId;
59
- this.plan.oldProcessorId = oldProcessorId;
60
+ setNewProcessorId(newProcessorId) {
61
+ const currentProcessorId = this.plan.processor_id;
62
+ this.plan.processor_id = newProcessorId;
63
+ this.plan.oldProcessorId = currentProcessorId;
60
64
  }
61
65
  }
62
66
  /*
@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kBAAkB,CAAC,SAAS,EAAE;YAC9B,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,OAAO;YACd,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;QAEH,OAAO,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,WAAW,CAAC;IACxC,CAAC;IAED,IAAI,qBAAqB;QACvB,MAAM,eAAe,GAAG,IAAI,IAAI,CAC9B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAClC,CAAC,kBAAkB,CAAC,SAAS,EAAE;YAC9B,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,OAAO;YACd,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,eAAe,CAAC,CAAC;QAE3D,OAAO,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,WAAW,CAAC;IACxC,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;IACxC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,iBAAiB,CAAC,EAChB,cAAc,EACd,cAAc,GAIf;QACC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IAC5C,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;IAwBI","sourcesContent":["export type BtData = {\n billingDayOfMonth: number;\n nextBillingDate: {\n date: string;\n timezone_type: number;\n timezone: string;\n oldDate?: string; // optional for updates ISO UTC date string\n };\n lastBillingDate: {\n date: string;\n timezone_type: number;\n timezone: string;\n };\n status: string; // active, inactive\n paymentMethodType: string; // cc, paypal, venmo, etc\n last4: string | null;\n cardType: string | null;\n expirationMonth: string | null;\n expirationYear: string | null;\n paypalEmail?: string;\n venmoUsername?: string;\n};\n\nexport type Plan = {\n token: string;\n amount: number;\n currency: string;\n start_date: string; // UTC\n is_test: boolean;\n btdata: BtData;\n oldAmount?: number;\n oldDate?: string;\n oldPaymentMethod?: string;\n isCancelled?: boolean;\n processorId?: string; // used when editing date\n oldProcessorId?: string;\n};\n\nexport class MonthlyPlan {\n plan: Plan;\n\n currency: string;\n\n payment: BtData;\n\n constructor(plan: Plan) {\n this.plan = plan;\n this.payment = plan.btdata;\n this.currency = plan.currency ?? 'USD'; // not in data\n }\n\n get id(): string {\n // use token as unique id\n return this.plan.token;\n }\n\n get currencySymbol(): string {\n return this.currency === 'USD' ? '$' : '';\n }\n\n get amount(): number {\n return this.plan.amount;\n }\n\n setAmount(newAmount: number) {\n this.plan.oldAmount = this.plan.amount;\n this.plan.amount = newAmount;\n }\n\n get nextBillingDate(): string {\n // iso08601 date string\n return this.payment.nextBillingDate.date;\n }\n\n setNextBillingDate(newDate: string) {\n // iso08601 date string\n this.payment.nextBillingDate.oldDate = this.payment.nextBillingDate.date;\n this.payment.nextBillingDate.date = newDate;\n }\n\n get nextBillingDateLocale(): string {\n const nextBillingDate = new Date(\n this.payment.nextBillingDate.date\n ).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n\n return nextBillingDate ?? 'not found';\n }\n\n get lastBillingDateLocale(): string {\n const lastBillingDate = new Date(\n this.payment.lastBillingDate.date\n ).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n\n console.log('lastBillingDate from model', lastBillingDate);\n\n return lastBillingDate ?? 'not found';\n }\n\n get hasBeenCancelled(): boolean {\n return this.plan.isCancelled === true;\n }\n\n get isTest(): boolean {\n return this.plan.is_test;\n }\n\n cancelPlan(): void {\n this.plan.isCancelled = true;\n }\n\n setNewProcessorId({\n newProcessorId,\n oldProcessorId,\n }: {\n newProcessorId: string;\n oldProcessorId: string;\n }): void {\n this.plan.processorId = newProcessorId;\n this.plan.oldProcessorId = oldProcessorId;\n }\n}\n\n/*\n\n{\n \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJtYWlsc3luYyIsImlhdCI6MTczODYxNTY3NS41ODA4MTcsIm5iZiI6MTczODYxNTYxNS41ODA4MTcsImV4cCI6MTczODYxNjI3NS41ODA4MTcsImtleSI6eyJwaWQiOiJkd2NrN20iLCJjaWQiOjgwMzUzOCwiYW1vdW50Ijo1LCJwYXltZW50TWV0aG9kVG9rZW4iOiJxMXllYndoaiIsImN1c3RvbWVySWQiOiI4NTQ2MTk4MzUifSwidXNlciI6IkBpc2EtYXQtdGhlLWFyY2hpdmUifQ.TYlkU1ZZLHmj2ahrkTV7JGLmpCPN4BcOeDFPiXVj0pM\",\n \"amount\": 5,\n \"currency\": \"USD\",\n \"start_date\": \"2022-12-09 00:00:00\",\n \"contribution_status_id\": 5,\n \"is_test\": true,\n \"btdata\": {\n \"billingDayOfMonth\": 9,\n \"nextBillingDate\": {\n \"date\": \"2025-02-09 00:00:00.000000\",\n \"timezone_type\": 3,\n \"timezone\": \"UTC\"\n },\n \"status\": \"Active\",\n \"paymentMethodType\": \"creditCard\",\n \"last4\": \"1111\",\n \"cardType\": \"Visa\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2023\"\n }\n}\n */\n"]}
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/models/plan.ts"],"names":[],"mappings":"AAsCA,MAAM,OAAO,WAAW;IAOtB,YAAY,IAAU;;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,KAAK,CAAC,CAAC,cAAc;IACxD,CAAC;IAED,IAAI,EAAE;QACJ,yBAAyB;QACzB,OAAO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,eAAe,CAAC,IAAI,CAClC,CAAC,kBAAkB,CAAC,SAAS,EAAE;YAC9B,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,OAAO;YACd,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,eAAe,CAAC,CAAC;QAE3D,OAAO,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,WAAW,CAAC;IACxC,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;IACxC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,iBAAiB,CAAC,cAAsB;QACtC,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAClD,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,kBAAkB,CAAC;IAChD,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;IAwBI","sourcesContent":["export type BtData = {\n billingDayOfMonth: number;\n nextBillingDate: {\n date: string;\n timezone_type: number;\n timezone: string;\n oldDate?: string; // optional for updates ISO UTC date string\n };\n lastBillingDate: {\n date: string | null;\n timezone_type: number;\n timezone: string;\n };\n status: string; // active, inactive\n paymentMethodType: string; // cc, paypal, venmo, etc\n last4: string | null;\n cardType: string | null;\n expirationMonth: string | null;\n expirationYear: string | null;\n paypalEmail?: string;\n venmoUsername?: string;\n};\n\nexport type Plan = {\n token: string;\n amount: number;\n currency: string;\n start_date: string; // UTC\n is_test: boolean;\n btdata: BtData;\n oldAmount?: number;\n oldDate?: string;\n oldPaymentMethod?: string;\n isCancelled?: boolean;\n processor_id?: string; // used when editing date\n oldProcessorId?: string;\n};\n\nexport class MonthlyPlan {\n plan: Plan;\n\n currency: string;\n\n payment: BtData;\n\n constructor(plan: Plan) {\n this.plan = plan;\n this.payment = plan.btdata;\n this.currency = plan.currency ?? 'USD'; // not in data\n }\n\n get id(): string {\n // use token as unique id\n return this.plan.token;\n }\n\n get currencySymbol(): string {\n return this.currency === 'USD' ? '$' : '';\n }\n\n get amount(): number {\n return this.plan.amount;\n }\n\n setAmount(newAmount: number) {\n this.plan.oldAmount = this.plan.amount;\n this.plan.amount = newAmount;\n }\n\n get nextBillingDate(): string {\n // iso08601 date string\n return this.payment.nextBillingDate.date;\n }\n\n setNextBillingDate(newDate: string) {\n // iso08601 date string\n this.payment.nextBillingDate.oldDate = this.payment.nextBillingDate.date;\n this.payment.nextBillingDate.date = newDate;\n }\n\n get nextBillingDateLocale(): string {\n const nextBillingDate = new Date(\n this.payment.nextBillingDate.date\n ).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n\n return nextBillingDate ?? 'not found';\n }\n\n get lastBillingDateLocale(): string {\n if (!this.payment.lastBillingDate.date) {\n return '';\n }\n\n const lastBillingDate = new Date(\n this.payment.lastBillingDate.date\n ).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n\n console.log('lastBillingDate from model', lastBillingDate);\n\n return lastBillingDate ?? 'not found';\n }\n\n get hasBeenCancelled(): boolean {\n return this.plan.isCancelled === true;\n }\n\n get isTest(): boolean {\n return this.plan.is_test;\n }\n\n cancelPlan(): void {\n this.plan.isCancelled = true;\n }\n\n setNewProcessorId(newProcessorId: string): void {\n const currentProcessorId = this.plan.processor_id;\n this.plan.processor_id = newProcessorId;\n this.plan.oldProcessorId = currentProcessorId;\n }\n}\n\n/*\n\n{\n \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJtYWlsc3luYyIsImlhdCI6MTczODYxNTY3NS41ODA4MTcsIm5iZiI6MTczODYxNTYxNS41ODA4MTcsImV4cCI6MTczODYxNjI3NS41ODA4MTcsImtleSI6eyJwaWQiOiJkd2NrN20iLCJjaWQiOjgwMzUzOCwiYW1vdW50Ijo1LCJwYXltZW50TWV0aG9kVG9rZW4iOiJxMXllYndoaiIsImN1c3RvbWVySWQiOiI4NTQ2MTk4MzUifSwidXNlciI6IkBpc2EtYXQtdGhlLWFyY2hpdmUifQ.TYlkU1ZZLHmj2ahrkTV7JGLmpCPN4BcOeDFPiXVj0pM\",\n \"amount\": 5,\n \"currency\": \"USD\",\n \"start_date\": \"2022-12-09 00:00:00\",\n \"contribution_status_id\": 5,\n \"is_test\": true,\n \"btdata\": {\n \"billingDayOfMonth\": 9,\n \"nextBillingDate\": {\n \"date\": \"2025-02-09 00:00:00.000000\",\n \"timezone_type\": 3,\n \"timezone\": \"UTC\"\n },\n \"status\": \"Active\",\n \"paymentMethodType\": \"creditCard\",\n \"last4\": \"1111\",\n \"cardType\": \"Visa\",\n \"expirationMonth\": \"12\",\n \"expirationYear\": \"2023\"\n }\n}\n */\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/donation-monthly-portal",
3
- "version": "0.0.0-processorid1",
3
+ "version": "0.0.0-processorid3",
4
4
  "description": "The Internet Archive Monthly Portal",
5
5
  "license": "AGPL-3.0-only",
6
6
  "main": "dist/index.js",
@@ -7,7 +7,7 @@ export type BtData = {
7
7
  oldDate?: string; // optional for updates ISO UTC date string
8
8
  };
9
9
  lastBillingDate: {
10
- date: string;
10
+ date: string | null;
11
11
  timezone_type: number;
12
12
  timezone: string;
13
13
  };
@@ -32,7 +32,7 @@ export type Plan = {
32
32
  oldDate?: string;
33
33
  oldPaymentMethod?: string;
34
34
  isCancelled?: boolean;
35
- processorId?: string; // used when editing date
35
+ processor_id?: string; // used when editing date
36
36
  oldProcessorId?: string;
37
37
  };
38
38
 
@@ -91,6 +91,10 @@ export class MonthlyPlan {
91
91
  }
92
92
 
93
93
  get lastBillingDateLocale(): string {
94
+ if (!this.payment.lastBillingDate.date) {
95
+ return '';
96
+ }
97
+
94
98
  const lastBillingDate = new Date(
95
99
  this.payment.lastBillingDate.date
96
100
  ).toLocaleDateString(undefined, {
@@ -116,15 +120,10 @@ export class MonthlyPlan {
116
120
  this.plan.isCancelled = true;
117
121
  }
118
122
 
119
- setNewProcessorId({
120
- newProcessorId,
121
- oldProcessorId,
122
- }: {
123
- newProcessorId: string;
124
- oldProcessorId: string;
125
- }): void {
126
- this.plan.processorId = newProcessorId;
127
- this.plan.oldProcessorId = oldProcessorId;
123
+ setNewProcessorId(newProcessorId: string): void {
124
+ const currentProcessorId = this.plan.processor_id;
125
+ this.plan.processor_id = newProcessorId;
126
+ this.plan.oldProcessorId = currentProcessorId;
128
127
  }
129
128
  }
130
129