<commit_before>App.OrderPaymentController = Em.ObjectController.extend({
    needs: ['application', 'projectDonationList', 'fundRaiserDonationList'],

    errorsFixedBinding: 'paymentMethodController.errorsFixed',
    validationErrorsBinding: 'paymentMethodController.validationErrors',
    blockingErrorsBinding: 'paymentMethodController.blockingErrors',
    isBusyBinding: 'paymentMethodController.isBusy',
    currentPaymentMethod: null,
    methods: null,

    currentPaymentMethodURL: function() {
        return 'http://www.' + this.get('currentPaymentMethod.provider') + '.com';
    }.property('currentPaymentMethod.provider'),

    // Override modal willOpen handler to fetch the payment methods
    willOpen: function () {
        var _this = this;

        App.PaymentMethod.find().then(
            // Success
            function(methods) {
                _this.set('methods', methods);
                // Also explicitely reload the payment method tab when the methods are fetched. This is required
                // when the user closes and reopens the modal. 
                _this._setPaymentMethodController();
            },
            // Failure
            function(methods) {
                throw new Em.error('Fetching PaymentMethod\'s failed!');
            }
        );
    },

    resetCurrentPaymentMethod: function() {
        var methods = this.get('methods'),
            currentItem = methods.objectAt(methods.get('length') - 1);<commit_msg>return if there is no previous payment method<commit_after>App.OrderPaymentController = Em.ObjectController.extend({
    needs: ['application', 'projectDonationList', 'fundRaiserDonationList'],

    errorsFixedBinding: 'paymentMethodController.errorsFixed',
    validationErrorsBinding: 'paymentMethodController.validationErrors',
    blockingErrorsBinding: 'paymentMethodController.blockingErrors',
    isBusyBinding: 'paymentMethodController.isBusy',
    currentPaymentMethod: null,
    methods: null,

    currentPaymentMethodURL: function() {
        return 'http://www.' + this.get('currentPaymentMethod.provider') + '.com';
    }.property('currentPaymentMethod.provider'),

    // Override modal willOpen handler to fetch the payment methods
    willOpen: function () {
        var _this = this;

        App.PaymentMethod.find().then(
            // Success
            function(methods) {
                _this.set('methods', methods);
                // Also explicitely reload the payment method tab when the methods are fetched. This is required
                // when the user closes and reopens the modal. 
                _this._setPaymentMethodController();
            },
            // Failure
            function(methods) {
                throw new Em.error('Fetching PaymentMethod\'s failed!');
            }
        );
    },

    resetCurrentPaymentMethod: function() {
        if (!this.get('payment_method')) {
            return;
        }

        var methods = this.get('methods'),
            currentItem = methods.objectAt(methods.get('length') - 1);
{'fraction_non_alphanumeric': 0.1043848167539267, 'fraction_numerical': 0.0006544502617801048, 'mean_word_length': 2.592244418331375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7659589', 'n_tokens_mistral': 753, 'n_tokens_neox': 719, 'n_words': 175}