hi in EnterPaymentInfo of CheckoutController instead of getting user information, i redirect user to external gateway using webservice web services have following method for check payment information public int PaymentRequest(string MerchantID, int Amount, string Description, string Email, string Mobile, string CallbackURL, out string Authority)
PaymentRequest method return integer value and i check this value and redirect user to gateway after redirection and do payment user come back to website using CallbackURL parameter ,i redirect user to Confirm action method redirect url have QueryString i check QueryString in Confirm action method using PaymentVerification method public int PaymentVerification(string MerchantID, string Authority, int Amount, out long RefID)
this method also return status code now i want check if status code is 100 , update order status and payment status
can i o this without payment plugin?? how can i access and update order ,Payment and shipping status in action methods of CheckoutController??
The correct way to do this is with a payment plugin (Redirection Payment Method Type, of course) but any ways, you need to use OrderProcessingService for do this.
To use this you can inject the service (IOrderProcessingSerice) in the contructor method of the class and then you just use MarkOrderAsPaid method of that class
But howcan i call PostPaymentProcess of plugin in checkout controller?
you dont need it, PostProcessPayment is called by IPaymentService after "Place order" process (ConfirmOrder method). this service call the PosPaymentProcess method (that you implements in your plugin).
If you do a Payment Plugin you DONT need change ANY line of NopBase source code.
i send my payment info to gateway and it return me status code that indicate gateway info is correct after that if status code is 100 everthing is ok and user redirect to gateway after payment (pay or not pay) user return to CallBackURL parameter of PaymentRequest gateway add query string to CallBackURL and i should parse query string
var _t = _orderTotalCalculationService.GetShoppingCartTotal(cart); int Total = (int)_t; if (Request.QueryString["Status"] != "" && Request.QueryString["Status"] != null && Request.QueryString["Authority"] != "" && Request.QueryString["Authority"] != null) { if (Request.QueryString["Status"].ToString().Equals("OK")) {
long RefID; System.Net.ServicePointManager.Expect100Continue = false; PaymentGatewayImplementationServicePortTypeClient gateway = new PaymentGatewayImplementationServicePortTypeClient();
int Status = gateway.PaymentVerification("MerchantID", Request.QueryString["Authority"].ToString(), Total, out RefID);
First you need send to Payment service the GUID of your order and when the you recive a response of your payment service to your CallBackURL, you can know for what order is the response is being received
when you recive a request in your callback URL you need process this payment. if the firs request have a payment response you dont need do an other request to check the status. when you have a payment status you only need get an order with IOrderService implementation (use method GetOrderByGuid) and then you only use IOrderProcessingService to mark order as payment)
You can check the Source code of Pyapal Standard Plugin (Nop.Plugin.Payments.PayPalStandard) to see a implementation of this
Tnx But what is correct callBacUrl?? Can you provide me more code/detail??
Firs you need add a method in your controller, in this method you control your CallBack requests. On Paypal plugin this method call PDTHandler.
then you need implement an IRouteProvider to register a new URL (see source code of PayPalStandard plugin > RouteProvider class).
And that's it all! Now you have a callbak URL and when your payment service will do a request to this URL you can process the answer (in this case you can register or not the payment)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.