Price and shipping to euro

This commit is contained in:
adam.harbas@a-net.ba
2016-01-07 09:06:54 +01:00
parent 3a3ba87066
commit 81140de4d7
3 changed files with 28 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ var PaymentSelect = React.createClass({
render: function() {
return (
<div className="payment_select">
<PaypalButton deliveryDestination={this.props.deliveryDestination} />
<PaypalButton deliveryDestination={this.props.deliveryDestination} amount={this.props.amount} deliveryCost={this.props.deliveryCost} />
</div>);
}
});

View File

@@ -9,6 +9,8 @@ var Router = require('react-router');
var PaypalButton = React.createClass({
render: function() {
var deliveryDestination = JSON.stringify(this.props.deliveryDestination);
var amount = Globals.ConvertToEuro(this.props.amount);
var deliveryCost = Globals.ConvertToEuro(this.props.deliveryCost);
return (
<div>
@@ -18,7 +20,7 @@ var PaypalButton = React.createClass({
<input type="hidden" name="lc" value="BA" />
<input type="hidden" name="item_name" value="Item name" />
<input type="hidden" name="item_number" value="555" />
<input type="hidden" name="amount" value="10.66" />
<input type="hidden" name="amount" value={amount} />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="button_subtype" value="services" />
<input type="hidden" name="no_note" value="0" />
@@ -27,7 +29,7 @@ var PaypalButton = React.createClass({
<input type="hidden" name="rm" value="1" />
<input type="hidden" name="return" value="https://www.ribica.ba/hvala_paypal" />
<input type="hidden" name="cancel_return" value="https://www.ribica.ba/odgodjeno" />
<input type="hidden" name="shipping" value="5.20" />
<input type="hidden" name="shipping" value={deliveryCost} />
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" />

View File

@@ -2790,6 +2790,29 @@ var CartStore = _.extend({}, EventEmitter.prototype, {
return supportedPlaces;
},
getAmount: function() {
var counts = states;
var total = 0;
if (counts && _itemsForDisplay) {
var items = _itemsForDisplay.models;
for (var i = 0; i < items.length; i++) {
var item = items[i];
var count = counts[item.get('id')].get('count');
var price = item.get('list_price');
total += (price * count)
};
}
return total;
},
getDeliveryCost: function(instantDelivery) {
return instantDelivery ? _deliveryCosts.get('instant_delivery_price')
: _deliveryCosts.get('delivery_price');
},
getWholeCartState: function() {
var numberOfItems = 0;