feat: change payment method endpoint

This commit is contained in:
Mo
2023-05-05 08:27:06 -05:00
parent 0a0b8aafaf
commit f5ac8ac5e9
2 changed files with 14 additions and 1 deletions
@@ -30,6 +30,16 @@ export class PaymentsControllerV2 extends BaseHttpController {
await this.httpService.callPaymentsServer(request, response, 'api/subscriptions/deltas/apply', request.body)
}
@httpPost('/subscriptions/change-payment-method', TYPES.SubscriptionTokenAuthMiddleware)
async changePaymentMethod(request: Request, response: Response): Promise<void> {
await this.httpService.callPaymentsServer(
request,
response,
'api/subscriptions/change-payment-method',
request.body,
)
}
@httpGet('/subscriptions/:subscriptionId', TYPES.SubscriptionTokenAuthMiddleware)
async getSubscription(request: Request, response: Response): Promise<void> {
await this.httpService.callPaymentsServer(
@@ -65,7 +65,10 @@ export class CreateOfflineSubscriptionToken implements UseCaseInterface {
await this.domainEventPublisher.publish(
this.domainEventFactory.createEmailRequestedEvent({
body: getBody(dto.userEmail, `https://standardnotes.com/dashboard/offline?subscription_token=${token}`),
body: getBody(
dto.userEmail,
`https://standardnotes.com/dashboard/offline?subscription_token=${token}&email=${dto.userEmail}`,
),
level: EmailLevel.LEVELS.System,
subject: getSubject(),
messageIdentifier: 'OFFLINE_SUBSCRIPTION_ACCESS',