At the back of the back to show how to implement?
Bosses, please have a look at?
CodePudding user response:
///& lt; Summary>///notification page
///& lt;/summary>
///& lt; Returns>
Public ActionResult Alipay_Notify ()
{
SortedDictionary
If (sPara. Count & gt; 0)//determine whether with return parameter
{
Notify aliNotify=new Notify ();
Bool verifyResult=aliNotify. Verify (sPara, Request Form (" notify_id "), the Request. The Form (" sign "));
If (verifyResult)//verification success
{
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
Please add the business logic of the merchants here//code
//- please write programs according to your business logic (the code below are for reference only) -
//inform return parameter for alipay, refer to technical documents in asynchronous notification server parameter list
//merchant order number
. String out_trade_no=Request Form (" out_trade_no ");
//pay treasure to deal,
. String trade_no=Request Form (" trade_no ");
//transaction status
. String trade_status=Request Form (" trade_status ");
If (Request Form (" trade_status ")=="TRADE_FINISHED")
{
//determine whether this order have done in the merchant site processing
//if there is no treatment, according to the order number (out_trade_no) in merchants website order system to check the details of this order, and perform the merchant business program
//if you have done to deal with, the lack of merchant business process
//note:
//refund date more than can be refund after the deadline (e.g., three months can refund), pay treasure to the system sends the transaction status notification
}
Else if (Request Form (" trade_status ")=="TRADE_SUCCESS")
{
//determine whether this order have done in the merchant site processing
//if there is no treatment, according to the order number (out_trade_no) in merchants website order system to check the details of this order, and perform the merchant business program
//if you have done to deal with, the lack of merchant business process
//note:
//after completion of payment, pay treasure to the system sends the transaction status notification
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
Please add the business logic of the merchants here//code
}
The else
{
}
//- please write programs according to your business logic (the code above are for reference only) -
Response. Write (" success ");//please do not modify or delete
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
The else//validation failure
{
Response. Write (" fail ");
}
}
The else
{
Response. Write (" no notification parameters ");
}
return View();
}
///& lt; Summary>
///return page
///& lt;/summary>
///& lt; Returns>
Public ActionResult Alipay_Return ()
{
SortedDictionary
If (sPara. Count & gt; 0)//determine whether with return parameter
{
Notify aliNotify=new Notify ();
Bool verifyResult=aliNotify. Verify (sPara, Request the QueryString (" notify_id "), the Request. The QueryString (" sign "));
If (verifyResult)//verification success
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////please add merchants business logic code here
//Response. Write (order number: + strOrderNO + "& lt; br> Amount: "+ strPrice);//success, can beautify the page, message
//- please write programs according to your business logic (the code below are for reference only) -
//inform return parameter for alipay, refer to page jump synchronous notification parameters in the technical documentation of list
//merchant order number
String out_trade_no=Request. The QueryString (" out_trade_no ");
//pay treasure to deal,
String trade_no=Request. The QueryString (" trade_no ");
//transaction status
String trade_status=Request. The QueryString (" trade_status ");
If (Request. The QueryString [] "trade_status"=="TRADE_FINISHED" | | Request. The QueryString (" trade_status ")=="TRADE_SUCCESS")
{
//determine whether this order have done in the merchant site processing
//if there is no treatment, according to the order number (out_trade_no) in merchants website order system to check the details of this order, and perform the merchant business program
//if you have done to deal with, the lack of merchant business process
}
The else
{
Response. Write (" trade_status="+ Request. The QueryString (" trade_status"));
}
//print page
//Response. Write (" verify success & lt; Br/& gt;" );
//- please write programs according to your business logic (the code above are for reference only) -
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
The else//validation failure
{
Response. Write (" authentication failed ");
}
}
The else
{
Response. Write (" no return parameter ");
}
return View();
}
Public SortedDictionary
{
int i=0;
SortedDictionary
NameValueCollection coll.
//the Load Form variables into NameValueCollection variable.
Coll=Request. The QueryString;
//Get the names of all forms into a string array.
String [] requestItem=coll. AllKeys;
For (I=0; I & lt; RequestItem. Length; I++)
{
SArray. Add (requestItem [I], the Request. The QueryString [requestItem [I]]).
}
Return sArray;
}