mirror of
https://github.com/vercel/commerce.git
synced 2025-03-28 08:15:54 +00:00
* Add ordercloud provider * Fix provider errors * Make submit checkout optional * Make submit checkout optional * Remove nullables when creating endpoint type * Update readme * Log checkout error * Log error * Save token to cookie * Update fetch rest * Use token at checkout Co-authored-by: Luis Alvarez <luis@vercel.com>
24 lines
661 B
TypeScript
24 lines
661 B
TypeScript
import type { CheckoutSchema } from '../../../types/checkout'
|
|
import type { OrdercloudAPI } from '../..'
|
|
|
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
|
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
|
|
|
import getCheckout from './get-checkout'
|
|
import submitCheckout from './submit-checkout'
|
|
|
|
export type CheckoutAPI = GetAPISchema<OrdercloudAPI, CheckoutSchema>
|
|
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
|
|
|
export const handlers: CheckoutEndpoint['handlers'] = {
|
|
getCheckout,
|
|
submitCheckout,
|
|
}
|
|
|
|
const checkoutApi = createEndpoint<CheckoutAPI>({
|
|
handler: checkoutEndpoint,
|
|
handlers,
|
|
})
|
|
|
|
export default checkoutApi
|