Ejemplo n.º 1
0
        private async Task ShouldRequestPayout_IdempotencyKey()
        {
            var payoutRequest  = new PayoutRequest();
            var payoutResponse = new PayoutResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Post <PayoutResponse>(PaymentsPath, _authorization, payoutRequest,
                                                             CancellationToken.None, "test"))
            .ReturnsAsync(() => payoutResponse);

            IPaymentsClient paymentsClient = new PaymentsClient(_apiClient.Object, _configuration.Object);

            var response = await paymentsClient.RequestPayout(payoutRequest, "test", CancellationToken.None);

            response.ShouldNotBeNull();
            response.ShouldBeSameAs(payoutResponse);
        }
Ejemplo n.º 2
0
        private async Task ShouldRequestPayout()
        {
            var payoutRequest = new PayoutRequest
            {
                Destination = new PaymentRequestBankAccountDestination
                {
                    AccountType   = AccountType.Cash,
                    AccountNumber = "13654567455",
                    BankCode      = "bank_code",
                    BranchCode    = "6443",
                    Bban          = "3704 0044 0532 0130 00",
                    Iban          = "HU93116000060000000012345676",
                    SwiftBic      = "37040044",
                    Country       = CountryCode.HU,
                    AccountHolder = new AccountHolder {
                        FirstName = "First Name", LastName = "Last Name",
                    },
                    Bank = new BankDetails {
                        Name = "Bank Name", Address = new Address(), Branch = "branch"
                    }
                }
            };
            var payoutResponse = new PayoutResponse();

            _apiClient.Setup(apiClient =>
                             apiClient.Post <PayoutResponse>(PaymentsPath, _authorization, payoutRequest,
                                                             CancellationToken.None, null))
            .ReturnsAsync(() => payoutResponse);

            IPaymentsClient paymentsClient = new PaymentsClient(_apiClient.Object, _configuration.Object);

            var response = await paymentsClient.RequestPayout(payoutRequest, null, CancellationToken.None);

            response.ShouldNotBeNull();
            response.ShouldBeSameAs(payoutResponse);
        }