<commit_before>import wizardStepsConfig from './customer-create-config';

export default class CustomerCreateService {
  // @ngInject
  constructor($q, features, customersService, priceEstimatesService, expertsService) {
    this.$q = $q;
    this.features = features;
    this.customersService = customersService;
    this.priceEstimatesService = priceEstimatesService;
    this.expertsService = expertsService;
  }

  getSteps() {
    let steps = angular.copy(wizardStepsConfig);
    return steps.filter(step => !step.feature || this.features.isVisible(step.feature));
  }

  createCustomer(model) {
    let customer = this.customersService.$create();
    angular.extend(customer, this.composeCustomerModel(model));
    return customer.$save().then(customer => {
      let promises = [
        this.priceEstimatesService.update(model.threshold.priceEstimate).then(() => {
          customer.billing_price_estimate.limit = model.threshold.priceEstimate.limit;
          customer.billing_price_estimate.threshold = model.threshold.priceEstimate.threshold;
        })
      ];

      if (model.agree_with_policy) {
        promises.push(this.expertsService.register(customer));<commit_msg>Assign price estimate url before update<commit_after>import wizardStepsConfig from './customer-create-config';

export default class CustomerCreateService {
  // @ngInject
  constructor($q, features, customersService, priceEstimatesService, expertsService) {
    this.$q = $q;
    this.features = features;
    this.customersService = customersService;
    this.priceEstimatesService = priceEstimatesService;
    this.expertsService = expertsService;
  }

  getSteps() {
    let steps = angular.copy(wizardStepsConfig);
    return steps.filter(step => !step.feature || this.features.isVisible(step.feature));
  }

  createCustomer(model) {
    let customer = this.customersService.$create();
    angular.extend(customer, this.composeCustomerModel(model));
    return customer.$save().then(customer => {
      model.threshold.priceEstimate.url = customer.billing_price_estimate.url;

      let promises = [
        this.priceEstimatesService.update(model.threshold.priceEstimate).then(() => {
          customer.billing_price_estimate.limit = model.threshold.priceEstimate.limit;
          customer.billing_price_estimate.threshold = model.threshold.priceEstimate.threshold;
        })
      ];

      if (model.agree_with_policy) {
        promises.push(this.expertsService.register(customer));
{'fraction_non_alphanumeric': 0.11240934730056407, 'fraction_numerical': 0.0, 'mean_word_length': 4.036511156186613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7247047', 'n_tokens_mistral': 697, 'n_tokens_neox': 681, 'n_words': 106}