/// <summary> /// Voids a payment /// </summary> /// <param name="voidPaymentRequest">Request</param> /// <returns>Result</returns> public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest) { var result = new VoidPaymentResult(); var config = new HpsServicesConfig(); config.SecretApiKey = _secureSubmitPaymentSettings.SecretApiKey; config.DeveloperId = "002914"; config.VersionNumber = "1513"; var creditService = new HpsCreditService(config); try { if (string.IsNullOrEmpty(voidPaymentRequest.Order.CaptureTransactionId)) { creditService.Void(Convert.ToInt32(voidPaymentRequest.Order.AuthorizationTransactionId)); } else { creditService.Void(Convert.ToInt32(voidPaymentRequest.Order.CaptureTransactionId)); } result.NewPaymentStatus = PaymentStatus.Voided; } catch (HpsException ex) { result.AddError(ex.Message); } return result; }