public static async Task <PaymentInitiationApiProfileFluentResponse> SubmitAsync( this PaymentInitiationApiProfileContext context) { try { PaymentInitiationApiProfile apiProfile = context.Data ?? new PaymentInitiationApiProfile( id: context.Id.ArgNotNullElseInvalidOp("Id not specified"), bankClientProfileId: context.BankClientProfileId.ArgNotNullElseInvalidOp( "BankClientProfileId not specified"), apiVersion: context.ApiVersion.ArgStructNotNullElseInvalidOp( "AccountTransactionApiInfo not specified"), baseUrl: context.BaseUrl.ArgNotNullElseInvalidOp("AccountTransactionApiInfo not specified")); CreatePaymentInitiationApiProfile i = new CreatePaymentInitiationApiProfile( dbContextService: context.Context.DbContextService, apiProfileRepo: context.Context.ApiProfileRepository); PaymentInitiationApiProfileResponse resp = await i.CreateAsync(apiProfile); return(new PaymentInitiationApiProfileFluentResponse(resp)); } catch (AggregateException ex) { context.Context.Instrumentation.Exception(ex); return(new PaymentInitiationApiProfileFluentResponse(messages: ex.CreateErrorMessages(), data: null)); } catch (Exception ex) { context.Context.Instrumentation.Exception(ex); return(new PaymentInitiationApiProfileFluentResponse(message: ex.CreateErrorMessage(), data: null)); } }
public static PaymentInitiationApiProfileContext Data( this PaymentInitiationApiProfileContext context, PaymentInitiationApiProfile value) { context.Data = value; return(context); }
protected override void ProcessRecord() { PaymentInitiationApiProfile output = new PaymentInitiationApiProfile( id: Id, bankClientProfileId: BankClientProfileId, apiVersion: ApiVersion, baseUrl: BaseUrl); WriteObject(output); }
public async Task <IActionResult> ClientProfilesPostAsync([FromBody] PaymentInitiationApiProfile request) { PaymentInitiationApiProfileFluentResponse?clientResp = await _obRequestBuilder .PaymentInitiationApiProfile() .Data(request) .SubmitAsync(); PaymentInitiationApiProfileHttpResponse?result = new PaymentInitiationApiProfileHttpResponse( data: clientResp.Data, messages: clientResp.ToMessagesResponse()); return(clientResp.HasErrors ? new BadRequestObjectResult(result.Messages) as IActionResult : new ObjectResult(result) { StatusCode = StatusCodes.Status201Created }); }