mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Adapt providers
This commit is contained in:
@@ -2,13 +2,13 @@ import { GetAPISchema, createEndpoint } from '@commerce/api'
|
|||||||
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
||||||
import type { CheckoutSchema } from '../../../types/checkout'
|
import type { CheckoutSchema } from '../../../types/checkout'
|
||||||
import type { BigcommerceAPI } from '../..'
|
import type { BigcommerceAPI } from '../..'
|
||||||
import checkout from './checkout'
|
import submitCheckout from './submit-checkout'
|
||||||
|
|
||||||
export type CheckoutAPI = GetAPISchema<BigcommerceAPI, CheckoutSchema>
|
export type CheckoutAPI = GetAPISchema<BigcommerceAPI, CheckoutSchema>
|
||||||
|
|
||||||
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
||||||
|
|
||||||
export const handlers: CheckoutEndpoint['handlers'] = { checkout }
|
export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout }
|
||||||
|
|
||||||
const checkoutApi = createEndpoint<CheckoutAPI>({
|
const checkoutApi = createEndpoint<CheckoutAPI>({
|
||||||
handler: checkoutEndpoint,
|
handler: checkoutEndpoint,
|
||||||
|
@@ -5,7 +5,7 @@ import { uuid } from 'uuidv4'
|
|||||||
|
|
||||||
const fullCheckout = true
|
const fullCheckout = true
|
||||||
|
|
||||||
const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
config,
|
config,
|
||||||
@@ -87,4 +87,4 @@ const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
|||||||
res.end()
|
res.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
export default checkout
|
export default submitCheckout
|
@@ -6,7 +6,7 @@ export type CheckoutAPI = GetAPISchema<CommerceAPI, CheckoutSchema>
|
|||||||
|
|
||||||
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
||||||
|
|
||||||
const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
config,
|
config,
|
||||||
@@ -47,7 +47,7 @@ const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handlers: CheckoutEndpoint['handlers'] = { checkout }
|
export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout }
|
||||||
|
|
||||||
const checkoutApi = createEndpoint<CheckoutAPI>({
|
const checkoutApi = createEndpoint<CheckoutAPI>({
|
||||||
handler: checkoutEndpoint,
|
handler: checkoutEndpoint,
|
||||||
|
@@ -6,7 +6,7 @@ import {
|
|||||||
import associateCustomerWithCheckoutMutation from '../../../utils/mutations/associate-customer-with-checkout'
|
import associateCustomerWithCheckoutMutation from '../../../utils/mutations/associate-customer-with-checkout'
|
||||||
import type { CheckoutEndpoint } from '.'
|
import type { CheckoutEndpoint } from '.'
|
||||||
|
|
||||||
const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
config,
|
config,
|
||||||
@@ -35,4 +35,4 @@ const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default checkout
|
export default submitCheckout
|
||||||
|
@@ -2,13 +2,13 @@ import { GetAPISchema, createEndpoint } from '@commerce/api'
|
|||||||
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
||||||
import type { CheckoutSchema } from '../../../types/checkout'
|
import type { CheckoutSchema } from '../../../types/checkout'
|
||||||
import type { ShopifyAPI } from '../..'
|
import type { ShopifyAPI } from '../..'
|
||||||
import checkout from './checkout'
|
import submitCheckout from './submit-checkout'
|
||||||
|
|
||||||
export type CheckoutAPI = GetAPISchema<ShopifyAPI, CheckoutSchema>
|
export type CheckoutAPI = GetAPISchema<ShopifyAPI, CheckoutSchema>
|
||||||
|
|
||||||
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
||||||
|
|
||||||
export const handlers: CheckoutEndpoint['handlers'] = { checkout }
|
export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout }
|
||||||
|
|
||||||
const checkoutApi = createEndpoint<CheckoutAPI>({
|
const checkoutApi = createEndpoint<CheckoutAPI>({
|
||||||
handler: checkoutEndpoint,
|
handler: checkoutEndpoint,
|
||||||
|
@@ -3,7 +3,7 @@ import { CheckoutSchema } from '@commerce/types/checkout'
|
|||||||
import { SWELL_CHECKOUT_URL_COOKIE } from '../../../const'
|
import { SWELL_CHECKOUT_URL_COOKIE } from '../../../const'
|
||||||
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
||||||
|
|
||||||
const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
config,
|
config,
|
||||||
@@ -17,7 +17,7 @@ const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
|||||||
res.redirect('/cart')
|
res.redirect('/cart')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const handlers: CheckoutEndpoint['handlers'] = { checkout }
|
export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout }
|
||||||
|
|
||||||
export type CheckoutAPI = GetAPISchema<CommerceAPI, CheckoutSchema>
|
export type CheckoutAPI = GetAPISchema<CommerceAPI, CheckoutSchema>
|
||||||
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
||||||
|
@@ -3,7 +3,7 @@ import { CommerceAPI, createEndpoint, GetAPISchema } from '@commerce/api'
|
|||||||
import { CheckoutSchema } from '@commerce/types/checkout'
|
import { CheckoutSchema } from '@commerce/types/checkout'
|
||||||
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
||||||
|
|
||||||
const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
config,
|
config,
|
||||||
@@ -48,7 +48,7 @@ export type CheckoutAPI = GetAPISchema<CommerceAPI, CheckoutSchema>
|
|||||||
|
|
||||||
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
export type CheckoutEndpoint = CheckoutAPI['endpoint']
|
||||||
|
|
||||||
export const handlers: CheckoutEndpoint['handlers'] = { checkout }
|
export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout }
|
||||||
|
|
||||||
const checkoutApi = createEndpoint<CheckoutAPI>({
|
const checkoutApi = createEndpoint<CheckoutAPI>({
|
||||||
handler: checkoutEndpoint,
|
handler: checkoutEndpoint,
|
||||||
|
Reference in New Issue
Block a user