UPD: Completed checkbox func
This commit is contained in:
parent
36aa100b17
commit
33527f856d
@ -16,16 +16,17 @@ const PayPal = ({cart}) => {
|
|||||||
|
|
||||||
|
|
||||||
const createOrder = (data, actions) => {
|
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({
|
return actions.order.create({
|
||||||
purchase_units: [{
|
purchase_units: cart.map(item => {
|
||||||
description: "Fatek B1-14MR2 PLC",
|
return {
|
||||||
amount: {
|
reference_id: item.ID,
|
||||||
currency_code: "USD",
|
description: item.productName,
|
||||||
value: 89.99,
|
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}
|
fundingSource={FUNDING.PAYPAL}
|
||||||
style={{ height: 25 }}
|
style={{ height: 25 }}
|
||||||
forceReRender={[cart]}
|
forceReRender={[cart]}
|
||||||
|
disabled={cart.length === 0}
|
||||||
createOrder={createOrder}
|
createOrder={createOrder}
|
||||||
onApprove={onApprove}
|
onApprove={onApprove}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</PayPalScriptProvider>
|
</PayPalScriptProvider>
|
||||||
</div>
|
</div>
|
||||||
{/* This is a nice touch */}
|
|
||||||
{showInvoice && <Invoice invoiceDetails={invoiceDetails} />}
|
{showInvoice && <Invoice invoiceDetails={invoiceDetails} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user