HEX
Server: LiteSpeed
System: Linux premium127.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User: luxbsolr (925)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/luxbsolr/cardsord.store/wp-content/plugins/woocommerce-shipping/client/utils/payment.ts
import { getConfig } from './config';
import { WCShippingConfig } from '../types';
import { camelCaseKeys } from './common';

export const hasSelectedPaymentMethod = (
	{
		accountSettings,
	}: Pick< WCShippingConfig, 'accountSettings' > = getConfig()
) => accountSettings.purchaseSettings.selected_payment_method_id > 0;

export const hasPaymentMethod = (
	{
		accountSettings,
	}: Pick< WCShippingConfig, 'accountSettings' > = getConfig()
) => accountSettings.purchaseMeta.payment_methods.length > 0;

export const getPaymentSettings = ( { accountSettings } = getConfig() ) =>
	camelCaseKeys( accountSettings.purchaseSettings );

export const getAddPaymentMethodURL = (
	{
		accountSettings,
	}: Pick< WCShippingConfig, 'accountSettings' > = getConfig()
) => accountSettings.purchaseMeta.add_payment_method_url;

export const canManagePayments = (
	{
		accountSettings,
	}: Pick< WCShippingConfig, 'accountSettings' > = getConfig()
) => accountSettings.purchaseMeta.can_manage_payments;