Hi @rcalv002
Yes, for Payment Module, there is only MVC UI support. You can use its APIs but this will be harder. Or you can create a new MVC app just for payment processing and redirect users to this app when they want to make a payment from your Angular app. You don't need to change your entire app to MVC.
Hi,
Yes, you can add more payment options. First you need to add your new payment gateway to the Gateways list;
Configure<PaymentOptions>(options =>
{
options.Gateways.Add(
new PaymentGatewayConfiguration(
PayuConsts.GatewayName,
new FixedLocalizableString("Payu"),
typeof(CustomPaymentGateway)
)
);
});
Then, create an implementaion of IPaymentGateway
(CustomPaymentGateway
in this example).
You also need to create two Razor pages for your custom payment option. PrePayment.cshtml
and PostPayment.cshtml
.
When user selects the payment option you have added, payment module first redirects user to PrePayment.cshtml
, so you can get extra information if you need to or just redirect user to payment gateways website without any extra operation.
When user completes the payment on the payment gateway (or payment fails for some gateways), user will be redirected to PostPayment.cshtml
, so you can validate the payment with external gateway and if the payment is really succeeded, you can redirect user to requested callback URL.
For example, this is one of our PostPayment.cshtml.cs code;
public virtual async Task<IActionResult> OnGetAsync()
{
var paymentRequestId = Guid.Parse(Request.Query["paymentRequestId"]);
Logger.LogInformation("PayU return url: " + Request.GetEncodedUrl());
await PaymentRequestAppService.CompleteAsync(
new CompletePaymentRequestDto
{
GateWay = PayuConsts.GatewayName,
Id = paymentRequestId,
Properties = new Dictionary<string, string>
{
{ "ctrl", Request.Query["ctrl"]},
{ "payrefno", Request.Query["payrefno"]},
{ "url", GetCurrentEncodedUrl()}
}
});
if (!_paymentWebOptions.Value.CallbackUrl.IsNullOrWhiteSpace())
{
var callbackUrl = _paymentWebOptions.Value.CallbackUrl + "?paymentRequestId=" + paymentRequestId;
var paymentRequest = await PaymentRequestAppService.GetAsync(paymentRequestId);
var extraPaymentParameters = _purchaseParameterListGenerator.GetExtraParameterConfiguration(paymentRequest);
if (!extraPaymentParameters.AdditionalCallbackParameters.IsNullOrEmpty())
{
callbackUrl += "&" + extraPaymentParameters.AdditionalCallbackParameters;
}
Response.Redirect(callbackUrl);
}
return Page();
}
Please let me know if you face any problems.
Hi,
For the first problem, you need to define ExtraProperties like below;
paymentRequestDto.Products.Add(new PaymentRequestProductCreateDto
{
Code = "001",
Count = Product1Count,
Name = "Personal License",
UnitPrice = 999,
TotalPrice = Product1Count * 999,
ExtraProperties = new Dictionary<string, IPaymentRequestProductExtraParameterConfiguration>
{
{
TwoCheckoutConsts.GatewayName,
new TwoCheckoutPaymentRequestProductExtraParameterConfiguration
{
ProductCode = "2Checkout_Product_Code"
}
}
}
});
In order to do that, you first need to create a product on 2Checkout.
For your second question, MyPaymentGateway
must be a class which implements IPaymentGateway
. This class will be used to validate the status of the payment when user (customer) is redirected back to your website from payment gateway. If MyPaymentGateway's IsValid
method returns true, status of PaymentRequest is also set to success on your database and user will be redirected to CallbackUrl
of your payment options which you must configure like below;
Configure<PaymentWebOptions>(options =>
{
options.RootUrl = configuration["AppSelfUrl"];
options.CallbackUrl = "AN_URL_ON_YOUR_APP";
});
Related packages have been unlisted.
Great :). Downloading source code of NPM packages via CLI will be added soon as well.
Thanks,
Hi @geffzhang
I have shared the NG package source code via email. Could you try again downloading Volo.Docs.Admin module ? It might be a temporary problem.
Thanks,
Hi,
You can configure it like this;
Configure<IdentityServerOptions>(options => { options.IssuerUri = "Your issuer URL"; });
Hi @ismailyildirim
You can download source code of NuGet packages using abp get-source [Module-Name]
command. Here are avaialbe module names at the moment;
We will share source code of NPM packages via email with you.
Hi @LevanM
It is alredy open source (https://github.com/abpframework/abp/), couldn't understand what you are asking for, sorry. Could you explain a bit more detailed ?
Thanks,
Hi @ismailyildirim
Could you send an email to info@abp.io about this ?
Thanks,