<commit_before>import paypal from 'npm:paypal-checkout';
import Component from '@ember/component';
import { inject as service } from '@ember/service';

export default Component.extend({

  router: service(),

  async didInsertElement() {
    this._super(...arguments);
    let order = this.get('data');
    let loader = this.get('loader');
    let notify = this.get('notify');
    let router = this.get('router');
    let createPayload = {
      'data': {
        'attributes': {
          'return-url' : `${window.location.origin}/orders/${order.identifier}/placed`,
          'cancel-url' : `${window.location.origin}/orders/${order.identifier}/placed`
        },
        'type': 'paypal-payment'
      }
    };

    paypal.Button.render({
      env: 'sandbox',

      commit: true,

      style: {
        label : 'pay',
        size  : 'medium', // tiny, small, medium
        color : 'gold', // orange, blue, silver
        shape : 'pill'    // pill, rect
      },

      payment() {
        return loader.post(`orders/${order.identifier}/create-paypal-payment`, createPayload)
          .then(res => {<commit_msg>Remove hardcoded sandbox environment for paypal checkout<commit_after>import paypal from 'npm:paypal-checkout';
import Component from '@ember/component';
import { inject as service } from '@ember/service';

export default Component.extend({

  router: service(),

  async didInsertElement() {
    this._super(...arguments);
    let order = this.get('data');
    let loader = this.get('loader');
    let notify = this.get('notify');
    let router = this.get('router');
    let createPayload = {
      'data': {
        'attributes': {
          'return-url' : `${window.location.origin}/orders/${order.identifier}/placed`,
          'cancel-url' : `${window.location.origin}/orders/${order.identifier}/placed`
        },
        'type': 'paypal-payment'
      }
    };

    paypal.Button.render({
      commit: true,

      style: {
        label : 'pay',
        size  : 'medium', // tiny, small, medium
        color : 'gold', // orange, blue, silver
        shape : 'pill'    // pill, rect
      },

      payment() {
        return loader.post(`orders/${order.identifier}/create-paypal-payment`, createPayload)
          .then(res => {
{'fraction_non_alphanumeric': 0.16209034543844109, 'fraction_numerical': 0.0, 'mean_word_length': 2.5077639751552794, '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': '3373583', 'n_tokens_mistral': 656, 'n_tokens_neox': 645, 'n_words': 146}