Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="posRequest"></param>
        /// <param name="refundable">for void & refund</param>
        /// <param name="type">sales, void, refund</param>
        /// <returns></returns>
        private GVPSRequest CreateSalesInstance(PosRequest posRequest, bool refundable = false, string type = "sales")
        {
            string SecurityData = GetSHA1(_password + String.Format("000{0}", _terminalId))
                                  .ToUpper(); //_terminalId'nin 9 haneye tamamlanması gerekiyor.

            string _HashData = !refundable?
                               GetSHA1(posRequest.OrderId + _terminalId + posRequest.CardNumber + posRequest.Amount + SecurityData).ToUpper() :
                                   GetSHA1(posRequest.OrderId + _terminalId + posRequest.Amount + SecurityData).ToUpper();

            var gvpRequest = new GVPSRequest();

            gvpRequest.Mode    = _workingMode;
            gvpRequest.Version = GVPVERSION;

            gvpRequest.Terminal = new Terminal()
            {
                ID         = _terminalId,
                UserID     = posRequest.UserId,
                MerchantID = _merchantId,
                ProvUserID = !refundable ? _provisionUser : "******",
                HashData   = _HashData
            };

            gvpRequest.Customer = new Customer()
            {
                EmailAddress = posRequest.UserEmail,
                IPAddress    = posRequest.UserIp
            };


            gvpRequest.Card = !refundable ?
                              new Card()
            {
                Number     = posRequest.CardNumber,
                CVV2       = posRequest.Cvc2,
                ExpireDate = String.Format("{0}{1}", posRequest.Month, posRequest.Year)     //MMYY
            } : new Card();

            gvpRequest.Order = new Order()
            {
                OrderID = posRequest.OrderId,
                GroupID = string.Empty
            };

            gvpRequest.Transaction = new Transaction()
            {
                Type           = "sales",
                CurrencyCode   = posRequest.CurrencyCode,
                MotoInd        = !refundable ? "N" : "H",
                InstallmentCnt = posRequest.InstallmentCount == 0 ? String.Empty :
                                 posRequest.InstallmentCount.ToString(),
                // 10,05 -> 1005
                Amount = posRequest.Amount,
                CardholderPresentCode = "0"
            };

            return(gvpRequest);
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="posRequest"></param>
        /// <param name="refundable">for void & refund</param>
        /// <param name="type">sales, void, refund</param>
        /// <returns></returns>
        private GVPSRequest CreateSalesInstance(PosRequest posRequest, bool refundable = false, string type = "sales")
        {
            string SecurityData = GetSHA1(_password + String.Format("000{0}", _terminalId))
                            .ToUpper(); //_terminalId'nin 9 haneye tamamlanması gerekiyor.

            string _HashData = !refundable ?
                            GetSHA1(posRequest.OrderId + _terminalId + posRequest.CardNumber + posRequest.Amount + SecurityData).ToUpper() :
                            GetSHA1(posRequest.OrderId + _terminalId + posRequest.Amount + SecurityData).ToUpper();

            var gvpRequest = new GVPSRequest();
            gvpRequest.Mode = _workingMode;
            gvpRequest.Version = GVPVERSION;

            gvpRequest.Terminal = new Terminal()
            {
                ID = _terminalId,
                UserID = posRequest.UserId,
                MerchantID = _merchantId,
                ProvUserID = !refundable ? _provisionUser : "******",
                HashData = _HashData
            };

            gvpRequest.Customer = new Customer()
            {
                EmailAddress = posRequest.UserEmail,
                IPAddress = posRequest.UserIp
            };

            gvpRequest.Card = !refundable ?
                new Card()
                {
                    Number = posRequest.CardNumber,
                    CVV2 = posRequest.Cvc2,
                    ExpireDate = String.Format("{0}{1}", posRequest.Month, posRequest.Year) //MMYY
                } : new Card();

            gvpRequest.Order = new Order()
            {
                OrderID = posRequest.OrderId,
                GroupID = string.Empty
            };

            gvpRequest.Transaction = new Transaction()
            {
                Type = "sales",
                CurrencyCode = posRequest.CurrencyCode,
                MotoInd = !refundable ? "N" : "H",
                InstallmentCnt = posRequest.InstallmentCount == 0 ? String.Empty :
                                            posRequest.InstallmentCount.ToString(),
                // 10,05 -> 1005
                Amount = posRequest.Amount,
                CardholderPresentCode = "0"
            };

            return gvpRequest;
        }