Example #1
0
        public static async Task <OpenBankingSoftwareStatementResponse> SubmitAsync(
            this SoftwareStatementProfileContext context)
        {
            context.ArgNotNull(nameof(context));

            IList <FluentResponseMessage> validationErrors = Validate(context);

            if (validationErrors.Count > 0)
            {
                return(new OpenBankingSoftwareStatementResponse(messages: validationErrors, data: null));
            }

            CreateSoftwareStatementProfile creator = new CreateSoftwareStatementProfile(
                softwareStatementProfileService: context.Context.SoftwareStatementProfileService);

            List <FluentResponseMessage> messages = new List <FluentResponseMessage>();

            try
            {
                SoftwareStatementProfileResponse response = await creator.CreateAsync(context.Data);

                return(new OpenBankingSoftwareStatementResponse(messages: messages, data: response));
            }
            catch (Exception ex)
            {
                context.Context.Instrumentation.Exception(ex);

                return(new OpenBankingSoftwareStatementResponse(message: ex.CreateErrorMessage(), data: null));
            }
        }
        public Task <SoftwareStatementProfileResponse> CreateAsync(SoftwareStatementProfilePublic profile)
        {
            profile.ArgNotNull(nameof(profile));

            _softwareStatementProfileService.SetSoftwareStatementProfile(profile);

            SoftwareStatementProfileResponse response = new SoftwareStatementProfileResponse(profile.Id);

            return(Task.FromResult(response));
        }
 //internal
 public OpenBankingSoftwareStatementResponse(
     IList <FluentResponseMessage> messages,
     SoftwareStatementProfileResponse data) : base(messages)
 {
     Data = data;
 }
 //internal
 public OpenBankingSoftwareStatementResponse(
     FluentResponseMessage message,
     SoftwareStatementProfileResponse data) : this(messages : new[] { message }, data : data)
 {
 }