Skip to content

Commit

Permalink
Updating the samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sina-Soltani committed Jun 30, 2020
1 parent 96adc20 commit 7826ea4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ public async Task<IActionResult> 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);
}

Expand All @@ -67,7 +66,7 @@ public async Task<IActionResult> 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.");
Expand Down
7 changes: 3 additions & 4 deletions samples/Parbad.Sample.Mvc/Controllers/PaymentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ public async Task<ActionResult> 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);
}

Expand All @@ -72,7 +71,7 @@ public async Task<ActionResult> 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.");
Expand Down
5 changes: 2 additions & 3 deletions samples/Parbad.Sample.WebForm/PayRequest.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions samples/Parbad.Sample.WebForm/Verify.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7826ea4

Please sign in to comment.