protected virtual void ControlSaveSignature(SaveCommonPaymentRequest reqModel, SaveCommonPaymentResponse resModel, string secretKey)
 {
     if (resModel.Success)
     {
         resModel.ControlSignature(secretKey, reqModel.HashVersion);
     }
 }
        public SaveCommonPaymentResponse Save(SaveCommonPaymentRequest reqModel, string apiUrl, string secretKey)
        {
            reqModel.SetSignature(secretKey);

            var response = RestCallPost <SaveCommonPaymentResponse>(apiUrl, reqModel, secretKey, false);

            ControlSaveSignature(reqModel, response, secretKey);

            return(response);
        }
示例#3
0
        public ActionResult Save()
        {
            var request = new SaveCommonPaymentRequest
            {
                Version         = "1.0",
                ApiKey          = _apiKey,
                TransactionId   = Guid.NewGuid().ToString("N"),
                TransactionTime = "1443600845",
                Amount          = 5499,
                Description     = "E-ticaretÖdemesi",
                Currency        = "TRY",
                BasketItems     = new List <BasketItem>
                {
                    new BasketItem
                    {
                        Description = "BoyamaKalemSeti",
                        ProductCode = "7cefdf61-38cd-4b35-b5f0-4c98c5805d41",
                        Amount      = 8750,
                        VatRatio    = 18,
                        Count       = 1,
                        Url         = "http://www.ahmetmarket.com.tr/boyama-kalem-seti"
                    },
                    new BasketItem
                    {
                        Description = "BoyamaKitabı",
                        ProductCode = "7cefdf61-38cd-4b35-b5f0-4c98c5805d41",
                        Amount      = 2550,
                        VatRatio    = 18,
                        Count       = 3,
                        Url         = "http://www.ahmetmarket.com.tr/boyama-kitabi"
                    },
                    new BasketItem
                    {
                        Description = "KargoBedeli",
                        Amount      = 1000,
                        VatRatio    = 18,
                        Count       = 1
                    }
                },
                Customer = new Customer
                {
                    Name        = "Ahmet",
                    Surname     = "Mehmet",
                    Email       = "*****@*****.**",
                    PhoneNumber = "5337654321",
                    Code        = "7cefdf61-38cd-4b35-b5f0-4c98c5805d41",
                    IpAddress   = "127.0.0.1"
                },
                ShippingAddress = new ShippingAddress
                {
                    Name        = "Ahmet Mehmet",
                    Address     = "Kuştepe Mahallesi Mecidiyeköy Yolu Cad. No:12 Trump Towers Kule:2 Kat:11 ŞİŞLİ",
                    Country     = "Türkiye",
                    CountryCode = "TUR",
                    City        = "İstanbul",
                    CityCode    = "34",
                    ZipCode     = "34580"
                },
                InvoiceAddress = new InvoiceAddress
                {
                    Name        = "Ahmet Mehmet",
                    Address     = "Kuştepe Mahallesi Mecidiyeköy Yolu Cad. No:12 Trump Towers Kule:2 Kat:11 ŞİŞLİ",
                    Country     = "Türkiye",
                    CountryCode = "TUR",
                    City        = "İstanbul",
                    CityCode    = "34",
                    ZipCode     = "34580"
                },
                Extras = new List <Extra> {
                    new Extra {
                        Key = "INT_SPRS_KODU", Value = "spr_123456789"
                    }
                },
                HashVersion             = _hashVersion,
                AmountEditable          = true,
                CommissionAmountReflect = 1,
                HasInstallmentChoice    = true,
                ReturnUrl = _baseUrl + "/CommonPayment/Result"
            };

            var apiUrl = _commonPaymentApiUrl + "/commonpayments/save";

            var response = _commonPaymentProcessor.Save(request, apiUrl, _secretKey);

            var redirectUrl = _commonPaymentUrl + "/" + response.CommonPaymentUniqueId;

            return(Redirect(redirectUrl));
        }
示例#4
0
 protected override void ControlSaveSignature(SaveCommonPaymentRequest reqModel, SaveCommonPaymentResponse resModel, string secretKey)
 {
 }