locked
shopping carts site in asp.net--- transfer and check all of the bills in the meantime RRS feed

  • Question

  • User-1497429768 posted

    Hi,

    I use MasterPage to set shopping carts site.The payer can pay the bill by credit card in my site,and the payer will get the notification from third party then he will know whether the payment is success or not.
    The next step I must transfer all of the bills to bank to check if all of the bills are success.The following is source code from bank.The form name is C.aspx.
    <form name=fm method=post action= https://xxx.xxx.xxx/ABC/>
    <input type=hidden name=MerchantID value=111111111>
    <input type=hidden name=TerminalID value=22222222>
    <input type=hidden name=merID value=12345678>
    <input type=hidden name=purchAmt value=111109>
    <input type=hidden name=lidm value=3333333333333333>
    <input type=hidden name=ResURL value=https://samplesite.com.tw/B.asp>
    </form>

    The following is my code in codebehind.
    Dim fun_obj_OpenRecord As SqlDataReader
    If fun_obj_OpenRecord.HasRows Then
    Do While fun_obj_OpenRecord.Read
    If fun_obj_OpenRecord.Item("A").ToString <> "" Then
    vs_A = fun_obj_OpenRecord.Item("A").ToString
    vs_B = fun_obj_OpenRecord.Item("B").ToString
    vs_str = vs_A + "," + vs_B
    ScriptManager.RegisterStartupScript(Me.Page, UpdatePanel1.GetType(), "a", "<SCRIPT language='javascript'>Ah();function Ah(){window.open('C.aspx?str=" & vs_str & "', 'newweb', '');}</SCRIPT>", False)
    End If
    Loop
    End If

    When I click the button,I found it always transfer only one bill to the third party site every time .How can I transfer and check all of the bills in the meantime?

    Thanks.

    Sunday, April 29, 2018 9:20 AM

Answers

  • User186824947 posted

    Hi Jeff,

    I can reproduce this issue on my side. Please use below code instead of yours:

    ScriptManager.RegisterStartupScript(Me.Page, UpdatePanel1.GetType(), Guid.NewGuid().ToString(), "<SCRIPT language='javascript'>Ah();function Ah(){window.open('C.aspx?str=" & vs_str & "', 'newweb', '');}</SCRIPT>", False)

    instead of

    ScriptManager.RegisterStartupScript(Me.Page, UpdatePanel1.GetType(), "a", "<SCRIPT language='javascript'>Ah();function Ah(){window.open('C.aspx?str=" & vs_str & "', 'newweb', '');}</SCRIPT>", False)

    Best Regards,

    Jambor

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 30, 2018 3:34 AM

All replies

  • User186824947 posted

    Hi Jeff,

    I can reproduce this issue on my side. Please use below code instead of yours:

    ScriptManager.RegisterStartupScript(Me.Page, UpdatePanel1.GetType(), Guid.NewGuid().ToString(), "<SCRIPT language='javascript'>Ah();function Ah(){window.open('C.aspx?str=" & vs_str & "', 'newweb', '');}</SCRIPT>", False)

    instead of

    ScriptManager.RegisterStartupScript(Me.Page, UpdatePanel1.GetType(), "a", "<SCRIPT language='javascript'>Ah();function Ah(){window.open('C.aspx?str=" & vs_str & "', 'newweb', '');}</SCRIPT>", False)

    Best Regards,

    Jambor

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 30, 2018 3:34 AM
  • User-1497429768 posted

    Hi Jambor,

      I very much appreciate for you help.That's what I want.But I have another question. The following is the code in C.aspx to transfer bill data to third party site.

    in client side:

    <script type="text/javascript">
    function formSubmit() {
    document.getElementById("myForm").submit()
    }
    </script>

    in server side:

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    If Trim(Request.QueryString("str")) <> "" Then
    Dim rows() As String = Trim(Request.QueryString("str")).Split(",")
    lidm.Value = rows(0)
    purchAmt.Value = rows(1)
    End If
    Page.ClientScript.RegisterStartupScript(Me.GetType(), "window-script", "formSubmit()", True)
    End Sub

    It seems transfer only one bill and then stop transferring other  bills. So how to tune my code?

     Thanks for your help.

    jeff

    Monday, April 30, 2018 4:07 AM
  • User186824947 posted

    It seems the same issue with above one. Please try to change "window-script" to Guid.NewGuid().ToString(). 

    Monday, April 30, 2018 5:10 AM
  • User-1497429768 posted

    Hi Jambor,

       It still upsets me. If A.aspx to call C.aspx to transfer bills data to third party site to check the bills is success or not.The third party side will use B.aspx to send result to my site .

    A.aspx:

    Dim fun_obj_OpenRecord As SqlDataReader 
    If fun_obj_OpenRecord.HasRows Then
    Do While fun_obj_OpenRecord.Read
    If fun_obj_OpenRecord.Item("A").ToString <> "" Then
    vs_A = fun_obj_OpenRecord.Item("A").ToString
    vs_B = fun_obj_OpenRecord.Item("B").ToString
    vs_str = vs_A + "," + vs_B
    ScriptManager.RegisterStartupScript(Me.Page, UpdatePanel1.GetType(), Guid.NewGuid().ToString(), "<SCRIPT language='javascript'>Ah();function Ah(){window.open('C.aspx?str=" & vs_str & "', 'newweb', '');}</SCRIPT>", False)
    End If
    Loop
    End If

    C.aspx:transfer bills to third party site

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    If Trim(Request.QueryString("str")) <> "" Then
    Dim rows() As String = Trim(Request.QueryString("str")).Split(",")
    lidm.Value = rows(0)
    purchAmt.Value = rows(1)
    Page.ClientScript.RegisterStartupScript(Me.GetType(), Guid.NewGuid().ToString(), "formSubmit()", True)
    End If
    End Sub

    B.aspx: receive the result from third party site

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    resCode.Value = ""
    If Request.Form("rescode") <> "" Then
    rescode.Value = Request.Form("rescode")
    End If

    'rescode.Value :0 success
    If rescode.Value = "0" then
    Dim cfc As New Common_Func()
    Dim fun_str_QueryKey As String = ""
    fun_str_QueryKey = "update Table set sucess='Y' " & _
    "where A='" & lidm.Value & "' and B='" & vs_rmoney & "' "
    cfc.OpenSQLCommand(fun_str_QueryKey, 1)
    cfc.cn.Close()
    End If

    End Sub

    If B.aspx receive the parameter and then update my data. But the B.aspx still update the first bill and then stop updating other  bills in my database. Have any idea? Thanks.

    best regards,

    jeff

    Monday, April 30, 2018 9:01 AM
  • User186824947 posted

    Hi,

    Does all bills data submit to third party side? In other words, C.aspx has finished its jobs successfully. Am I right? From your code I could not find any cooperation between C.aspx and B.aspx. So it is difficult to reproduce the issue. Is it possible to write B's logic in A.aspx? I am worried about if C.aspx redirect to B.aspx then all work flows are finished. Please also check this part. I think set breakpoint is more easily to find where is the end of this work flow. Please try it first, if you have some issue. Welcome back. In additional if third party could provide rest API, I think it is more easily to get response and update the database.

    Best Regards,

    Jambor

    Tuesday, May 1, 2018 1:49 AM
  • User-1497429768 posted

    Hi Jambor,

         Thank you for your response.

    ******Does all bills data submit to third party side?

    That's right. I want to send all bills data to third party side to check is success or not.

    ******C.aspx has finished its jobs successfully.

    Actually, I am not sure. 

    C.aspx use post method to  send order number and money to third party site like action= https://www.focas-test.fisc.com.tw/FOCAS_WEBPOS/orderInquery/, then the third party response the result through B.aspx.The C.aspx code is as follows: one bill one response

    <form name=fm method=post action= https://www.focas-test.fisc.com.tw/FOCAS_WEBPOS/orderInquery/>

    <input type=hidden name=MerchantID value=950205079801475>

    <input type=hidden name=TerminalID value=91010001>

    <input type=hidden name=merID value=12345678>

    <input type=hidden name=purchAmt value=350>

    <input type=hidden name=lidm value=000000000003a8ad1fa>

    <input type=hidden name=ResURL value=https://samplesite.com.tw/B.asp> ---response the result to my site

    Something is wrong with above code. The third party can't provide API.

    Anyway,Thank you for all of your help.

    best regards,

    jeff

    Tuesday, May 1, 2018 2:30 AM
  • User186824947 posted

    Hi,

    As far as I know, this solution for the third party site is only support one time job. A.aspx sent request, then third party handle this request (C.aspx), and then C.aspx do some operations then return back to B.aspx. I think it is very difficult to return back to A.aspx to continue handling next loop. I would suggest you contact with third party support or change your logic -> one bill -> one work flow. 

    Best Regards,

    Jambor

    Tuesday, May 1, 2018 5:23 AM
  • User-1497429768 posted

    Hi Jambor,

        Thank you for your suggestion on my issue. I will contact with the third party. Thanks again.

        best regards,

        jeff

       

    Tuesday, May 1, 2018 5:55 AM