import { ProviderMenu } from '.'

export type PayInfoType = {
  
  fail?: (type: 'payFail' | 'getResFail' | 'timeout', error: any) => boolean | Promise<boolean> | void
  
  success?: () => boolean | Promise<boolean> | void
  
  payBefore: (payExtraInfo: PayExtraInfo) => Promise<OrderInfoType> | OrderInfoType
  
  pollInterval?: number
  
  countdown?: number
}


export type PayExtraInfo = {
  
  provider: ProviderMenu
  
  appId?: string
  
  prod?: string
}

export type DasPaymentProps = PayInfoType & {
  
  show: boolean
  
  providerList?: ProviderMenu[]
  
  amount?: number
  
  provider?: ProviderMenu
}

export type OrderInfoType = {
  
  out_trade_no?: string
  
  out_trade_name?: string

  [key: string]: any
}

export type PayAppidType = { [key in ProviderMenu]: string } | undefined 
