Payment Plugin 2.1 - How to make a post

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 12 años
Hi

How do I make a post in the new 2.1?

Below is a working code in 2.1 but I have to use the "old" 1.9 reference: using NopSolutions.NopCommerce.Common.Utils;
I would like to avoid this but I cant get it to work with webrequest.

public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
        {
            RemotePost post = new RemotePost();
            post.FormName = "FlexWin";
            post.Url = _DIBSPaymentSettings.gatewayURL;
            if (_DIBSPaymentSettings.usesandbox)
            {
               post.Add("test", "yes");
            }
            post.Add("uniqueoid", "yes");
            var orderTotal = Math.Round(postProcessPaymentRequest.Order.OrderTotal, 2);
            var ordertotal2 = orderTotal * 100;
            int amount = Convert.ToInt32(ordertotal2);  
            int currencyCode = 208;
            string itemurl =  _DIBSPaymentSettings.storeURL;
            int merhcantID = Convert.ToInt32( _DIBSPaymentSettings.MerchantId);
            int ordernumber = Convert.ToInt32( postProcessPaymentRequest.Order.Id.ToString("D2"));
            string continueurl = itemurl + "/Plugins/PaymentDIBS/PDTHandler";
            string cancelurl =  itemurl + "/Plugins/PaymentDIBS/CancelOrder";
            string md5secret = _DIBSPaymentSettings.MD5Secret;
            string md5secret2 = _DIBSPaymentSettings.MD5Secret2;
            string stringToMd5 = string.Concat(md5secret, md5secret2, merhcantID,
                 ordernumber, currencyCode, amount);
            string md5check = CalcMD5Key(merhcantID, ordernumber, currencyCode, amount);
            post.Add("lang", "da");
            post.Add("currency", currencyCode.ToString());
            post.Add("color", "blue");
            post.Add("decorator", "default");
            post.Add("merchant", merhcantID.ToString());
            post.Add("orderid", ordernumber.ToString());
            post.Add("amount", amount.ToString());
            post.Add("md5key", md5check);
            post.Add("accepturl", continueurl);
            post.Add("cancelurl", cancelurl);
            
        post.Post();

Br

TCH
Hace 12 años
Don't do it. Just copy 'RemotePost' into new v2.10 and use it.

P.S. I'll add it in upcoming v2.20 version
Hace 12 años
Thanks I´ll do that :-)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.