public static async Task <DomesticPaymentConsentFluentResponse> SubmitAsync(
            this DomesticPaymentConsentContext context)
        {
            context.ArgNotNull(nameof(context));

            IList <FluentResponseMessage> validationErrors = Validate(context);

            if (validationErrors.Count > 0)
            {
                return(new DomesticPaymentConsentFluentResponse(validationErrors));
            }

            try
            {
                CreateDomesticPaymentConsent createDomesticConsent = new CreateDomesticPaymentConsent(
                    apiClient: context.Context.ApiClient,
                    mapper: context.Context.EntityMapper,
                    dbMultiEntityMethods: context.Context.DbContextService,
                    bankClientProfileRepo: context.Context.ClientProfileRepository,
                    apiProfileRepo: context.Context.ApiProfileRepository,
                    domesticConsentRepo: context.Context.DomesticConsentRepository,
                    softwareStatementProfileService: context.Context.SoftwareStatementProfileService);

                PaymentConsentResponse result = await createDomesticConsent.CreateAsync(context.Data);

                return(new DomesticPaymentConsentFluentResponse(result));
            }
            catch (Exception ex)
            {
                context.Context.Instrumentation.Exception(ex);

                return(new DomesticPaymentConsentFluentResponse(ex.CreateErrorMessage()));
            }
        }
示例#2
0
 public DomesticPaymentConsentHttpResponse(MessagesResponse messages, PaymentConsentResponse data)
 {
     Messages = messages;
     Data     = data;
 }
 public DomesticPaymentConsentFluentResponse(PaymentConsentResponse data)
 {
     Data = data;
 }