public async Task Webhook_Returns200_WhenWebhookSecretIsCorrect()
        {
            var stripeOptions = new StripeOptionsMock();
            var jwtToken      = new JwtToken()
            {
                UserId      = "google|patryk1",
                AccessToken = "accessToken",
            };
            UserManagementServiceMock userManagementServiceMock = new UserManagementServiceMock();
            StripePaymentServiceMock  stripePaymentServiceMock  = new StripePaymentServiceMock();

            StripeEventHandlerService stripeEventHandlerService = new StripeEventHandlerService(userManagementServiceMock, stripeOptions, stripePaymentServiceMock);

            var controller = new PaymentsController(jwtToken, stripeEventHandlerService, userManagementServiceMock, null);

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    Request =
                    {
                        Headers =
                        {
                            new KeyValuePair <string, StringValues>("Stripe-Signature", "whsec_g6pND8HOaUZaNpk0uUiUlTKzZP8LomW9")
                        }
                    }
                }
            };

            var result = await controller.Webhook();

            Assert.IsType <BadRequestResult>(result);
        }
예제 #2
0
 public PaymentsController(JwtToken jwtToken,
                           StripeEventHandlerService stripeEventHandlerService, IUserManagementService userManagementService,
                           StripePaymentService stripePaymentService)
 {
     _jwtToken = jwtToken;
     _stripeEventHandlerService = stripeEventHandlerService;
     _userManagementService     = userManagementService;
     _stripePaymentService      = stripePaymentService;
 }