private async Task ShouldFullVoidCardPayment() { var paymentResponse = await MakeCardPayment(); var voidRequest = new VoidRequest { Reference = Guid.NewGuid().ToString() }; var response = await DefaultApi.PaymentsClient().VoidPayment(paymentResponse.Id, voidRequest); response.ShouldNotBeNull(); response.ActionId.ShouldNotBeNullOrEmpty(); response.Reference.ShouldNotBeNullOrEmpty(); response.GetLink("payment").ShouldNotBeNull(); var payment = await Retriable(async() => await DefaultApi.PaymentsClient().GetPaymentDetails(paymentResponse.Id), TotalVoidedIs10); payment.Balances.TotalAuthorized.ShouldBe(paymentResponse.Amount); payment.Balances.TotalCaptured.ShouldBe(0); payment.Balances.TotalRefunded.ShouldBe(0); payment.Balances.TotalVoided.ShouldBe(paymentResponse.Amount); payment.Balances.AvailableToCapture.ShouldBe(0); payment.Balances.AvailableToRefund.ShouldBe(0); payment.Balances.AvailableToVoid.ShouldBe(0); }
public Task <VoidResponse> VoidPayment( string paymentId, VoidRequest voidRequest = null, string idempotencyKey = null, CancellationToken cancellationToken = default) { CheckoutUtils.ValidateParams("paymentId", paymentId); return(ApiClient.Post <VoidResponse>(BuildPath(PaymentsPath, paymentId, "voids"), SdkAuthorization(), voidRequest, cancellationToken, idempotencyKey)); }
private async Task ShouldVoidPayment_Request() { var voidRequest = new VoidRequest(); var voidResponse = new VoidResponse(); _apiClient.Setup(apiClient => apiClient.Post <VoidResponse>(PaymentsPath + "/payment_id/voids", _authorization, voidRequest, CancellationToken.None, "test")) .ReturnsAsync(() => voidResponse); IPaymentsClient paymentsClient = new PaymentsClient(_apiClient.Object, _configuration.Object); var response = await paymentsClient.VoidPayment("payment_id", voidRequest, "test"); response.ShouldNotBeNull(); }
private async Task ShouldVoidCardPaymentIdempotently() { var paymentResponse = await MakeCardPayment(); var voidRequest = new VoidRequest { Reference = Guid.NewGuid().ToString() }; var response = await DefaultApi.PaymentsClient() .VoidPayment(paymentResponse.Id, voidRequest, IdempotencyKey); response.ShouldNotBeNull(); var response2 = await DefaultApi.PaymentsClient() .VoidPayment(paymentResponse.Id, voidRequest, IdempotencyKey); response2.ShouldNotBeNull(); response.ActionId.ShouldBe(response2.ActionId); }
public Task <VoidResponse> VoidAsync(string paymentId, VoidRequest voidRequest = null, CancellationToken cancellationToken = default(CancellationToken)) { const string path = "/voids"; return(_apiClient.PostAsync <VoidResponse>(GetPaymentUrl(paymentId) + path, _credentials, cancellationToken, voidRequest)); }