Este es el código:
Option Strict On
Imports System
Imports System.IO
Imports DotNetNuke.Common
Imports DotNetNuke
Imports System.Globalization
Imports DotNetNuke.Entities.Users
Imports System.Collections.Specialized
Imports System.Text
Imports System.Text.RegularExpressions
Imports DotNetNuke.Common.Utilities
Imports System.Web.Security
Namespace CATALooK
Public Class DeltaPayCheckout
Inherits Framework.PageBase
#Region " Vom Web Form Designer generierter Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'CODEGEN: This method call is required by the Web Form Designer
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'This call is required by the Web Form Designer.
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim OrderID As Integer = 0
If Not Request.QueryString("OrderID") Is Nothing Then
OrderID = Convert.ToInt32(Request.QueryString("OrderID"))
End If
Dim _StoreAdminInfo As New StoreAdminInfo(PortalSettings.PortalId)
_StoreAdminInfo.InjectPaymentMethodInfo(OrderID)
Dim objUserInfo As UserInfo = UserProfileController.GetCurrentUserInfo(PortalSettings.PortalId)
Dim FieldCollection As New NameValueCollection
Dim key As String
Dim gst_exempt_fields As String = ""
Dim objPOSelController As New POSelController
Dim numero_pedido As String
Dim total_pedido As String
Dim strDatosFirma As String
Dim strFirma As String
Dim strClaveComercio As String = _StoreAdminInfo.CCPassword
Dim strCodigoComercio As String = _StoreAdminInfo.CCUserName
Dim strDs_Merchant_Order As String = OrderID.ToString
Dim str_Merchant_MerchantURL As String
Dim strDS_Merchant_TransactionType As String = _StoreAdminInfo.CCTransactionType
'cart
'cart
Dim cart As ShoppingCartDB = New ShoppingCartDB
' Calculate shopping cart ID
Dim cartId As String = cart.GetShoppingCartId()
Dim objCartPrice As New CartPriceInfo
Dim objCartPrices As New CartPriceController
objCartPrice = objCartPrices.GetCartPrice(objUserInfo.UserID, PortalSettings.PortalId)
With _StoreAdminInfo
If Not String.IsNullOrEmpty(.CCAdditionalParameters) Then
Dim Separator() As String = {ControlChars.CrLf, ControlChars.Lf}
Dim Selections() As String = .CCAdditionalParameters.Split(Separator, StringSplitOptions.RemoveEmptyEntries)
Dim i As Integer
For i = 0 To Selections.Length - 1
If Selections(i) <> "" AndAlso Selections(i).IndexOf("=") > -1 Then
Dim param() As String = Selections(i).Split("="c)
FieldCollection.Add(param(0), param(1))
End If
Next
End If
'1 <input type=HIDDEN name=Ds_Merchant_Amount value="<%=strDs_Merchant_Amount%>">
total_pedido = Int(Round(objCartPrice.CartTotal, 2) * 100).ToString
FieldCollection.Add("Ds_Merchant_Amount", total_pedido)
numero_pedido = OrderID.ToString & "-" & cartId
numero_pedido = "1100" & numero_pedido
'2 <input type=HIDDEN name=Ds_Merchant_Currency value="<%=strDs_Merchant_Currency%>">
FieldCollection.Add("Ds_Merchant_Currency", "978")
'3 <input type=HIDDEN name=Ds_Merchant_Order value="<%=strDs_Merchant_Order%>">
FieldCollection.Add("Ds_Merchant_Order", numero_pedido)
'4
FieldCollection.Add("Ds_Merchant_ProductDescription", "Compra en: " & .PayPalCartName)
'5
FieldCollection.Add("Ds_Merchant_Titular", objUserInfo.Profile.FirstName & " " & objUserInfo.Profile.LastName)
'7 <input type=HIDDEN name=Ds_Merchant_MerchantCode value="<%=strDs_Merchant_MerchantCode%>">
FieldCollection.Add("Ds_Merchant_MerchantCode", strCodigoComercio)
'6
FieldCollection.Add("Ds_Merchant_UrlOK", .GetModuleURL(PortalSettings.PortalId, AddHTTP(GetDomainName(Request), PortalSettings.PortalId) & "/desktopmodules/CATALooKStore/DIBSPaymentWindowIPN.aspx" & "?catparams=" & OrderID.ToString & "p" & PortalSettings.PortalId.ToString & "p" & "order"))
'7
FieldCollection.Add("Ds_Merchant_UrlKO", str_Merchant_MerchantURL)
'8 Spanish
FieldCollection.Add("Ds_Merchant_ConsumerLanguage", "1")
'9 <input type=HIDDEN name=Ds_Merchant_TransactionType value="<%=strDs_Merchant_TransactionType%>">
FieldCollection.Add("Ds_Merchant_TransactionType", strDS_Merchant_TransactionType)
'10 <input type=HIDDEN name=Ds_Merchant_MerchantURL value="<%=strDs_Merchant_MerchantURL%>">
str_Merchant_MerchantURL = "http://www.solvo.teweb.es/desktopmodules/CATALooKStore/ProxyPayIPN.aspx"
FieldCollection.Add("Ds_Merchant_MerchantURL", str_Merchant_MerchantURL)
'Signature
strDatosFirma = total_pedido & numero_pedido & strCodigoComercio & "978" & strDS_Merchant_TransactionType & str_Merchant_MerchantURL & strClaveComercio
strFirma = FormsAuthentication.HashPasswordForStoringInConfigFile(strDatosFirma, "sha1")
'11 <input type=HIDDEN name=Ds_Merchant_MerchantSignature value="<%=strFirma%>">
FieldCollection.Add("Ds_Merchant_MerchantSignature", strFirma)
'12 <input type=HIDDEN name=Ds_Merchant_Terminal value="<%=strDs_Merchant_Terminal%>">
FieldCollection.Add("Ds_Merchant_Terminal", "1")
'
End With
Dim Url As String = Convert.ToString(IIf(_StoreAdminInfo.IsLicensed = False OrElse _StoreAdminInfo.CCTestMode, "https://sis-t.sermepa.es:25443/sis/realizarPago", "https://sis.sermepa.es/sis/realizarPago"))
Dim Method As String = "POST"
Dim FormName As String = "frmRemotePOST"
Response.Clear()
Response.Write("<html><head></head>")
Response.Write(String.Format("<body onload=""document.{0}.submit()"">", FormName))
Response.Write(String.Format("<form name=""{0}"" action=""{1}"" method=""{2}"">", FormName, Url, Method))
For Each key In FieldCollection.Keys
If FieldCollection(key) <> "" Then
Response.Write(String.Format("<input type=""HIDDEN"" name=""{0}"" value=""{1}"">", key, FieldCollection(key)))
End If
Next
Response.Write("</form>")
Response.Write("</body></html>")
System.Web.HttpContext.Current.Response.End()
End Sub