Quantcast
Viewing all articles
Browse latest Browse all 4081

New Post: Custom Payment Gateway for PayU

Hi Dave,

My new URL, http://[website]/[Checkoutpage]/stg/5/OrdId/[ORDERID]/PayUExit/RETURN/PayUReference/[REF], is working. I see that if I manually browse to it only the auto-response fires whereas if the provider does the post then GetCompletedHtml fires instead. With this I have completed the basic functionality for the PayU gateway provider. I still, however, need to test various use cases and misuse cases before declaring it 'done'.

I am also trying to implement a very simple 'subscribe' type of functionality, wherein a user can purchase a product which is a subscription. This product type will be detected in the GetCompletedHtml and react differently to the other products (which are all downloadable). The difference is that it will add a timespan to a user's subscription to a role, 'Subscribers' - when payment is confirmed. This role will allow us to either modify product pages with the 'buy' button, or modify the checkout page with the GetButtonHtml method. This would allow subscribers to purchase for free, or for modified prices.

If anyone's interested, here is some rough code which accomplishes the role-adding. Bare in mind the UpdateUserRole method seems to instead reset values, so I only use AddUserRole - which shows no signs of an issue with re-creating.
var objRoles = new DotNetNuke.Security.Roles.RoleController();
int portalID = DotNetNuke.Entities.Portals
     .PortalController.GetCurrentPortalSettings().PortalId;
int roleID = objRoles.GetRoleByName(portalID, "Subscribers").RoleID;
DotNetNuke.Entities.Users.UserRoleInfo sub = 
     objRoles.GetUserRole(portalID, objOInfo.UserID, roleID);

 foreach (NB_Store_OrderDetailsInfo detail in 
     objOCtrl.GetOrderDetailList(objOInfo.OrderID))
      if (detail.ItemDesc == "6 Month Subscription")
      {
           if (sub == null) // Create sub for 6 months
                objRoles.AddUserRole(portalID, objOInfo.UserID, roleID, 
                     DateTime.Now.AddMonths(6));
           // Add 6 months to current sub
           else objRoles.AddUserRole(portalID, objOInfo.UserID, roleID, 
                     sub.ExpiryDate.AddMonths(6));
           break;
      }

Viewing all articles
Browse latest Browse all 4081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>