public string GetOBWriteDomesticResponse2()
        {
            var consentId = Guid.NewGuid().ToString();

            var instructedAmount     = new OBWriteDomestic2DataInitiationInstructedAmount("50", "GBP");
            var creditorAccount      = new OBWriteDomestic2DataInitiationCreditorAccount("IBAN", "BE56456394728288", "ACME DIY", "secondary-identif");
            var domestic2            = new OBWriteDomestic2DataInitiation("instr-identification", "e2e-identification", null, instructedAmount, null, creditorAccount);
            var dataDomesticReponse2 = new OBWriteDomesticResponse4Data("PaymentId", consentId, DateTime.Now, OBWriteDomesticResponse4Data.StatusEnum.Pending, DateTimeOffset.Now, DateTimeOffset.Now, DateTimeOffset.Now, null, null, domestic2);
            var links = new Links($"{MockRoutes.Url}/{MockRoutes.DomesticPayments}");
            var meta  = new Meta(1);

            var model = new OBWriteDomesticResponse4(dataDomesticReponse2, links, meta);

            return(JsonConvert.SerializeObject(model));
        }
Esempio n. 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()));
            }
        }