private decimal GetAmountValue(BasicAmountType amount) { decimal sOut; try { sOut = Convert.ToDecimal(amount.Value); amount.currencyID = CurrencyCodeType.GBP; } catch { sOut = 0; } return sOut; }
BasicAmountType GetBasicAmount(double amount) { BasicAmountType bAmount = new BasicAmountType(); bAmount.Value = amount.ToString(); bAmount.currencyID = CurrencyCodeType.GBP; return bAmount; }
public void RefundTransaction(string transactionId) { RefundTransactionRequestType refundRequest = new RefundTransactionRequestType(); BasicAmountType amount = new BasicAmountType(); amount.currencyID = CurrencyCodeType.GBP; refundRequest.Memo = "Transaction ID: " + transactionId; refundRequest.RefundType = RefundType.Full; refundRequest.TransactionID = transactionId; refundRequest.Version = "2.0"; RefundTransactionReq request = new RefundTransactionReq(); request.RefundTransactionRequest = refundRequest; try { RefundTransactionResponseType response = service.RefundTransaction(request); string errors = CheckForErrors(response); if (errors == string.Empty) { IsSubmissionSuccess = true; } else { IsSubmissionSuccess = false; SubmissionError = errors; } } catch(Exception ex) { throw ex; } }