Exemple #1
0
        public async Task <IActionResult> DomesticPaymentsPostAsync([FromBody] DomesticPayment request)
        {
            DomesticPaymentFluentResponse?resp = await _obRequestBuilder.DomesticPayment()
                                                 .Data(request)
                                                 .SubmitAsync();

            PaymentResponse?result = new PaymentResponse(
                messages: resp.ToMessagesResponse(),
                data: resp.Data);

            return(resp.HasErrors
                ? new BadRequestObjectResult(result.Messages) as IActionResult
                : new ObjectResult(result)
            {
                StatusCode = StatusCodes.Status201Created
            });
        }
Exemple #2
0
        public static async Task <DomesticPaymentFluentResponse> SubmitAsync(this DomesticPaymentContext context)
        {
            context.ArgNotNull(nameof(context));
            try
            {
                DomesticPayment domesticPayment = context.Data ?? new DomesticPayment(
                    context.ConsentId.ArgNotNullElseInvalidOp("ConsentId not specified"));

                IList <FluentResponseMessage> validationErrors = new PaymentRequestValidator()
                                                                 .Validate(domesticPayment)
                                                                 .GetOpenBankingResponses();
                if (validationErrors.Count > 0)
                {
                    return(new DomesticPaymentFluentResponse(validationErrors));
                }

                CreateDomesticPayment i = new CreateDomesticPayment(
                    apiClient: context.Context.ApiClient,
                    mapper: context.Context.EntityMapper,
                    openBankingClientRepo: context.Context.ClientProfileRepository,
                    domesticConsentRepo: context.Context.DomesticConsentRepository,
                    apiProfileRepo: context.Context.ApiProfileRepository,
                    softwareStatementProfileService: context.Context.SoftwareStatementProfileService);

                OBWriteDomesticResponse4 resp = await i.CreateAsync(domesticPayment.ConsentId);

                return(new DomesticPaymentFluentResponse(resp.Data));
            }
            catch (AggregateException ex)
            {
                context.Context.Instrumentation.Exception(ex);

                return(new DomesticPaymentFluentResponse(ex.CreateErrorMessages()));
            }
            catch (Exception ex)
            {
                context.Context.Instrumentation.Exception(ex);

                return(new DomesticPaymentFluentResponse(ex.CreateErrorMessage()));
            }
        }
Exemple #3
0
 public void UpdatePaymentInformation(DomesticPayment objSaveDetailListModel)
 {
     InsuranceContext.DomesticPayments.Update(objSaveDetailListModel);
 }
Exemple #4
0
 public static DomesticPaymentContext Data(this DomesticPaymentContext context, DomesticPayment value)
 {
     context.Data = value;
     return(context);
 }
Exemple #5
0
 public void SavePaymentPaymentInformations(DomesticPayment objSaveDetailListModel)
 {
     InsuranceContext.DomesticPayments.Insert(objSaveDetailListModel);
 }