<commit_before>/*
 Copyright 2015 OpenMarket Ltd
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

'use strict';

angular.module('paymentService', [])
.service('paymentService', ['$http', '$window', 'matrixService', 'modelService', 
function ($http, $window, matrixService, modelService) {
    var LS_EULA = "com.openmarket.eula";

    var getAccountRoom = function() {
        var rooms = modelService.getRooms();
        for (var roomId in rooms) {
            if (!rooms.hasOwnProperty(roomId)) continue;
            var room = rooms[roomId];
            var createEvent = room.now.state("m.room.create");
            if (createEvent && createEvent.user_id === "@sms:openmarket.com") {
                return room;
            }
        }
    };

    this.getCredit = function() {
        var me = matrixService.config().user_id;
        var room = getAccountRoom();
        if (room) {
            var creditEvent = room.now.state("com.openmarket.credit", me);
            if (creditEvent && creditEvent.content) {
                if (creditEvent.content.credit) {
                    if (creditEvent.content.currency == "USD") {
                        return "$" + creditEvent.content.credit;
                    }
                    else {
                        return creditEvent.content.credit + " " + creditEvent.content.currency;
                    }
                }
            }
        }
        return "$0";
    };

    this.getEula = function() {
        if (!webClientConfig.paymentEulaUrl) {
            console.error("No EULA url");
            return;
        }
        var promise = $http.get(webClientConfig.paymentEulaUrl)
        return promise;
    };

    this.acceptEula = function() {
        console.log("Accepting EULA");
        $window.localStorage.setItem(LS_EULA, true);
    };

    this.hasAcceptedEula = function() {
        return $window.localStorage.getItem(LS_EULA);
    }
}]);
<commit_msg>Update AS admin user ID to reflect the location of the HS<commit_after>/*
 Copyright 2015 OpenMarket Ltd
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

'use strict';

angular.module('paymentService', [])
.service('paymentService', ['$http', '$window', 'matrixService', 'modelService', 
function ($http, $window, matrixService, modelService) {
    var LS_EULA = "com.openmarket.eula";

    var getAccountRoom = function() {
        var rooms = modelService.getRooms();
        for (var roomId in rooms) {
            if (!rooms.hasOwnProperty(roomId)) continue;
            var room = rooms[roomId];
            var createEvent = room.now.state("m.room.create");
            if (createEvent && createEvent.user_id === "@sms:matrix.openmarket.com") {
                return room;
            }
        }
    };

    this.getCredit = function() {
        var me = matrixService.config().user_id;
        var room = getAccountRoom();
        if (room) {
            var creditEvent = room.now.state("com.openmarket.credit", me);
            if (creditEvent && creditEvent.content) {
                if (creditEvent.content.credit) {
                    if (creditEvent.content.currency == "USD") {
                        return "$" + creditEvent.content.credit;
                    }
                    else {
                        return creditEvent.content.credit + " " + creditEvent.content.currency;
                    }
                }
            }
        }
        return "$0";
    };

    this.getEula = function() {
        if (!webClientConfig.paymentEulaUrl) {
            console.error("No EULA url");
            return;
        }
        var promise = $http.get(webClientConfig.paymentEulaUrl)
        return promise;
    };

    this.acceptEula = function() {
        console.log("Accepting EULA");
        $window.localStorage.setItem(LS_EULA, true);
    };

    this.hasAcceptedEula = function() {
        return $window.localStorage.getItem(LS_EULA);
    }
}]);

{'fraction_non_alphanumeric': 0.10961420698101654, 'fraction_numerical': 0.003674219228413962, 'mean_word_length': 2.147077713551702, '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': '5518367', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1283, 'n_words': 367}