mirror of https://github.com/abpframework/eventhub
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
using System.Threading.Tasks;
|
|
using Payment.PaymentRequests;
|
|
using Volo.Abp.Data;
|
|
using Volo.Abp.DependencyInjection;
|
|
using Volo.Abp.Guids;
|
|
using Volo.Abp.MultiTenancy;
|
|
|
|
namespace Payment
|
|
{
|
|
public class PaymentDataSeedContributor : IDataSeedContributor, ITransientDependency
|
|
{
|
|
private readonly IPaymentRequestRepository _paymentRequestRepository;
|
|
private readonly PaymentTestData _paymentTestData;
|
|
|
|
public PaymentDataSeedContributor(IPaymentRequestRepository paymentRequestRepository, PaymentTestData paymentTestData)
|
|
{
|
|
_paymentRequestRepository = paymentRequestRepository;
|
|
_paymentTestData = paymentTestData;
|
|
}
|
|
|
|
public async Task SeedAsync(DataSeedContext context)
|
|
{
|
|
await BuildPaymentRequestAsync();
|
|
}
|
|
|
|
private async Task BuildPaymentRequestAsync()
|
|
{
|
|
var paymentRequest = new PaymentRequest(
|
|
_paymentTestData.PaymentRequest1Id,
|
|
_paymentTestData.Customer1Id,
|
|
_paymentTestData.Product1Id,
|
|
"Product 1",
|
|
10,
|
|
"USD");
|
|
|
|
await _paymentRequestRepository.InsertAsync(paymentRequest, autoSave: true);
|
|
}
|
|
}
|
|
}
|
|
|