| import { apiRequest } from './client' |
|
|
| export type OobStatus = 'pending' | 'approved' | 'rejected' | 'expired' |
|
|
| export interface OobConfirmation { |
| confirmation_id: string |
| code: string |
| amount: number |
| merchant: string |
| channels: string[] |
| } |
|
|
| |
| export function setNotifyPrefs(userId: string, channels: string[]): Promise<unknown> { |
| return apiRequest('/notify/prefs', { body: { user_id: userId, channels } }) |
| } |
|
|
| |
| export function requestConfirmation(userId: string, amount: number, merchant: string): Promise<OobConfirmation> { |
| return apiRequest<OobConfirmation>('/notify/request', { body: { user_id: userId, amount, merchant } }) |
| } |
|
|
| export function getConfirmationStatus(confirmationId: string): Promise<{ status: OobStatus }> { |
| return apiRequest(`/notify/status?confirmation_id=${encodeURIComponent(confirmationId)}`) |
| } |
|
|
| |
| export function respondConfirmation(confirmationId: string, approve: boolean, code: string): Promise<{ success: boolean; reason?: string }> { |
| return apiRequest('/notify/respond', { body: { confirmation_id: confirmationId, approve, code } }) |
| } |
|
|