generalLogic: { PopulatePayPal: function () { var pageSeries = App.PageSeries.Shopping; pageSeries.payPalOrderRequest = new App.Components.OnlinePayment.PayPalOrder("EVOKE"); var purchaseItems = pageSeries.viewModel.DS_ShoppingBasket.current.OrderLines.items; for (var i = 0; i < purchaseItems.length; i++) { // Loop through the Items in the shopping basket pageSeries.payPalOrderRequest.addPurchaseItem( pageSeries.widgets.OnlinePaymentPaypalPaymentTest.definition.defaultCurrency, // Add the ISO currency code to be used for this order purchaseItems[i].SalesPrice, // Add the Unit amount for this item purchaseItems[i].Quantity, // Add the quantity for this item 0, // Add the tax amount for this item purchaseItems[i].Product.Description, // Add the description for this item purchaseItems[i].Product.ProductName, // Add the product name for this item purchaseItems[i].Product.ProductNumber); // Add the SKU or product number for this item } pageSeries.payPalOrderRequest.addAmountBreakDown( pageSeries.widgets.OnlinePaymentPaypalPaymentTest.definition.defaultCurrency, // Add the ISO currency code to be used for this order pageSeries.viewModel.DS_ShoppingBasket.current.OrderTotal, // The Grand Total for this order pageSeries.viewModel.DS_ShoppingBasket.current.OrderTotal, // The Item Total for this order 0, // The Tax Total for this order 0, // The Shipping Total for this order 0, // The Handling Total for this order 0); // The Shipping Discount for this order pageSeries.payPalOrderRequest.addShippingAddress( // Add the PayPal Shipping address (all fields mandatory) pageSeries.viewModel.DS_ShoppingBasket.current.Customer.Name, //Name pageSeries.viewModel.DS_ShoppingBasket.current.Customer.Address, //Address1 " ", //Address2 (spaces if not provided) "TEST2", //City pageSeries.viewModel.DS_ShoppingBasket.current.Customer.ZipCode, //Postal " ", //State (spaces if not required or provided) "US"); //ISO pageSeries.payPalOrderRequest.submitOrder(); }, },