public async Task <IActionResult> Unsubscribe(
            NotificationModel notificationModel,
            CancellationToken cancellationToken)
        {
            var result = await this.UpdateOperationAsync(notificationModel, cancellationToken);

            return(result.Success
                       ? this.View("OperationUpdate", notificationModel)
                       : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)));
        }
Esempio n. 2
0
        public async Task <IActionResult> Reinstate(WebhookPayload payload, CancellationToken cancellationToken)
        {
            var result = await this.UpdateOperationAsync(payload, cancellationToken);

            return(result.Success
                       ? this.View(
                       "OperationUpdate",
                       new OperationUpdateViewModel {
                OperationType = "Reinstate", Payload = payload
            })
                       : this.View(viewName: "MailActionError", FulfillmentRequestErrorViewModel.From(result)));
        }
        public async Task <IActionResult> Update(NotificationModel notificationModel)
        {
            var result = await this.fulfillmentClient.UpdateSubscriptionPlanAsync(
                notificationModel.SubscriptionId,
                notificationModel.PlanId,
                Guid.Empty,
                Guid.Empty,
                CancellationToken.None);

            return(result.Success
                       ? this.View(
                       new ActivateActionViewModel
            {
                SubscriptionId = notificationModel.SubscriptionId, PlanId = notificationModel.PlanId
            })
                       : this.View("MailActionError", FulfillmentRequestErrorViewModel.From(result)));
        }
Esempio n. 4
0
        public async Task <IActionResult> Activate(Guid subscriptionId, string planId)
        {
            var result = await this.fulfillmentClient.ActivateSubscriptionAsync(
                subscriptionId,
                new ActivatedSubscription()
            {
                PlanId = planId
            },
                Guid.Empty,
                Guid.Empty,
                CancellationToken.None);

            return(result.Success
                       ? this.View(new ActivateActionViewModel {
                SubscriptionId = subscriptionId, PlanId = planId
            })
                       : this.View(viewName: "MailActionError", FulfillmentRequestErrorViewModel.From(result)));
        }