<commit_before>const ModalService        = require("services/ModalService");
const ApiService          = require("services/ApiService");

Vue.component("change-payment-method", {

    props: [
        "template",
        "currentOrder",
        "allowedPaymentMethods"
    ],

    data()
    {
        return {
            isChangePossible: false,
            changePaymentModal: {},
            encodedPaymentMethods: {},
            paymentMethod: 0
        };
    },

    created()
    {
        this.$options.template = this.template;
    },

    /**
     * Initialize the change payment modal
     */
    ready()
    {
        this.changePaymentModal = ModalService.findModal(this.$els.changePaymentModal);
        this.isChangePossible = this.checkChangeAllowed();

        this.encodedPaymentMethods = JSON.parse(this.allowedPaymentMethods);
    },

    methods:
    {
        checkChangeAllowed()
        {
            return true;
        },

        openPaymentChangeModal()
        {
            this.getInitialPaymentMethod();

            this.changePaymentModal.show();
        },

        closeModal()
        {
            this.changePaymentModal.hide();
        },

        changePaymentMethod()
        {
            ApiService.post("/rest/io/order/payment?orderId=" + this.currentOrder.order.id + "&paymentMethodId=" + this.paymentMethod)
                .done(response =>
                {<commit_msg>some improvements for the api call<commit_after>const ModalService        = require("services/ModalService");
const ApiService          = require("services/ApiService");

Vue.component("change-payment-method", {

    props: [
        "template",
        "currentOrder",
        "allowedPaymentMethods"
    ],

    data()
    {
        return {
            isChangePossible: false,
            changePaymentModal: {},
            encodedPaymentMethods: {},
            paymentMethod: 0
        };
    },

    created()
    {
        this.$options.template = this.template;
    },

    /**
     * Initialize the change payment modal
     */
    ready()
    {
        this.changePaymentModal = ModalService.findModal(this.$els.changePaymentModal);
        this.isChangePossible = this.checkChangeAllowed();

        this.encodedPaymentMethods = JSON.parse(this.allowedPaymentMethods);
    },

    methods:
    {
        checkChangeAllowed()
        {
            return true;
        },

        openPaymentChangeModal()
        {
            this.getInitialPaymentMethod();

            this.changePaymentModal.show();
        },

        closeModal()
        {
            this.changePaymentModal.hide();
        },

        changePaymentMethod()
        {
            ApiService.post("/rest/io/order/payment", {orderId: this.currentOrder.order.id, paymentMethodId: this.paymentMethod})
                .done(response =>
                {
{'fraction_non_alphanumeric': 0.11231630510846746, 'fraction_numerical': 0.0006997900629811056, 'mean_word_length': 1.7919921875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4043863', 'n_tokens_mistral': 749, 'n_tokens_neox': 724, 'n_words': 104}