openapi: 3.2.0 info: title: Vencart User Wallet API version: 0.1.0 tags: - name: user-wallet paths: /users/wallet/balance: get: tags: - user-wallet summary: Get Wallet Balance description: Get the current wallet balance for the authenticated user. operationId: get_wallet_balance_users_wallet_balance_get responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/WalletBalanceResponse' /users/wallet/deposit: post: tags: - user-wallet summary: Create Wallet Deposit description: 'Create a Stripe PaymentIntent for wallet deposit. The actual wallet credit happens in the webhook handler after payment succeeds.' operationId: create_wallet_deposit_users_wallet_deposit_post requestBody: content: application/json: schema: $ref: '#/components/schemas/WalletDepositRequest' required: true responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/WalletDepositResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /users/wallet/transactions: get: tags: - user-wallet summary: Get Wallet Transactions description: Get paginated transaction history for the authenticated user. operationId: get_wallet_transactions_users_wallet_transactions_get parameters: - name: limit in: query required: false schema: type: integer maximum: 100 minimum: 1 default: 50 title: Limit - name: offset in: query required: false schema: type: integer minimum: 0 default: 0 title: Offset responses: '200': description: Successful Response content: application/json: schema: type: array items: $ref: '#/components/schemas/WalletTransactionResponse' title: Response Get Wallet Transactions Users Wallet Transactions Get '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /users/wallet/debit: post: tags: - user-wallet summary: Debit Wallet description: 'Pay for an order using VenCart wallet balance. This debits the wallet and sends the order to VenSmart (same flow as card/Apple/Google Pay).' operationId: debit_wallet_users_wallet_debit_post requestBody: content: application/json: schema: $ref: '#/components/schemas/WalletDebitRequest' required: true responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: WalletDebitRequest: properties: order_id: type: integer title: Order Id amount: anyOf: - type: number exclusiveMinimum: 0.0 - type: string pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,2}0*$ title: Amount description: Amount to debit from wallet (original amount, deals will be calculated server-side) description: type: string title: Description deal_id: anyOf: - type: integer - type: 'null' title: Deal Id deal_ids: anyOf: - items: type: integer type: array - type: 'null' title: Deal Ids venbucks_to_redeem: anyOf: - type: integer - type: 'null' title: Venbucks To Redeem type: object required: - order_id - amount - description title: WalletDebitRequest description: Schema for wallet payment request - debits wallet and sends order to VenSmart HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError WalletTransactionResponse: properties: id: type: string format: uuid title: Id user_id: type: integer title: User Id amount: type: string pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$ title: Amount transaction_type: type: string enum: - DEPOSIT - PURCHASE - REFUND - ADJUSTMENT - BONUS title: Transaction Type balance_after: type: string pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$ title: Balance After stripe_payment_intent_id: anyOf: - type: string - type: 'null' title: Stripe Payment Intent Id order_id: anyOf: - type: integer - type: 'null' title: Order Id description: anyOf: - type: string - type: 'null' title: Description transaction_metadata: anyOf: - additionalProperties: true type: object - type: 'null' title: Transaction Metadata created_at: type: string format: date-time title: Created At created_by: anyOf: - type: integer - type: 'null' title: Created By idempotency_key: type: string title: Idempotency Key type: object required: - id - user_id - amount - transaction_type - balance_after - created_at - idempotency_key title: WalletTransactionResponse description: Schema for wallet transaction response. Amounts are in dollars. ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type input: title: Input ctx: type: object title: Context type: object required: - loc - msg - type title: ValidationError WalletDepositRequest: properties: amount: anyOf: - type: number exclusiveMinimum: 0.0 - type: string pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d{0,2}0*$ title: Amount description: Amount to deposit in dollars payment_method_id: type: string title: Payment Method Id description: Stripe payment method ID type: object required: - amount - payment_method_id title: WalletDepositRequest description: Schema for deposit request WalletBalanceResponse: properties: user_id: type: integer title: User Id balance: type: string pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$ title: Balance last_transaction_at: anyOf: - type: string format: date-time - type: 'null' title: Last Transaction At type: object required: - user_id - balance title: WalletBalanceResponse description: Schema for wallet balance response WalletDepositResponse: properties: client_secret: type: string title: Client Secret payment_intent_id: type: string title: Payment Intent Id type: object required: - client_secret - payment_intent_id title: WalletDepositResponse description: Schema for deposit response