Adding Cart id for order number
This commit is contained in:
@@ -141,5 +141,5 @@ get '/pikpay/confirmation' do
|
||||
report_to_trello(cart)
|
||||
send_order_email(cart)
|
||||
|
||||
redirect "#{RibicaConfig.ROOT_ADDRESS}/hvala"
|
||||
redirect "#{RibicaConfig::ROOT_ADDRESS}/hvala"
|
||||
end
|
||||
|
||||
@@ -26,6 +26,7 @@ var CheckoutPage = React.createClass({
|
||||
disabled={!this.state.isDeliveryDestinationValid}
|
||||
cashOnDeliveryDisabled={!this.state.isDeliveryDestinationValid || this.state.deliveryDestination.get('gift')}
|
||||
onCashClick={this._onOrderClick}
|
||||
cartId={this.state.cart.get('id')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -33,13 +34,15 @@ var CheckoutPage = React.createClass({
|
||||
var last_used_payment;
|
||||
if(this.state.deliveryDestination.get('payment_method') == 'paypal') {
|
||||
last_used_payment = (
|
||||
<PaypalButton disabled={!this.state.isDeliveryDestinationValid} onSubmitPaypal={this._handleOnSubmitPaypal} deliveryDestination={this.state.deliveryDestination} amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} />
|
||||
<PaypalButton disabled={!this.state.isDeliveryDestinationValid} onSubmitPaypal={this._handleOnSubmitPaypal} deliveryDestination={this.state.deliveryDestination} amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} cartId={this.state.cart.get('id')}/>
|
||||
);
|
||||
} else if(this.state.deliveryDestination.get('payment_method') == 'pikpay') {
|
||||
<PikpayButton amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} disabled={!this.state.isDeliveryDestinationValid} deliveryDestination={this.state.deliveryDestination}/>
|
||||
last_used_payment = (
|
||||
<PikpayButton amount={CartStore.getAmount()} deliveryCost={CartStore.getDeliveryCost(false)} disabled={!this.state.isDeliveryDestinationValid} deliveryDestination={this.state.deliveryDestination} cartId={this.state.cart.get('id')}/>
|
||||
);
|
||||
} else {
|
||||
last_used_payment = (
|
||||
<CashOnDeliveryButton onCashClick={this._onOrderClick} disabled={!this.state.isDeliveryDestinationValid || this.state.deliveryDestination.get('gift')}/>
|
||||
<CashOnDeliveryButton onCashClick={this._onOrderClick} disabled={!this.state.isDeliveryDestinationValid || this.state.deliveryDestination.get('gift')} cartId={this.state.cart.get('id')}/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ var CashOnDeliveryButton = require('./cashOnDeliveryButton');
|
||||
|
||||
var PaymentSelect = React.createClass({
|
||||
render: function() {
|
||||
var cashOnDeliveryBtn = ( <CashOnDeliveryButton onCashClick={this.props.onCashClick} disabled={this.props.cashOnDeliveryDisabled}/> );
|
||||
var pikpayBtn = ( <PikpaylButton amount={this.props.amount} deliveryCost={this.props.deliveryCost} disabled={this.props.disabled} deliveryDestination={this.props.deliveryDestination}/> );
|
||||
var paypalBtn = ( <PaypalButton disabled={this.props.disabled} deliveryDestination={this.props.deliveryDestination} amount={this.props.amount} deliveryCost={this.props.deliveryCost} /> );
|
||||
var cashOnDeliveryBtn = ( <CashOnDeliveryButton onCashClick={this.props.onCashClick} disabled={this.props.cashOnDeliveryDisabled} cartId={this.props.cartId}/> );
|
||||
var pikpayBtn = ( <PikpaylButton amount={this.props.amount} deliveryCost={this.props.deliveryCost} disabled={this.props.disabled} deliveryDestination={this.props.deliveryDestination} cartId={this.props.cartId}/> );
|
||||
var paypalBtn = ( <PaypalButton disabled={this.props.disabled} deliveryDestination={this.props.deliveryDestination} amount={this.props.amount} deliveryCost={this.props.deliveryCost} cartId={this.props.cartId}/> );
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -29,7 +29,7 @@ var PaypalButton = React.createClass({
|
||||
<input type="hidden" name="business" value={Globals.PaypalId} />
|
||||
<input type="hidden" name="lc" value="BA" />
|
||||
<input type="hidden" name="item_name" value="Item" />
|
||||
<input type="hidden" name="item_number" value="555" />
|
||||
<input type="hidden" name="item_number" value={this.props.cartId} />
|
||||
<input type="hidden" name="amount" value={amount} />
|
||||
<input type="hidden" name="currency_code" value="EUR" />
|
||||
<input type="hidden" name="button_subtype" value="services" />
|
||||
|
||||
@@ -14,8 +14,8 @@ var PikpayButton = React.createClass({
|
||||
var total = this.props.amount + this.props.deliveryCost;
|
||||
total = total * 100;
|
||||
var order_info = "Info";
|
||||
var order_number = "4678678678229";
|
||||
var key = "Ribica"
|
||||
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");
|
||||
|
||||
@@ -22,6 +22,7 @@ module.exports = {
|
||||
PaypalId: "W7GKS2Q9ZGLGY",
|
||||
PikpayFormUrl: "https://ipgtest.pikpay.ba/form",
|
||||
PikpayAuthenticityToken: "1bb1eea16bd6492c01262636897c0c2e3291a1ab",
|
||||
PikpayKey: "Ribica",
|
||||
|
||||
Slugify: function(text) {
|
||||
return text.toString().toLowerCase()
|
||||
|
||||
@@ -10,6 +10,7 @@ var DeliveryDestination = require('../models/deliveryDestination');
|
||||
var OrderConfirmation = require('../models/orderConfirmation');
|
||||
var Place = require('../models/place');
|
||||
var Validation = require('../utils/validation');
|
||||
var Cart = require('../models/cart');
|
||||
|
||||
var _ = require('underscore');
|
||||
|
||||
@@ -25,6 +26,8 @@ var _deliveryCosts = new Place({
|
||||
postalCode: _deliveryDestination.get('place')
|
||||
});
|
||||
|
||||
var _cart = new Cart();
|
||||
|
||||
var _addressColapsed = false;
|
||||
|
||||
var supportedPlaces = [{
|
||||
@@ -2568,29 +2571,31 @@ var nameOfThePlace = function(code) {
|
||||
}
|
||||
|
||||
var loadCart = function() {
|
||||
_itemsInCart.fetch({
|
||||
success: function() {
|
||||
states = {}
|
||||
for (var i = 0; i < _itemsInCart.models.length; i++) {
|
||||
var itemInCart = _itemsInCart.models[i];
|
||||
states[itemInCart.get('item_id')] = itemInCart;
|
||||
}
|
||||
_itemsForDisplay.fetch({
|
||||
success: function() {
|
||||
CartActions.dataLoaded();
|
||||
_cart.fetch({success: function() {
|
||||
_itemsInCart.fetch({
|
||||
success: function() {
|
||||
states = {}
|
||||
for (var i = 0; i < _itemsInCart.models.length; i++) {
|
||||
var itemInCart = _itemsInCart.models[i];
|
||||
states[itemInCart.get('item_id')] = itemInCart;
|
||||
}
|
||||
_itemsForDisplay.fetch({
|
||||
success: function() {
|
||||
CartActions.dataLoaded();
|
||||
|
||||
_deliveryDestination.fetch({
|
||||
success: function() {
|
||||
validateDeliveryDestinationForm();
|
||||
collapseAddressIfNeeded();
|
||||
fetchPlace();
|
||||
CartActions.dataLoaded();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
_deliveryDestination.fetch({
|
||||
success: function() {
|
||||
validateDeliveryDestinationForm();
|
||||
collapseAddressIfNeeded();
|
||||
fetchPlace();
|
||||
CartActions.dataLoaded();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}});
|
||||
|
||||
_cartDataLoadCalled = true;
|
||||
};
|
||||
@@ -2875,7 +2880,8 @@ var CartStore = _.extend({}, EventEmitter.prototype, {
|
||||
deliveryCosts: _deliveryCosts,
|
||||
destinationValid: isDeliveryDestinationValid(),
|
||||
address_colapsed: _addressColapsed,
|
||||
deliveryCostsTarget: getDeliveryCostTarget()
|
||||
deliveryCostsTarget: getDeliveryCostTarget(),
|
||||
cart: _cart
|
||||
};
|
||||
return state;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user