The application was created for educational purposes. The project implements Repository and Dependency Injection patterns.
It shouldn't be use for any real business. I don't take any reposibility if you decide to use it for real transactions. Before you do it, make sure the application fulfill security standards.
update-databaselogin: [email protected]
password: Qwerty1!
You can change it at "Your Account" tab. Do it after you set up your SMTP settings at "Admin Panel" - the step below.Application errors are logging in App_Data/logs.
Go to E-Shop-Engine.Services -> Services -> Payment and create new folder.
There are 2 model classes that payment can inherit from: PaymentDetails (intended to send data to external server) and PaymentResponse (intended to receive data from external server).
Create interface for service that inherit from IPaymentService. Then create the implementation.
public class DotPayPaymentService : IDotPayPaymentService
{
private static Settings settings;
public DotPayPaymentService(ISettingsRepository settingsRepository)
{
settings = settingsRepository.Get();
}
// The implementation...
}
Now go to E-Shop-Engine.Website -> Controllers -> Payment and create new Controller.
The controller should inherit from BasePaymentController.
public class DotPayController : BasePaymentController
{
public DotPayController(
IOrderRepository orderRepository,
ICartRepository cartRepository,
ISettingsRepository settingsRepository,
IMailingService mailingService,
IDotPayPaymentService paymentService,
IAppUserManager userManager,
IUnitOfWork unitOfWork)
: base(
orderRepository,
cartRepository,
settingsRepository,
mailingService,
paymentService,
userManager,
unitOfWork)
{
//
}
Register new payment method in AutoFac (E-Shop-Engine.Website -> App_Start -> AutoFacConfig)
builder.RegisterType<DotPayPaymentService>().As<IDotPayPaymentService>().InstancePerRequest();
Go to Views -> Payment -> Select and add new payment. Remember to set input element value the same as Controller name
<div class="custom-control custom-checkbox form-control-lg">
<input type="radio" name="paymentMethod" class="custom-control-input" id="dotpay" value="DotPay">
<label class="custom-control-label" for="dotpay">
<img src="~/Content/payment/dotpay_logo.jpg" class="payment-img" />
</label>
</div>
This project is licensed under MIT License.