Skip to content

Commit 551584e

Browse files
committed
Update PayPal item details
1 parent 17e79b3 commit 551584e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/Omnipay/PayPal/Message/ExpressAuthorizeRequest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ public function getData()
5353
$items = $this->getItems();
5454
if ($items) {
5555
foreach ($items as $n => $item) {
56-
$data["PAYMENTREQUEST_0_NAME$n"] = $item->getName();
57-
$data["PAYMENTREQUEST_0_QTY$n"] = $item->getQuantity();
58-
$data["PAYMENTREQUEST_0_AMT$n"] = $item->getPrice();
56+
$data["L_PAYMENTREQUEST_0_NAME$n"] = $item->getName();
57+
$data["L_PAYMENTREQUEST_0_DESC$n"] = $item->getDescription();
58+
$data["L_PAYMENTREQUEST_0_QTY$n"] = $item->getQuantity();
59+
$data["L_PAYMENTREQUEST_0_AMT$n"] = $this->formatCurrency($item->getPrice());
5960
}
6061
}
6162

tests/Omnipay/PayPal/Message/ExpressAuthorizeRequestTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,20 @@ public function testGetDataWithCard()
123123
public function testGetDataWithItems()
124124
{
125125
$this->request->setItems(array(
126-
array('name' => 'Floppy Disk', 'quantity' => 2, 'price' => '10.00'),
127-
array('name' => 'CD-ROM', 'quantity' => 1, 'price' => '40.00'),
126+
array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
127+
array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
128128
));
129129

130130
$data = $this->request->getData();
131-
$this->assertSame('Floppy Disk', $data['PAYMENTREQUEST_0_NAME0']);
132-
$this->assertSame(2, $data['PAYMENTREQUEST_0_QTY0']);
133-
$this->assertSame('10.00', $data['PAYMENTREQUEST_0_AMT0']);
134-
135-
$this->assertSame('CD-ROM', $data['PAYMENTREQUEST_0_NAME1']);
136-
$this->assertSame(1, $data['PAYMENTREQUEST_0_QTY1']);
137-
$this->assertSame('40.00', $data['PAYMENTREQUEST_0_AMT1']);
131+
$this->assertSame('Floppy Disk', $data['L_PAYMENTREQUEST_0_NAME0']);
132+
$this->assertSame('MS-DOS', $data['L_PAYMENTREQUEST_0_DESC0']);
133+
$this->assertSame(2, $data['L_PAYMENTREQUEST_0_QTY0']);
134+
$this->assertSame('10.00', $data['L_PAYMENTREQUEST_0_AMT0']);
135+
136+
$this->assertSame('CD-ROM', $data['L_PAYMENTREQUEST_0_NAME1']);
137+
$this->assertSame('Windows 95', $data['L_PAYMENTREQUEST_0_DESC1']);
138+
$this->assertSame(1, $data['L_PAYMENTREQUEST_0_QTY1']);
139+
$this->assertSame('40.00', $data['L_PAYMENTREQUEST_0_AMT1']);
138140
}
139141

140142
public function testHeaderImageUrl()

0 commit comments

Comments
 (0)