diff --git a/samples/Parbad.Sample.AspNetCore/Controllers/PaymentController.cs b/samples/Parbad.Sample.AspNetCore/Controllers/PaymentController.cs index 8eb5e4d4..810064ec 100644 --- a/samples/Parbad.Sample.AspNetCore/Controllers/PaymentController.cs +++ b/samples/Parbad.Sample.AspNetCore/Controllers/PaymentController.cs @@ -42,14 +42,13 @@ public async Task Pay(PayViewModel viewModel) } }); + // Save the result.TrackingNumber in your database. + if (result.IsSucceed) { return result.GatewayTransporter.TransportToGateway(); } - // Note: This is just for development and testing. - // Don't show the actual result object to clients in production environment. - // Instead, show only the important information such as IsSucceed, Tracking Number and Transaction Code. return View("PayRequestError", result); } @@ -67,7 +66,7 @@ public async Task Verify() return Content("The payment is already processed before."); } - // An example of checking the invoice in your website. + // This is an example of cancelling an invoice when you think that the payment process must be stopped. if (!Is_There_Still_Product_In_Shop(invoice.TrackingNumber)) { var cancelResult = await _onlinePayment.CancelAsync(invoice, cancellationReason: "Sorry, We have no more products to sell."); diff --git a/samples/Parbad.Sample.Mvc/Controllers/PaymentController.cs b/samples/Parbad.Sample.Mvc/Controllers/PaymentController.cs index b170e9c8..984c34bb 100644 --- a/samples/Parbad.Sample.Mvc/Controllers/PaymentController.cs +++ b/samples/Parbad.Sample.Mvc/Controllers/PaymentController.cs @@ -47,14 +47,13 @@ public async Task Pay(RequestViewModel viewModel) } }); + // Save the result.TrackingNumber in your database. + if (result.IsSucceed) { return result.GatewayTransporter.TransportToGateway(); } - // Note: This is just for development and testing. - // Don't show the actual result object to clients in production environment. - // Instead, show only the important information such as IsSucceed, Tracking Number and Transaction Code. return View("PayRequestError", result); } @@ -72,7 +71,7 @@ public async Task Verify() return Content("The payment is already processed before."); } - // An example of checking the invoice in your website. + // This is an example of cancelling an invoice when you think that the payment process must be stopped. if (!Is_There_Still_Product_In_Shop(invoice.TrackingNumber)) { var cancelResult = await _onlinePayment.CancelAsync(invoice, cancellationReason: "Sorry, We have no more products to sell."); diff --git a/samples/Parbad.Sample.WebForm/PayRequest.aspx.cs b/samples/Parbad.Sample.WebForm/PayRequest.aspx.cs index ba5df626..c4554301 100644 --- a/samples/Parbad.Sample.WebForm/PayRequest.aspx.cs +++ b/samples/Parbad.Sample.WebForm/PayRequest.aspx.cs @@ -38,6 +38,8 @@ protected async void BtnPay_Click(object sender, EventArgs e) } }); + // Save the result.TrackingNumber in your database. + if (result.IsSucceed) { await result.GatewayTransporter.TransportAsync(); @@ -46,9 +48,6 @@ protected async void BtnPay_Click(object sender, EventArgs e) { ResultPanel.Visible = true; - // Note: This is just for development and testing. - // Don't show the actual result object to clients in production environment. - // Instead, show only the important information such as IsSucceed, Tracking Number and Transaction Code. LblTrackingNumber.Text = result.TrackingNumber.ToString(); LblAmount.Text = result.Amount.ToString(); LblGateway.Text = result.GatewayName; diff --git a/samples/Parbad.Sample.WebForm/Verify.aspx.cs b/samples/Parbad.Sample.WebForm/Verify.aspx.cs index 296e7a2a..9fd0e908 100644 --- a/samples/Parbad.Sample.WebForm/Verify.aspx.cs +++ b/samples/Parbad.Sample.WebForm/Verify.aspx.cs @@ -12,6 +12,7 @@ protected async void Page_Load(object sender, EventArgs e) var invoice = await StaticOnlinePayment.Instance.FetchAsync(); + // This is an example of cancelling an invoice when you think that the payment process must be stopped. if (Is_There_Still_Product_In_Shop(invoice.TrackingNumber)) { var verifyResult = await StaticOnlinePayment.Instance.VerifyAsync(invoice);