-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(console): Billing/payment notifications (#2446)
- Loading branch information
Showing
18 changed files
with
454 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
platform/account/src/jsonrpc/methods/cancelServicePlans.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { z } from 'zod' | ||
import { Context } from '../../context' | ||
import { inputValidators } from '@proofzero/platform-middleware' | ||
import { initAccountNodeByName } from '../../nodes' | ||
export const CancelServicePlansInput = z.object({ | ||
account: inputValidators.AccountURNInput, | ||
subscriptionID: z.string(), | ||
deletePaymentData: z.boolean().optional(), | ||
}) | ||
|
||
export type CancelServicePlansParams = z.infer<typeof CancelServicePlansInput> | ||
|
||
export const cancelServicePlans = async ({ | ||
input, | ||
ctx, | ||
}: { | ||
input: CancelServicePlansParams | ||
ctx: Context | ||
}) => { | ||
const servicePlansNode = await initAccountNodeByName( | ||
input.account, | ||
ctx.Account | ||
) | ||
|
||
await servicePlansNode.storage.delete('servicePlans') | ||
if (input.deletePaymentData) { | ||
await servicePlansNode.storage.delete('stripePaymentData') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
platform/address/src/jsonrpc/methods/sendBillingNotification.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { z } from 'zod' | ||
|
||
import { Context } from '../../context' | ||
|
||
import { EmailThemePropsSchema } from '../../../../email/src/emailFunctions' | ||
|
||
export const SendBillingNotificationInput = z.object({ | ||
email: z.string(), | ||
name: z.string(), | ||
themeProps: EmailThemePropsSchema.optional(), | ||
}) | ||
|
||
type SendBillingNotificationParams = z.infer< | ||
typeof SendBillingNotificationInput | ||
> | ||
|
||
export const sendBillingNotificationMethod = async ({ | ||
input, | ||
ctx, | ||
}: { | ||
input: SendBillingNotificationParams | ||
ctx: Context | ||
}) => { | ||
const { email, name, themeProps } = input | ||
|
||
await ctx.emailClient.sendBillingNotification.mutate({ | ||
emailAddress: email, | ||
name: name, | ||
themeProps, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.