adrianmacneil/omnipay — pull request #154 by adrianmacneil (2013-10-26 08:02:32+00:00)
Title: Add PayPal/gateway line item details

I'm working on passing line item details to PayPal (and other gateways which support this - see #32) and looking for feedback on the API.

It currently looks like this:

$request->setItems(array(
array('name' => 'Food', 'quantity' => 1, 'price' => '40.00'),
array('name' => 'Drinks', 'quantity' => 2, 'price' => '6.00'),
));

// or

$items = new ItemBag;
$items->add(array('name' => 'Food', 'quantity' => 1, 'price' => '10.00'));
$request->setItems($items);

// or

$items = new ItemBag;
$item = new Item;
$item->setName('Cheese');
$item->setQuantity(1);
$item->setPrice(99.00);
$items->add($item);
$request->setItems($items);

Similar to the CreditCard object, you can either pass an array and have the ItemBag object instantiated for you, or you can pass the actual item and it will be used.

Feedback welcome.