예제 #1
0
        internal static Protocal.Physical.TerminateData ToTerminateData(string terminateXml)
        {
            var      result = new Protocal.Physical.TerminateData();
            XElement root   = XElement.Parse(terminateXml);
            XElement node   = root.Element("Order");

            result.OrderId            = node.AttrToGuid("ID");
            result.TerminateFee       = node.AttrToDecimal("TerminateFee");
            result.Amount             = node.AttrToDecimal("Amount");
            result.SourceTerminateFee = XmlConvert.ToDecimal(node.Attribute("SourceTerminateFee").Value.Replace(",", ""));
            result.SourceCurrencyId   = node.HasAttribute("SourceCurrencyId") ? node.AttrToGuid("SourceCurrencyId") : Guid.Empty;
            result.SourceAmount       = node.AttrToDecimal("SourceAmount");
            result.CurrencyRate       = node.AttrToDecimal("CurrencyRate");
            result.IsPayOff           = node.AttrToBoolean("IsPayOff");
            return(result);
        }
예제 #2
0
 internal static TransactionError PrePayForInstalment(this Account account, Guid submitorId, Guid currencyId, decimal sumSourcePaymentAmount, decimal sumSourceTerminateFee, Protocal.Physical.TerminateData terminateData)
 {
     Logger.InfoFormat("PrePayForInstalment account id = {0}", account.Id);
     try
     {
         account.Verify(terminateData.OrderId, terminateData.IsPayOff, sumSourcePaymentAmount, sumSourceTerminateFee, currencyId);
     }
     catch (TransactionServerException ex)
     {
         Logger.Error(ex);
         return(ex.ErrorCode);
     }
     PrePayer.Payoff(account, currencyId, submitorId, terminateData);
     account.SaveAndBroadcastChanges();
     return(TransactionError.OK);
 }