/// <summary> /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler" /> interface. /// </summary> /// <param name="context">An <see cref="T:System.Web.HttpContext" /> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param> public override void ProcessRequest(HttpContext context) { string transactionRequest = null; try { string jsonParameter = GetJsonParameter(context.Request); ITradingOrder requestObject = (ITradingOrder)JsonConvert.DeserializeObject(jsonParameter, typeof(ITradingOrder)); PaymentClient client = new PaymentClient(this.TransactionInfo); var service = new PaymentService(); if (requestObject != null) { transactionRequest = client.CreateTransactionRequest(requestObject); } } catch (Exception ex) { transactionRequest = ex.Message.ToString(); } context.Response.ContentType = "text/plain"; context.Response.Write(transactionRequest); }
/// <summary> /// Gets the authorization token. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public override string GetAuthenticateToken(ITradingOrder order) { order.CheckNullObject("order"); this.TransactionInfo.CheckNullObject("TransactionInfo"); var request = GenerateBasicRequestParameters(); request.Add(AliServiceConfig.partner, this.TransactionInfo.Partner); request.Add(AliServiceConfig.format, AliServiceConfig.Format); request.Add(AliServiceConfig.version, AliServiceConfig.Version); request.Add(AliServiceConfig.sec_id, AliServiceConfig.SignType.ToUpper()); request.Add(AliServiceConfig.req_id, AliServiceConfig.RequestId); request.Add(AliServiceConfig.service, AliServiceConfig.AliCellphoneCreateTokenService); request.Add(AliServiceConfig.req_data, string.Format(AliServiceConfig.RequestDataToken, /// {0}: notify_url /// {1}: call_back_url /// {2}: seller_account_name /// {3}: trade number /// {4}: trade subject /// {5}: total fee /// {6}: merchant_url this.TransactionInfo.NotifyUrl, this.TransactionInfo.CallBackUrl, this.TransactionInfo.SellerAccountName, order.Key, order.Subject, order.TotalFee )); return GetAuthenticateToken(GetPreSignedDictionary(request)); }
/// <summary> /// Gets the authorization token. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public override string GetAuthenticateToken(ITradingOrder order) { order.CheckNullObject("order"); this.TransactionInfo.CheckNullObject("TransactionInfo"); var request = GenerateBasicRequestParameters(); request.Add(AliServiceConfig.partner, this.TransactionInfo.Partner); request.Add(AliServiceConfig.format, AliServiceConfig.Format); request.Add(AliServiceConfig.version, AliServiceConfig.Version); request.Add(AliServiceConfig.sec_id, AliServiceConfig.SignType.ToUpper()); request.Add(AliServiceConfig.req_id, AliServiceConfig.RequestId); request.Add(AliServiceConfig.service, AliServiceConfig.AliCellphoneCreateTokenService); request.Add(AliServiceConfig.req_data, string.Format(AliServiceConfig.RequestDataToken, /// {0}: notify_url /// {1}: call_back_url /// {2}: seller_account_name /// {3}: trade number /// {4}: trade subject /// {5}: total fee /// {6}: merchant_url this.TransactionInfo.NotifyUrl, this.TransactionInfo.CallBackUrl, this.TransactionInfo.SellerAccountName, order.Key, order.Subject, order.TotalFee )); return(GetAuthenticateToken(GetPreSignedDictionary(request))); }
/// <summary> /// Gets the authenticate token. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public string GetAuthenticateToken(ITradingOrder order) { if (Payment != null) { return(Payment.GetAuthenticateToken(order)); } return(string.Empty); }
/// <summary> /// Create the transaction request. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public string CreateTransactionRequest(ITradingOrder order) { if (Payment != null) { return(Payment.CreateTransactionRequest(order)); } return(string.Empty); }
/// <summary> /// Gets the authenticate token. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public string GetAuthenticateToken(ITradingOrder order) { if (Payment != null) { return Payment.GetAuthenticateToken(order); } return string.Empty; }
/// <summary> /// Create the transaction request. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public string CreateTransactionRequest(ITradingOrder order) { if(Payment !=null) { return Payment.CreateTransactionRequest(order); } return string.Empty; }
/// <summary> /// Creates the trading order. /// </summary> /// <param name="order">The order.</param> public void CreateTradingOrder(ITradingOrder order) { try { var serviceCore = new PaymentServiceCore(); serviceCore.CreateTradingOrder(order); } catch (Exception ex) { throw ex; } }
/// <summary> /// Creates the trading order. /// </summary> /// <param name="order">The order.</param> public void CreateTradingOrder(ITradingOrder order) { try { using (var controller = new TradingOrderAccessController()) { controller.CreateTradingOrder(order); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Executes the transaction. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public override string CreateTransactionRequest(ITradingOrder order) { order.CheckNullObject("order"); this.TransactionInfo.CheckNullObject("TransactionInfo"); string token = this.GetAuthenticateToken(order); var request = GenerateBasicRequestParameters(); request.Add(AliServiceConfig.partner, this.TransactionInfo.Partner); request.Add(AliServiceConfig.service, AliServiceConfig.AliCellphoneExecuteTransactionService); request.Add(AliServiceConfig.sec_id, AliServiceConfig.SignType.ToUpper()); request.Add(AliServiceConfig.format, AliServiceConfig.Format); request.Add(AliServiceConfig.version, AliServiceConfig.Version); request.Add(AliServiceConfig.req_data, string.Format(AliServiceConfig.RequestTransactionData, token)); return(CreateTransactionDataRequest(GetPreSignedDictionary(request))); }
/// <summary> /// Executes the transaction. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public override string CreateTransactionRequest(ITradingOrder order) { order.CheckNullObject("order"); this.TransactionInfo.CheckNullObject("TransactionInfo"); string token = this.GetAuthenticateToken(order); var request = GenerateBasicRequestParameters(); request.Add(AliServiceConfig.partner, this.TransactionInfo.Partner); request.Add(AliServiceConfig.service, AliServiceConfig.AliCellphoneExecuteTransactionService); request.Add(AliServiceConfig.sec_id, AliServiceConfig.SignType.ToUpper()); request.Add(AliServiceConfig.format, AliServiceConfig.Format); request.Add(AliServiceConfig.version, AliServiceConfig.Version); request.Add(AliServiceConfig.req_data, string.Format(AliServiceConfig.RequestTransactionData, token)); return CreateTransactionDataRequest(GetPreSignedDictionary(request)); }
/// <summary> /// Executes the transaction. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public override string CreateTransactionRequest(ITradingOrder order) { order.CheckNullObject("order"); this.TransactionInfo.CheckNullObject("TransactionInfo"); var request = GenerateBasicRequestParameters(); request.Add(AliServiceConfig.partner, this.TransactionInfo.Partner); request.Add(AliServiceConfig.service, AliServiceConfig.AliWebExecuteTransactionService); request.Add(AliServiceConfig.PaymentType, ((int)order.PaymentInfo.PaymentType).ToString()); request.Add(AliServiceConfig.notify_url, this.TransactionInfo.NotifyUrl); request.Add(AliServiceConfig.return_url, this.TransactionInfo.CallBackUrl); request.Add(AliServiceConfig.seller_email, this.TransactionInfo.SellerAccountName); request.Add(AliServiceConfig.out_trade_no, order.Key.ToString()); request.Add(AliServiceConfig.subject, order.Subject); request.Add(AliServiceConfig.total_fee, order.TotalFee.ToString()); request.Add(AliServiceConfig.body, order.PromotionDescription); request.Add(AliServiceConfig.exter_invoke_ip, order.ClientIp); return CreateTransactionDataRequest(this.GetPreSignedDictionary(request)); ; }
/// <summary> /// Executes the transaction. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public override string CreateTransactionRequest(ITradingOrder order) { order.CheckNullObject("order"); this.TransactionInfo.CheckNullObject("TransactionInfo"); var request = GenerateBasicRequestParameters(); request.Add(AliServiceConfig.partner, this.TransactionInfo.Partner); request.Add(AliServiceConfig.service, AliServiceConfig.AliWebExecuteTransactionService); request.Add(AliServiceConfig.PaymentType, ((int)order.PaymentInfo.PaymentType).ToString()); request.Add(AliServiceConfig.notify_url, this.TransactionInfo.NotifyUrl); request.Add(AliServiceConfig.return_url, this.TransactionInfo.CallBackUrl); request.Add(AliServiceConfig.seller_email, this.TransactionInfo.SellerAccountName); request.Add(AliServiceConfig.out_trade_no, order.Key.ToString()); request.Add(AliServiceConfig.subject, order.Subject); request.Add(AliServiceConfig.total_fee, order.TotalFee.ToString()); request.Add(AliServiceConfig.body, order.PromotionDescription); request.Add(AliServiceConfig.exter_invoke_ip, order.ClientIp); return(CreateTransactionDataRequest(this.GetPreSignedDictionary(request)));; }
public static TradingOrderEntity Create(ITradingOrder src) { var entity = new TradingOrderEntity { TakerPositionId = src.TakerPositionId, TakerOrderId = src.TakerOrderId, CoreSide = src.CoreSide, CoreSymbol = src.CoreSymbol, ExecutionDuration = src.ExecutionDuration, ExecutionTimestamp = src.ExecutionTimestamp, TakerAction = src.TakerAction, TakerCounterpartyId = src.TakerCounterpartyId, TakerExternalSymbol = src.TakerExternalSymbol, TakerRequestedPrice = src.TakerRequestedPrice, TimeForceCondition = src.TimeForceCondition, Volume = src.Volume }; entity.PartitionKey = entity.GetPartitionKey(); entity.RowKey = entity.GetRowKey(); return(entity); }
/// <summary> /// Gets the authorization token. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public virtual string GetAuthenticateToken(ITradingOrder order) { return string.Empty; }
/// <summary> /// Executes the transaction. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public abstract string CreateTransactionRequest(ITradingOrder order);
public override string CreateTransactionRequest(ITradingOrder order) { throw new NotImplementedException(); }
/// <summary> /// Gets the authorization token. /// </summary> /// <param name="order">The order.</param> /// <returns>System.String.</returns> public virtual string GetAuthenticateToken(ITradingOrder order) { return(string.Empty); }