Untitled

 avatar
unknown
plain_text
a month ago
1.1 kB
2
Indexable
import { z } from 'zod';
 
export type Options = {
  credentials: {
    secret: string;
    id: string;
  };
  data: ({ identifier: string } | { customerId: string }) & {
    redirectUrl: string;
  };
};
 
export type Response = {
  connectUrl: string;
  consentId: string;
§};
 
Cypress.Commands.add('createAisConnectLink', ({ credentials, data }) => {
  return cy
    .request({
      auth: {
        password: credentials.secret,
        username: credentials.id,
      },
      body: data,
      method: 'POST',
      url: `${Cypress.env('API_DOMAIN')}/consent/ais/connect`,
    })
    .then((response) => {
      const schema = z.object({
        data: z.object({
          connectUrl: z.string(),
          consentId: z.string(),
        }),
      });
 
      const body = schema.parse(response.body);
 
      return cy.wrap<Response>(body.data);
    });
});
 
 
 
 
    createAisCustomerConsentToken(
      options: import('./commands/createAisCustomerConsentToken').Options
    ): Chainable<import('./commands/createAisCustomerConsentToken').Response>;
 
Leave a Comment