import { AxiosRequestConfig, AxiosResponse } from 'axios' import { publicRequest } from './publicRequest' export const getCustomerExistsData = async ( accessHash: string ): Promise => { const response: AxiosResponse = await publicRequest.get(`/v1/delegation-access/${accessHash}/customer-exists`) return response.data } interface IDelegationTicketType { delegationMaxQuantity: number | string; } interface IIssueTicketResponseData { delegationName: string; eventImage: string; eventName: string; ticketTypes: { [key: number]: IDelegationTicketType; }; } interface IIssueTicketResponse { data: { attributes: IIssueTicketResponseData; relationships: Array; type: string; message: string; }; } export interface IDelegationsTicketType { [key: number]: { delegationMaxQuantity: string | number; delegationQuantityIssued: string | number; matrixRecordId: string | number; optionValue: string | number; }; } export interface IDelegationsData { delegationName: string; eventImage: string; eventName: string; ticketTypes: IDelegationsTicketType; tickets: Array; } interface IDelegationsResponse { data: { data: { attributes: IDelegationsData; relationships: Array; type: string; }; }; } export const getDelegationTickets = ( accessHash: string ): Promise => { const res = publicRequest.get(`v1/delegation-access/${accessHash}/consumer-page-info`) return res } export const issueTicket = async ( accessHash: string, data: ITicketIssueData ): Promise => { const response: AxiosResponse = await publicRequest.post(`v1/delegation-access/${accessHash}/issue-ticket`, { data: { attributes: data, }, }) return response.data }