public PaymentTransaction(Wallet wallet, decimal amount, PaymentTransactionType type)
 {
     Wallet      = wallet;
     WalletId    = Wallet.Id;
     Amount      = amount;
     DateCreated = DateTime.Now;
     Type        = type;
 }
Ejemplo n.º 2
0
        private PaymentTransactionWithXp GetLastSuccessfulTransactionOfType(PaymentTransactionType type, PaymentWithXp payment)
        {
            var authorizationTransaction = payment.Transactions
                                           .Where(x => x.Type == type.ToString())
                                           .OrderBy(x => x.DateExecuted)
                                           .LastOrDefault(t => t.Succeeded);

            return(authorizationTransaction);
        }
Ejemplo n.º 3
0
        public string SubmitExpressOrder(PaymentTransactionType paymenttransaction)
        {
            CK1 clint   = new CK1();
            var request = new ExpressCompleteOrderRequest()
            {
                UserKey    = CK1Config.getUserKey(),
                Token      = CK1Config.getToken(),
                ActionType = EnumActionType.Submit,
                OrderSign  = paymenttransaction.OrderSign,
            };
            ExpressCompleteOrderResponse response = clint.ExpressCompleteOrder(request);

            return(response.Message);
        }
Ejemplo n.º 4
0
        public string SubmitExpressOrder(PaymentTransactionType paymenttransaction)
        {
            ShipRateSOAP s = new ShipRateSOAP();
            UpdateOrderStatusInfoArray updateOrderRequestInfo = new UpdateOrderStatusInfoArray();

            updateOrderRequestInfo.orderStatus = "sumbmitted";

            string message = "";
            // string time;
            DateTime time;
            var      request = s.updateOrderStatus(
                HR,
                updateOrderRequestInfo,
                paymenttransaction.OrderSign,
                out message,
                out time
                );

            return(message);
        }
        public static Payment ToPayment(PaymentTransactionType tx)
        {
            var steamId = tx.PaymentItemInfo
                          .PaymentItem.First()
                          .Options.First(o => o.name == "SteamId").value;

            var payment = new Payment()
            {
                GrossAmount   = decimal.Parse(tx.PaymentInfo.GrossAmount.value),
                FeeAmount     = decimal.Parse(tx.PaymentInfo.FeeAmount.value),
                Currency      = tx.PaymentInfo.GrossAmount.currencyID.Value,
                PayerName     = tx.PayerInfo.Payer,
                ProductId     = ProductType.Donation,
                PayedAt       = DateTime.Parse(tx.PaymentInfo.PaymentDate),
                TransactionId = tx.PaymentInfo.TransactionID,
                SteamId       = steamId,
                Quantity      = 1
            };

            return(payment);
        }
Ejemplo n.º 6
0
        private void processResponse(PayPalAPIInterfaceServiceService service, GetTransactionDetailsResponseType response)
        {
            HttpContext CurrContext = HttpContext.Current;

            CurrContext.Items.Add("Response_apiName", "GetTransactionDetails");
            CurrContext.Items.Add("Response_redirectURL", null);
            CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
            CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());

            Dictionary <string, string> keyResponseParameters = new Dictionary <string, string>();

            keyResponseParameters.Add("Correlation Id", response.CorrelationID);
            keyResponseParameters.Add("API Result", response.Ack.ToString());

            if (response.Ack.Equals(AckCodeType.FAILURE) ||
                (response.Errors != null && response.Errors.Count > 0))
            {
                CurrContext.Items.Add("Response_error", response.Errors);
            }
            else
            {
                CurrContext.Items.Add("Response_error", null);
                PaymentTransactionType transactionDetails = response.PaymentTransactionDetails;
                keyResponseParameters.Add("Payment receiver", transactionDetails.ReceiverInfo.Receiver);
                keyResponseParameters.Add("Payer", transactionDetails.PayerInfo.Payer);
                keyResponseParameters.Add("Payment date", transactionDetails.PaymentInfo.PaymentDate);
                keyResponseParameters.Add("Payment status", transactionDetails.PaymentInfo.PaymentStatus.ToString());
                keyResponseParameters.Add("Gross amount",
                                          transactionDetails.PaymentInfo.GrossAmount.value + transactionDetails.PaymentInfo.GrossAmount.currencyID.ToString());

                if (transactionDetails.PaymentInfo.SettleAmount != null)
                {
                    keyResponseParameters.Add("Settlement amount",
                                              transactionDetails.PaymentInfo.SettleAmount.value + transactionDetails.PaymentInfo.SettleAmount.currencyID.ToString());
                }
            }
            CurrContext.Items.Add("Response_keyResponseObject", keyResponseParameters);
            Server.Transfer("../APIResponse.aspx");
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Constructor
        /// </summary>
        public PaymentRequest(PaymentTransactionType transactionType, string transactionCode, decimal amount, string description,
            Address billingAddress, Address shippingAddress,
            PaymentCard card, string cardNumber, string cardSecurityCode,
            string telephoneNumber, string emailAddress,
            string clientIpAddress)
        {
            TransactionType = transactionType;
            TransactionCode = transactionCode;
            Amount = amount;
            Description = description;

            BillingAddress = billingAddress;
            ShippingAddress = shippingAddress;

            Card = card;
            CardNumber = cardNumber;
            CardSecurityCode = cardSecurityCode;

            TelephoneNumber = telephoneNumber;
            EmailAddress = emailAddress;

            ClientIpAddress = clientIpAddress;
        }
Ejemplo n.º 8
0
 public InternalTransferPaymentTransaction(Wallet wallet, Wallet secondWallet, decimal amount, PaymentTransactionType type, string internalTransferId) : base(wallet, amount, type)
 {
     SecondWallet       = secondWallet;
     SecondWalletId     = SecondWallet.Id;
     InternalTransferId = internalTransferId;
 }
Ejemplo n.º 9
0
        public ShipOrder AddOutboundOrder(DispatchRequest dispatchrequest, PaymentTransactionType paymenttransaction)
        {
            ShipOrder order = new ShipOrder();
            CK1       clint = new CK1();

            #region 生成包裹

            var productList = new List <OutStoreProduct>();

            foreach (var item in paymenttransaction.PaymentItemInfo.PaymentItem)
            {
                productList.Add(new OutStoreProduct()
                {
                    SKU      = item.Association.Product.Sku,
                    Quantity = Convert.ToInt32(item.Quantity),
                });
            }

            var packageList = new List <OutStorePackage>();
            packageList.Add(new OutStorePackageNew()
            {
                ProductList   = productList.ToArray(),
                ShipToAddress = new ShipToAddress()
                {
                    Contact  = dispatchrequest.ShiptoName,
                    Country  = dispatchrequest.ShipToCountryName,
                    PostCode = dispatchrequest.ShipToZip,
                    Province = dispatchrequest.ShipToState,
                    Street1  = dispatchrequest.ShipToStreet,
                    Street2  = dispatchrequest.ShipToStreet2,
                    City     = dispatchrequest.ShiptoCity,
                },
                Shipping     = OutStoreShipping.None,
                ShippingV2_1 = ConvertOutStoreShippingV2_1(dispatchrequest.Express.ToUpper())
            });


            #endregion 生成包裹

            var request = new OutStoreAddOrderRequest()
            {
                UserKey     = CK1Config.getUserKey(),
                Token       = CK1Config.getToken(),
                Submit      = false,
                OrderDetail = new OutStoreOrder()
                {
                    State       = OrderOutState.Initial,
                    PackageList = packageList.ToArray(),
                },
            };

            switch (dispatchrequest.Warehouse.ToUpper())
            {
            case "US":
                request.OrderDetail.Warehouse = EnumWarehouse.US;
                break;

            case "AU":
                request.OrderDetail.Warehouse = EnumWarehouse.AU;
                break;

            case "UK":
                request.OrderDetail.Warehouse = EnumWarehouse.UK;
                break;

            case "NJ":
                request.OrderDetail.Warehouse = EnumWarehouse.NJ;
                break;

            case "DE":
                request.OrderDetail.Warehouse = EnumWarehouse.DE;
                break;
            }

            request.Submit = false;
            var response = clint.OutStoreAddOrder(request);
            try
            {
                order = new ShipOrder
                {
                    Message   = response.Message,
                    OrderSign = response.OrderSign
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }
Ejemplo n.º 10
0
        public ShipOrder AddExpressOrder(DispatchRequest dispatchrequest, PaymentTransactionType paymenttransaction)
        {
            #region 生成包裹

            var product = new List <ExpressProduct>();

            foreach (var item in paymenttransaction.PaymentItemInfo.PaymentItem)
            {
                product.Add(new ExpressProduct
                {
                    CustomsTitleCN = "怀表",
                    CustomsTitleEN = "POCKET WATCH",
                    Quantity       = Convert.ToInt32(item.Quantity),
                    SKU            = item.Association.Product.Sku,
                    Weight         = item.Association.Product.Weight,
                    DeclareValue   = dispatchrequest.goodsDeclareWorth / paymenttransaction.PaymentItemInfo.PaymentItem.Count
                });
            }


            var packageList = new List <ExpressPackage>();
            packageList.Add(new ExpressPackage
            {
                Custom        = dispatchrequest.Custom,
                ShipToAddress = new ShipToAddress
                {
                    Contact  = dispatchrequest.ShiptoName,
                    Street1  = dispatchrequest.ShipToStreet,
                    Street2  = dispatchrequest.ShipToStreet2,
                    City     = dispatchrequest.ShiptoCity,
                    Province = dispatchrequest.ShipToState,
                    Country  = dispatchrequest.ShipToCountryName,
                    PostCode = dispatchrequest.ShipToZip,
                },
                Packing = new Evisou.Ims.Contract.chukou1.Packing
                {
                    Height = dispatchrequest.Height,
                    Length = dispatchrequest.Length,
                    Width  = dispatchrequest.Width,
                },
                Remark      = "备注信息",
                Status      = OrderExpressState.Initial,
                TrackCode   = "",
                Weight      = dispatchrequest.goodsWeight,
                ProductList = product.ToArray(),
            });

            var orderDetail = new ExpressOrder
            {
                IsTracking  = false,
                Location    = "GZ",
                Remark      = "测试订单",
                PackageList = packageList.ToArray(),
            };

            #endregion

            ShipOrder order   = new ShipOrder();
            var       clint   = new CK1();
            var       request = new ExpressAddOrderNewRequest
            {
                UserKey        = CK1Config.getUserKey(),
                Token          = CK1Config.getToken(),
                Submit         = false,
                OrderDetail    = orderDetail,
                ExpressTypeNew = dispatchrequest.Express,
            };

            ExpressAddOrderResponse response = clint.ExpressAddOrderNew(request);
            try
            {
                order = new ShipOrder
                {
                    Message   = response.Message,
                    OrderSign = response.OrderSign
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }
Ejemplo n.º 11
0
        private async Task <PaymentWithXp> CreatePaymentTransaction(string orderID, PaymentWithXp payment, PaymentTransactionType type, CCTransactionResult transaction)
        {
            var updatedPayment = await _oc.Payments.CreateTransactionAsync <PaymentWithXp>(OrderDirection.All, orderID, payment.ID, new PaymentTransactionWithXp()
            {
                ID            = transaction.TransactionID,
                Amount        = payment.Amount,
                DateExecuted  = DateTime.Now,
                ResultCode    = transaction.AuthorizationCode,
                ResultMessage = transaction.Message,
                Succeeded     = transaction.Succeeded,
                Type          = type.ToString(),
                xp            = new PaymentTransactionXp
                {
                    TransactionDetails = transaction,
                }
            });

            return(updatedPayment);
        }
Ejemplo n.º 12
0
        public ShipOrder AddExpressOrder(DispatchRequest dispatchrequest, PaymentTransactionType paymenttransaction)
        {
            //string service = form["Service"].ToUpper();

            ShipRateSOAP             s = new ShipRateSOAP();
            addOrderRequestInfoArray addOrderRequestInfo = new addOrderRequestInfoArray();

            addOrderRequestInfo.shippingMethod   = dispatchrequest.Express;
            addOrderRequestInfo.recipientCountry = dispatchrequest.ShipToCountryName;
            addOrderRequestInfo.recipientName    = dispatchrequest.ShiptoName;
            addOrderRequestInfo.recipientAddress = dispatchrequest.ShipToStreet;
            addOrderRequestInfo.recipientZipCode = dispatchrequest.ShipToZip;
            addOrderRequestInfo.recipientCity    = dispatchrequest.ShiptoCity;
            addOrderRequestInfo.recipientState   = string.IsNullOrEmpty(dispatchrequest.ShipToState) ? dispatchrequest.ShiptoCity : dispatchrequest.ShipToState;

            addOrderRequestInfo.orderStatus      = "confirmed";//"preprocess";
            addOrderRequestInfo.recipientPhone   = "123456963";
            addOrderRequestInfo.recipientEmail   = paymenttransaction.PayerInfo.Payer;
            addOrderRequestInfo.goodsDescription = dispatchrequest.goodsDescription;
            addOrderRequestInfo.goodsQuantity    = "1";                                           //
            //addOrderRequestInfo.goodsQuantitySpecified = true;
            addOrderRequestInfo.goodsDeclareWorth = dispatchrequest.goodsDeclareWorth.ToString(); //
            //addOrderRequestInfo.goodsDeclareWorthSpecified = true;
            addOrderRequestInfo.isReturn = "1";
            addOrderRequestInfo.evaluate = (dispatchrequest.goodsDeclareWorth + 1M).ToString();
            //addOrderRequestInfo.evaluateSpecified = true;

            List <goodsDetailsArray> list = new List <goodsDetailsArray>();

            list.Add(new goodsDetailsArray
            {
                detailWorth    = dispatchrequest.goodsDeclareWorth.ToString(),
                detailQuantity = "1",
                // detailQuantitySpecified = true,
                detailDescription = dispatchrequest.goodsDescription,
                //detailWorthSpecified = true
            });
            addOrderRequestInfo.goodsDetails = list.ToArray <goodsDetailsArray>();

            string    customerOrderNo, operatingTime, orderActionStatus, exceptionCode, notifyUrl, note, alert, area, trackingNumber;
            ShipOrder order = new ShipOrder();

            /*  var request = s.addOrder(
             *    HR,
             *    addOrderRequestInfo,
             *    out customerOrderNo,
             *    out operatingTime,
             *    out orderActionStatus,
             *    out exceptionCode,
             *    out notifyUrl,
             *    out note,
             *    out alert
             *    );
             * order = new ShipOrder
             * {
             *    Message = note,
             *    OrderSign = request.ToString()
             * };
             *
             * order.Message = note;
             * order.OrderSign =request??request.ToString();
             *
             * var aa = order;*/
            try
            {
                var request = s.addOrder(
                    HR,
                    addOrderRequestInfo,
                    out customerOrderNo,
                    out operatingTime,
                    out orderActionStatus,
                    out exceptionCode,
                    out notifyUrl,
                    out note,
                    out alert,
                    out area,
                    out trackingNumber
                    );

                order = new ShipOrder
                {
                    Message   = note,
                    OrderSign = request ?? request.ToString()
                };
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(order);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Get transaction type
 /// </summary>
 /// <param name="transactionType"></param>
 /// <returns></returns>
 private static string GetTransactionType(PaymentTransactionType transactionType)
 {
     switch (transactionType)
     {
         case PaymentTransactionType.Payment:
             return "PAYMENT";
         case PaymentTransactionType.Deferred:
             return "DEFERRED";
         case PaymentTransactionType.Authenticate:
             return "AUTHENTICATE";
         default:
             throw new NotSupportedException(string.Format("The transaction type '{0}' is not currently supported by the Direct SagePay payment gateway.", transactionType));
     }
 }