define(
    [
        'ko',
        'Magento_Checkout/js/checkout-data',
        'Magento_Catalog/js/price-utils'
    ],
    function (ko, checkoutData, priceUtils) {
        "use_strict";
        return {
            threebyfour_methods: window.checkoutConfig.payment.oney_threebyfour.threebyfour_methods,
            getNumber: function (code) {
                if (window.checkoutConfig.payment.oney_threebyfour[code]) {
                    return window.checkoutConfig.payment.oney_threebyfour[code].number;
                }
                return 'Oney Payments';
            },
            getTitle: function (code) {
                if (window.checkoutConfig.payment.oney_threebyfour[code]) {
                    return window.checkoutConfig.payment.oney_threebyfour[code].title;
                }
                return 'Oney Payment';
            },
            getPostalRegex: function () {
                return RegExp(window.checkoutConfig.payment.oney_threebyfour.postal);
            },
            getPhoneRegex: function () {
                return RegExp(window.checkoutConfig.payment.oney_threebyfour.phone);
            },
            getCountry: function () {
                return RegExp(window.checkoutConfig.payment.oney_threebyfour.country);
            },
            getMerchantGuid: function () {
                return window.checkoutConfig.payment.oney_threebyfour.merchant_guid;
            },
            getError: function (code) {
                return window.checkoutConfig.payment.oney_threebyfour.error[code];
            },
            formatPriceForQuote: function (price, quote) {
                return priceUtils.formatPrice(price, quote.getPriceFormat());
            },
            translate: function (text) {
                const translate = window.checkoutConfig.payment.oney_threebyfour.translate;
                if (typeof translate[text] !== "undefined") return translate[text];
                return text;
            }
        }
    }
);
