UPD: Completed checkbox func
This commit is contained in:
parent
36aa100b17
commit
33527f856d
@ -16,16 +16,17 @@ const PayPal = ({cart}) => {
|
||||
|
||||
|
||||
const createOrder = (data, actions) => {
|
||||
// No idea why "cart" is still empty array... data is showing in the state (React Dev Tools)
|
||||
console.log(cart);
|
||||
return actions.order.create({
|
||||
purchase_units: [{
|
||||
description: "Fatek B1-14MR2 PLC",
|
||||
amount: {
|
||||
currency_code: "USD",
|
||||
value: 89.99,
|
||||
}
|
||||
}]
|
||||
purchase_units: cart.map(item => {
|
||||
return {
|
||||
reference_id: item.ID,
|
||||
description: item.productName,
|
||||
amount: {
|
||||
currency_code: "USD",
|
||||
value: item.price, // using price rather than discounted price for now, (item ID 2 has discounted price: "0.00")
|
||||
}
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@ -45,13 +46,13 @@ const PayPal = ({cart}) => {
|
||||
fundingSource={FUNDING.PAYPAL}
|
||||
style={{ height: 25 }}
|
||||
forceReRender={[cart]}
|
||||
disabled={cart.length === 0}
|
||||
createOrder={createOrder}
|
||||
onApprove={onApprove}
|
||||
/>
|
||||
</div>
|
||||
</PayPalScriptProvider>
|
||||
</div>
|
||||
{/* This is a nice touch */}
|
||||
{showInvoice && <Invoice invoiceDetails={invoiceDetails} />}
|
||||
</>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user