public void Withdraw_ShouldThrowRpcExceptionWithInternalStatus() { // Arrange var userId = new UserId(); const string email = "*****@*****.**"; var host = TestHost.WithClaimsFromBearerAuthentication(new Claim(JwtClaimTypes.Subject, userId.ToString()), new Claim(JwtClaimTypes.Email, email)); var request = new CreatePaypalPayoutRequest { Transaction = new TransactionDto { Currency = new CurrencyDto { Type = EnumCurrencyType.Money, Amount = 20 }, Description = "test", Id = new TransactionId(), Status = EnumTransactionStatus.Pending, Timestamp = DateTime.UtcNow.ToTimestamp(), Type = EnumTransactionType.Withdraw } }; var client = new PaymentService.PaymentServiceClient(host.CreateChannel()); // Act var func = new Func <Task>(async() => await client.CreatePaypalPayoutAsync(request)); // Assert func.Should().Throw <RpcException>(); }
//Gen Bill No public string GetBillNo(string user_id, string doc_date, string doc_code, string doc_type, string date_mode) { PaymentService.PaymentServiceClient svc = new PaymentService.PaymentServiceClient(); //string billNo = svc.GetBillNo(user_id, doc_date, doc_code, doc_type, date_mode); return(""); // billNo; }
public void Deposit_ShouldThrowRpcExceptionNoDefaultPayment() { // Arrange var userId = new UserId(); const string email = "*****@*****.**"; var host = TestHost.WithClaimsFromBearerAuthentication(new Claim(JwtClaimTypes.Subject, userId.ToString()), new Claim(JwtClaimTypes.Email, email)) .WithWebHostBuilder( builder => { builder.ConfigureTestContainer <ContainerBuilder>( container => { TestMock.ServiceBusPublisher.Setup(x => x.PublishAsync(It.IsAny <UserDepositSucceededIntegrationEvent>())) .Returns(Task.CompletedTask); container.RegisterInstance(TestMock.ServiceBusPublisher.Object).As <IServiceBusPublisher>(); TestMock.StripeCustomerService.Setup(x => x.HasDefaultPaymentMethodAsync(It.IsAny <string>())).ReturnsAsync(false); container.RegisterInstance(TestMock.StripeCustomerService.Object).As <IStripeCustomerService>(); }); }); var client = new PaymentService.PaymentServiceClient(host.CreateChannel()); var request = new CreateStripePaymentIntentRequest { Transaction = new TransactionDto { Currency = new CurrencyDto { Type = EnumCurrencyType.Money, Amount = 20 }, Description = "test", Id = new TransactionId(), Status = EnumTransactionStatus.Pending, Timestamp = DateTime.UtcNow.ToTimestamp(), Type = EnumTransactionType.Deposit } }; // Act var func = new Func <Task>(async() => await client.CreateStripePaymentIntentAsync(request)); // Assert func.Should().Throw <RpcException>(); }
public TransactionsControllers(CashierService.CashierServiceClient cashierServiceClient, PaymentService.PaymentServiceClient paymentServiceClient) { _cashierServiceClient = cashierServiceClient; _paymentServiceClient = paymentServiceClient; }
public PaymentBiz() { svc = new PaymentService.PaymentServiceClient(); }