65 lines
3.2 KiB
JavaScript
65 lines
3.2 KiB
JavaScript
var React = require('react');
|
|
var ItemActions = require('../../actions/itemActions');
|
|
var NavigationActions = require('../../actions/navigationActions');
|
|
var NavigationStore = require('../../stores/navigationStore');
|
|
var CartStore = require('../../stores/cartStore');
|
|
var CartActions = require('../../actions/cartActions');
|
|
|
|
var Globals = require('../../globals');
|
|
var Router = require('react-router');
|
|
var sha1 = require('sha1');
|
|
|
|
var PikpayButton = React.createClass({
|
|
render: function() {
|
|
var total = this.props.amount + this.props.deliveryCost;
|
|
total = total.toFixed(2) * 100;
|
|
var order_info = "Info";
|
|
var order_number = this.props.cartId;
|
|
var key = Globals.PikpayKey;
|
|
var authenticity_token = Globals.PikpayAuthenticityToken;
|
|
var digest = sha1(key + order_number + total + "BAM");
|
|
var rebate_digest = sha1(key + order_number + total + total + "BAM");
|
|
var deliveryDestination = this.props.deliveryDestination;
|
|
var city = CartStore.getNameOfThePlace(deliveryDestination.get('place'));
|
|
var custom = JSON.stringify(
|
|
{
|
|
'anonymous_id_string': deliveryDestination.get('anonymous_id_string'),
|
|
'user_id': deliveryDestination.get('user_id')
|
|
});
|
|
|
|
return (<span></span> /*
|
|
<button type="button" onClick={this._onPikpayClick} disabled={this.props.disabled} className="btn mybutton payment-btn">Plati karticom
|
|
<form id="pikpay_form" action={Globals.PikpayFormUrl} method="post" target="_top">
|
|
<input type="hidden" name="ch_full_name" value={deliveryDestination.get('name')} />
|
|
<input type="hidden" name="ch_address" value={deliveryDestination.get('address')} />
|
|
<input type="hidden" name="ch_city" value={city} />
|
|
<input type="hidden" name="ch_zip" value={deliveryDestination.get('place')} />
|
|
<input type="hidden" name="ch_country" value="Bosna i Hercegovina" />
|
|
<input type="hidden" name="ch_phone" value={deliveryDestination.get('phone')} />
|
|
<input type="hidden" name="ch_email" value={deliveryDestination.get('email')} />
|
|
|
|
<input type="hidden" name="order_info" value={order_info} />
|
|
<input type="hidden" name="order_number" value={order_number} />
|
|
<input type="hidden" name="amount" value={total} />
|
|
<input type="hidden" name="currency" value="BAM" />
|
|
<input type="hidden" name="original_amount" value={total} />
|
|
<input type="hidden" name="language" value="hr" />
|
|
<input type="hidden" name="transaction_type" value="authorize" />
|
|
<input type="hidden" name="authenticity_token" value={authenticity_token} />
|
|
<input type="hidden" name="digest" value={digest} />
|
|
<input type="hidden" name="rebate_digest" value={rebate_digest} />
|
|
<input type="hidden" name="custom_params" value={custom} />
|
|
</form>
|
|
</button> */
|
|
);
|
|
},
|
|
_onPikpayClick: function(e) {
|
|
CartActions.changeDeliveryDestinationProperty('payment_method', 'pikpay');
|
|
CartStore.saveDeliveryDestinationAnd(function() {
|
|
$("#pikpay_form").submit();
|
|
});
|
|
}
|
|
});
|
|
|
|
module.exports = PikpayButton;
|