<commit_before>// Copyright (C) 2016 Goom Inc. All rights reserved.

import React, { PropTypes } from 'react';

import numberUtil from 'commons/utils/numberUtil';

export default React.createClass({
  propTypes: {
    order: PropTypes.object,
  },
  contextTypes: {
    activeCurrency: PropTypes.string,
    currencySign: PropTypes.object,
  },
  render() {
    const { order } = this.props;
    const { activeCurrency, currencySign } = this.context;
    const formatPrice = (type) => {
      return numberUtil.formatPrice(order[`${type}${activeCurrency}`], activeCurrency, currencySign);
    };
    const orderPrice = numberUtil.formatPrice(
      +(order[`tax${activeCurrency}`] || 0) + +(order[`handlingFee${activeCurrency}`] || 0) + +(order[`shippingCost${activeCurrency}`] || 0),
      activeCurrency,
      currencySign,
    );
    const subtotalPrice = formatPrice('subtotal');
    const taxPrice = formatPrice('tax');
    const handlingFeePrice = formatPrice('handlingFee');
    const shippingCostPrice = formatPrice('shippingCost');
    const totalPrice = formatPrice('total');
    return (
      <div className="payment-info-container">
        <div className="row">
          <div className="cell title-cell">
            <div className="title">상품금액</div>
            <div className="price">{subtotalPrice}</div>
          </div>
          <div className="cell title-cell">
            <div className="title">주문비용</div>
            <div className="price">{orderPrice}</div>
          </div>
          <div className="cell title-cell">
            <div className="title">기타</div>
            <div className="price">0</div>
          </div>
          <div className="cell title-cell">
            <div className="title">결제금액</div>
            <div className="price">{totalPrice}</div>
          </div>
        </div>
        <div className="row">
          <div className="cell content-cell">
            <div className="left">+</div>
            <div className="right">상품가격: {subtotalPrice}</div>
          </div>
          <div className="cell content-cell">
            <div className="left">+</div>
            <div className="right">사입비: {handlingFeePrice}</div>
            <div className="left">+</div>
            <div className="right">배송비: {shippingCostPrice}</div>
            <div className="left">+</div>
            <div className="right">부가세: {taxPrice}</div>
          </div>
          <div className="cell content-cell">
          </div>
          <div className="cell content-cell">
            <div className="left">=</div>
            <div className="right">{totalPrice}</div>
          </div>
        </div>
      </div>
    );
  },
});
<commit_msg>render adjustment info.<commit_after>// Copyright (C) 2016 Goom Inc. All rights reserved.

import React, { PropTypes } from 'react';
import _ from 'lodash';

import numberUtil from 'commons/utils/numberUtil';
import orderUtil from 'commons/utils/orderUtil';

export default React.createClass({
  propTypes: {
    order: PropTypes.object,
  },
  contextTypes: {
    activeCurrency: PropTypes.string,
    currencySign: PropTypes.object,
  },
  render() {
    const { order } = this.props;
    const { activeCurrency, currencySign } = this.context;
    const formatPrice = (type) => {
      return numberUtil.formatPrice(order[`${type}${activeCurrency}`], activeCurrency, currencySign);
    };
    const orderPrice = numberUtil.formatPrice(
      +(order[`tax${activeCurrency}`] || 0) + +(order[`handlingFee${activeCurrency}`] || 0) + +(order[`shippingCost${activeCurrency}`] || 0),
      activeCurrency,
      currencySign,
    );
    const brands = _.groupBy(order.orderProducts.map((o) => o.brand), 'id');
    const brandName = (brandId) => _.get(brands, [brandId, 0, 'name', 'ko'], brandId);
    const renderAdjustment = (adjustment) =>
    (
      <div key={adjustment.id}>
        <div className="left">+</div>
        <div className="right">{brandName(adjustment.brandId)}: {numberUtil.formatPrice(adjustment[activeCurrency], activeCurrency, currencySign)}</div>
      </div>
    );
    const subtotalPrice = formatPrice('subtotal');
    const adjustmentPrice = formatPrice('adjustmentTotal');
    const taxPrice = formatPrice('tax');
    const handlingFeePrice = formatPrice('handlingFee');
    const shippingCostPrice = formatPrice('shippingCost');
    const totalPrice = formatPrice('total');
    return (
      <div className="payment-info-container">
        <div className="row">
          <div className="cell title-cell">
            <div className="title">상품금액</div>
            <div className="price">{subtotalPrice}</div>
          </div>
          <div className="cell title-cell">
            <div className="title">주문비용</div>
            <div className="price">{orderPrice}</div>
          </div>
          <div className="cell title-cell">
            <div className="title">기타</div>
            <div className="price">{adjustmentPrice}</div>
          </div>
          <div className="cell title-cell">
            <div className="title">결제금액</div>
            <div className="price">{totalPrice}</div>
          </div>
        </div>
        <div className="row">
          <div className="cell content-cell">
            <div className="left">+</div>
            <div className="right">상품가격: {subtotalPrice}</div>
          </div>
          <div className="cell content-cell">
            <div className="left">+</div>
            <div className="right">사입비: {handlingFeePrice}</div>
            <div className="left">+</div>
            <div className="right">배송비: {shippingCostPrice}</div>
            <div className="left">+</div>
            <div className="right">부가세: {taxPrice}</div>
          </div>
          <div className="cell content-cell">
            {_.get(order, 'adjustments', []).map(renderAdjustment)}
          </div>
          <div className="cell content-cell">
            <div className="left">=</div>
            <div className="right">{totalPrice}</div>
          </div>
        </div>
      </div>
    );
  },
});

{'fraction_non_alphanumeric': 0.16134370345854707, 'fraction_numerical': 0.0026476915439351315, 'mean_word_length': 2.651963746223565, 'pattern_counts': {'":': 0, '<': 125, '<?xml version=': 0, '>': 130, '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': '2756650', 'n_tokens_mistral': 1750, 'n_tokens_neox': 1830, 'n_words': 346}