69 lines
4.1 KiB
C#
69 lines
4.1 KiB
C#
using CMSMicroservice.Protobuf.Protos.Package;
|
|
using CMSMicroservice.WebApi.Common.Services;
|
|
using CMSMicroservice.Application.PackageCQ.Commands.CreateNewPackage;
|
|
using CMSMicroservice.Application.PackageCQ.Commands.UpdatePackage;
|
|
using CMSMicroservice.Application.PackageCQ.Commands.DeletePackage;
|
|
using CMSMicroservice.Application.PackageCQ.Commands.PurchaseGoldenPackage;
|
|
using CMSMicroservice.Application.PackageCQ.Commands.VerifyGoldenPackagePurchase;
|
|
using CMSMicroservice.Application.PackageCQ.Commands.InitiateBasePackagePayment;
|
|
using CMSMicroservice.Application.PackageCQ.Commands.VerifyBasePackagePayment;
|
|
using CMSMicroservice.Application.PackageCQ.Queries.GetPackage;
|
|
using CMSMicroservice.Application.PackageCQ.Queries.GetAllPackageByFilter;
|
|
using CMSMicroservice.Application.PackageCQ.Queries.GetUserPackageStatus;
|
|
namespace CMSMicroservice.WebApi.Services;
|
|
public class PackageService : PackageContract.PackageContractBase
|
|
{
|
|
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
|
|
|
public PackageService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
|
{
|
|
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
|
}
|
|
public override async Task<CreateNewPackageResponse> CreateNewPackage(CreateNewPackageRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<CreateNewPackageRequest, CreateNewPackageCommand, CreateNewPackageResponse>(request, context);
|
|
}
|
|
public override async Task<Empty> UpdatePackage(UpdatePackageRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<UpdatePackageRequest, UpdatePackageCommand>(request, context);
|
|
}
|
|
public override async Task<Empty> DeletePackage(DeletePackageRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<DeletePackageRequest, DeletePackageCommand>(request, context);
|
|
}
|
|
public override async Task<GetPackageResponse> GetPackage(GetPackageRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<GetPackageRequest, GetPackageQuery, GetPackageResponse>(request, context);
|
|
}
|
|
public override async Task<GetAllPackageByFilterResponse> GetAllPackageByFilter(GetAllPackageByFilterRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<GetAllPackageByFilterRequest, GetAllPackageByFilterQuery, GetAllPackageByFilterResponse>(request, context);
|
|
}
|
|
|
|
public override async Task<PurchaseGoldenPackageResponse> PurchaseGoldenPackage(PurchaseGoldenPackageRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<PurchaseGoldenPackageRequest, PurchaseGoldenPackageCommand, PurchaseGoldenPackageResponse>(request, context);
|
|
}
|
|
|
|
public override async Task<VerifyGoldenPackagePurchaseResponse> VerifyGoldenPackagePurchase(VerifyGoldenPackagePurchaseRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<VerifyGoldenPackagePurchaseRequest, VerifyGoldenPackagePurchaseCommand, VerifyGoldenPackagePurchaseResponse>(request, context);
|
|
}
|
|
|
|
public override async Task<GetUserPackageStatusResponse> GetUserPackageStatus(GetUserPackageStatusRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<GetUserPackageStatusRequest, GetUserPackageStatusQuery, GetUserPackageStatusResponse>(request, context);
|
|
}
|
|
|
|
// Base Package Payment (56M)
|
|
public override async Task<InitiateBasePackagePaymentResponse> InitiateBasePackagePayment(InitiateBasePackagePaymentRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<InitiateBasePackagePaymentRequest, InitiateBasePackagePaymentCommand, InitiateBasePackagePaymentResponse>(request, context);
|
|
}
|
|
|
|
public override async Task<VerifyBasePackagePaymentResponse> VerifyBasePackagePayment(VerifyBasePackagePaymentRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<VerifyBasePackagePaymentRequest, VerifyBasePackagePaymentCommand, VerifyBasePackagePaymentResponse>(request, context);
|
|
}
|
|
}
|