import { FetchResult } from "@apollo/client/core"; import type { CustomHeaders, SetPaymentMethodOnCartInputs, SetPaymentMethodOnCartMutation } from "@vue-storefront/magento-types"; import { CustomQuery } from "@vue-storefront/magento-types"; import { Context } from "../../types/context"; /** * Set payment method on cart. * * @example * Simple usage: * ```ts * import { sdk } from '~/sdk.config.ts'; * * const params = { * cart_id: 'some-cart-id' * payment_method: { * code: 'checkmo' * } * }; * * // sets payment method on cart and return payment information * // data contains properties like `available_payment_methods` and `selected_payment_method` * const { data } = await sdk.magento.setPaymentMethodOnCart(params); * ``` * * @example * Creating a custom GraphQL query for configuring the response data structure * * ```ts * module.exports = { * integrations: { * magento: { * customQueries: { * 'set-payment-method-on-cart-custom-query': ({ variables, metadata }) => ({ * variables, * query: ` * mutation setPaymentMethodOnCart($input: SetPaymentMethodOnCartInput) { * setPaymentMethodOnCart(input: $input) { * cart { * ${metadata.fields} * } * } * } * ` * }), * }, * } * } * }; * ``` * * @example * Using a custom GraphQL query created with the `set-payment-method-on-cart-custom-query` in the previous example * * ```ts * import { sdk } from '~/sdk.config.ts'; * // reduce the amount of fields returned by the query, when compared to the default query * const customQuery = { * setPaymentMethodOnCart: 'set-payment-method-on-cart-custom-query', * metadata: { * fields: 'available_payment_methods { code title }' * } * }; * * // Params and options are the same as in the previous example * const { data } = await sdk.magento.setPaymentMethodOnCart(params, customQuery); * * // data contains only the properties selected in the custom query * ``` */ export declare function setPaymentMethodOnCart(context: Context, input: SetPaymentMethodOnCartInputs, customQuery?: CustomQuery, customHeaders?: CustomHeaders): Promise>; //# sourceMappingURL=index.d.ts.map