export interface DMoneyFabricTokenResponse {
  /** Returned already prefixed with "Bearer " — set Authorization to this value verbatim. */
  token: string;
  effectiveDate?: string;
  expirationDate?: string;
}

export interface DMoneyPreOrderBizContent {
  notify_url: string;
  appid: string;
  merch_code: string;
  merch_order_id: string;
  trade_type: 'Checkout';
  title: string;
  total_amount: string;
  trans_currency: string;
  timeout_express: string;
  business_type?: string;
  redirect_url?: string;
  callback_info?: string;
}

export interface DMoneyPreOrderRequest {
  timestamp: string;
  nonce_str: string;
  method: 'payment.preorder';
  version: '1.0';
  biz_content: DMoneyPreOrderBizContent;
  sign: string;
  sign_type: 'SHA256WithRSA';
}

export interface DMoneyPreOrderResponse {
  result?: 'SUCCESS' | 'FAIL';
  code?: string;
  msg?: string;
  nonce_str?: string;
  sign?: string;
  sign_type?: string;
  biz_content?: {
    merch_order_id?: string;
    prepay_id?: string;
    [key: string]: unknown;
  };
  [key: string]: unknown;
}

export type DMoneyOrderStatus =
  | 'PAY_SUCCESS'
  | 'PAY_FAILED'
  | 'WAIT_PAY'
  | 'ORDER_CLOSED'
  | 'PAYING'
  | 'Completed'
  | 'Failure'
  | 'Expired'
  | 'Paying';

export interface DMoneyQueryOrderResponse {
  result?: 'SUCCESS' | 'FAIL';
  code?: string;
  msg?: string;
  nonce_str?: string;
  sign?: string;
  sign_type?: string;
  biz_content?: {
    merch_order_id?: string;
    order_status?: DMoneyOrderStatus | string;
    payment_order_id?: string;
    trans_time?: string;
    trans_currency?: string;
    total_amount?: string;
    [key: string]: unknown;
  };
  [key: string]: unknown;
}
