使用dotnetcharge进行3D安全处理问题

时间:2010-01-25 11:26:49

标签: asp.net vb.net protx

我正在将许多电子通讯网站集成到不同的银行,并决定最简单的方法是添加到dotnetcharge(www.dotnetcharge.com)库中。它工作得很好,意味着我可以为每种银行类型和交易保留大部分代码。但是,他们的支持有点糟糕(发送了4封电子邮件,1封回复),我对3D Secure问题感到非常困惑。

有没有人有dotnetcharge和3D Secure的经验?我已经设置了MerchantURL并且实际出现了3D Secure屏幕 - 但我不确定如何使系统正常“流动”。有没有人有正确方向的代码示例甚至指针?如果做不到,有人知道如何做出支持回应!

这种特殊的整合与SagePay有关,SagePay也有上帝可怕的文档和支持。

参考代码如下;

        Dim Amount As Decimal = ordertotal
        ' ApplySecure3D options:
        ' 0 = If 3D-Secure checks are possible and rules allow, perform the checks and apply the authorization rules. 
        ' 1 = Force 3D-Secure checks for this transaction only (if your account is 3D-enabled) and apply rules for authorization.
        ' 2 = Do not perform 3D-Secure checks for this transaction only and always authorize.
        ' 3 = Force 3D-Secure checks for this transaction (if your account is 3D-enabled) but ALWAYS obtain an auth code, irrespective of rule base.
        Dim ProtxLogin As String = "xxx"
        Dim ProtxPassword As String = "xxx"
        Dim ProtxApply3DSecure As Integer = 1
        Dim ProtxMerchantURL As String = "https://www.mydomain.com/processing/"

        Dim Number As String = txtCardNo.Text '//luhn/mod10 here.
        Dim AVS As String = txtCVN.Text
        Dim DD As String = "01"
        Dim MM As String = ddlValidTo_month.SelectedValue.ToString()
        Dim YY As String = ddlValidTo_year.SelectedValue.ToString()

        Dim ProcessingResult As Integer = 0
        Dim Protx As New dotnetCHARGE.CC()

        Protx.Login = ProtxLogin
        Protx.Password = ProtxPassword
        Protx.ApplySecure3D = ProtxApply3DSecure
        Protx.MerchantUrl = ProtxMerchantURL

        Dim AVSResponse As String = ""
        Dim CVV2 As String = ""

        Protx.OrderID = GoogleOrderNumber
        Protx.Month = MM
        Protx.Year = YY
        Protx.TransactionType = dotnetCHARGE.TransactionType.Sale
        Protx.Amount = ordertotal
        Protx.Number = Number
        Protx.Currency = "GBP"
        Protx.CustomerID = CustomerId
        '//loads of params removed for brevity
        Protx.ClientIP = Request.UserHostAddress.ToString()
        Protx.CardType = ddlCardType.SelectedValue.ToString()
        Protx.Description = "My Order"
        Protx.Code = AVS
        Protx.TestMode = True
        Protx.TransactionType = dotnetCHARGE.TransactionType.Sale

        ProcessingResult = Protx.Charge(Processor.Protx)

帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

我决定回到这个问题来解释最终结果是如何实现的。希望有些SO用户会发现它很有用。

要获得正确的“流量”,您需要两页。您实际上无法在单个页面中执行整个事务处理。第一页将有卡片条目详细信息;卡号,有效期,CVN,账单地址等。在点击支付/提交时,我建议将交易保存到您的数据源,作为“未处理”或类似的东西。保存完所有详细信息后 - 目前尚未完成任何卡片处理 - 使用HTTPS重定向到第二页。

根据您的设置方式,您的客户可能永远不会知道此页面存在。第二页将在其中包含.netCharge代码作为我的问题并处理该卡。启用3D安全(.Apply3DSecure = 1)后,客户将被重定向到他们的银行以输入更多详细信息,它将返回到第二页。它不像回发或刷新,所以不要担心两次返回页面处理。您将收到3种可能的状态中的1种;授权,错误和拒绝。您的页面可以重定向到更多必要的页面(因此客户知道这个中间页面存在)或直接在此处理页面上显示结果。

有一个最终的'陷阱',你会很快看到。第二页(处理页面)需要卡片细节才能实际处理。你不能只是在表格甚至是查询字符串上传递卡片细节,这是不负责任的。 .netCharge附带.Encrypt和.Decrypt函数;只需将值传递给加密和某种哈希,并在第一页上临时保存这些详细信息,在第二页上读取和解密,然后删除它们。这意味着细节是安全的,在大多数情况下保存的时间少于5秒,并且因为它们被销毁而没有曝光。

我希望这会有所帮助 - 如果有人有任何问题,请给我一个大喊。