コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: AliMobilePayment.cs プロジェクト: twxstar/Payment
        /// <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));
        }
コード例 #3
0
ファイル: AliMobilePayment.cs プロジェクト: twxstar/Payment
        /// <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)));
        }
コード例 #4
0
 /// <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);
 }
コード例 #5
0
 /// <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);
 }
コード例 #6
0
ファイル: PaymentClient.cs プロジェクト: twxstar/Payment
 /// <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;
 }
コード例 #7
0
ファイル: PaymentClient.cs プロジェクト: twxstar/Payment
 /// <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;
 }
コード例 #8
0
ファイル: PaymentService.cs プロジェクト: twxstar/Payment
 /// <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;
     }
 }
コード例 #9
0
ファイル: PaymentService.cs プロジェクト: twxstar/Payment
 /// <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;
     }
 }
コード例 #10
0
        /// <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;
            }
        }
コード例 #11
0
ファイル: PaymentServiceCore.cs プロジェクト: twxstar/Payment
        /// <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;
            }
        }
コード例 #12
0
ファイル: AliMobilePayment.cs プロジェクト: twxstar/Payment
        /// <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)));
        }
コード例 #13
0
ファイル: AliMobilePayment.cs プロジェクト: twxstar/Payment
        /// <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));
        }
コード例 #14
0
ファイル: AliWebPayment.cs プロジェクト: twxstar/Payment
        /// <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)); ;
        }
コード例 #15
0
ファイル: AliWebPayment.cs プロジェクト: twxstar/Payment
        /// <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);
        }
コード例 #17
0
ファイル: BaseAliPayment.cs プロジェクト: twxstar/Payment
 /// <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;
 }
コード例 #18
0
 /// <summary>
 /// Executes the transaction.
 /// </summary>
 /// <param name="order">The order.</param>
 /// <returns>System.String.</returns>
 public abstract string CreateTransactionRequest(ITradingOrder order);
コード例 #19
0
ファイル: BaseAliPayment.cs プロジェクト: twxstar/Payment
 /// <summary>
 /// Executes the transaction.
 /// </summary>
 /// <param name="order">The order.</param>
 /// <returns>System.String.</returns>
 public abstract string CreateTransactionRequest(ITradingOrder order);
コード例 #20
0
 public override string CreateTransactionRequest(ITradingOrder order)
 {
     throw new NotImplementedException();
 }
コード例 #21
0
ファイル: PaypalPayment.cs プロジェクト: twxstar/Payment
 public override string CreateTransactionRequest(ITradingOrder order)
 {
     throw new NotImplementedException();
 }
コード例 #22
0
 /// <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);
 }