// Generated by bynkc — do not edit by hand.
// context commerce.orders

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "../runtime.js";

import * as commerce_payment from "./payment.js";

export const placeOrder = {
  async call(total: number, deps: { surface: { Pay: ReturnType<typeof commerce_payment.makeSurface> } }): Promise<Result<number, number>> {
    const __r0 = await deps.surface.Pay.authorise(total);
    return Ok(total);
  },
};

export interface CommerceOrdersDeps {
  readonly surface: { Pay: ReturnType<typeof commerce_payment.makeSurface> };
}

export function makeSurface(deps: CommerceOrdersDeps) {
  return {
    async placeOrder(total: number): Promise<Result<number, number>> {
      return placeOrder.call(total, deps);
    },
  };
}

