Skip to content

Commit

Permalink
getTransactionReference() shouldn't return TemplateNumber
Browse files Browse the repository at this point in the history
Can you tell I'm testing this in production? :)
  • Loading branch information
mfauveau committed Apr 17, 2015
1 parent a677d4e commit 58465c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
11 changes: 4 additions & 7 deletions src/Omnipay/Pacnet/Message/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ public function getMessage()

public function getTransactionReference()
{
if (isset($this->data['TemplateNumber'])) {
return $this->data['TemplateNumber'];
} elseif (isset($this->data['TrackingNumber']) && $this->data['TrackingNumber'] != '') {
return $this->data['TrackingNumber'];
} else {
return null;
}
return (
isset($this->data['TrackingNumber']) &&
$this->data['TrackingNumber'] !== ''
) ? $this->data['TrackingNumber'] : null;
}
}
8 changes: 4 additions & 4 deletions tests/Omnipay/Pacnet/Message/RefundRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function setUp()
'paymentRoutingNumber' => '987743',
'amount' => '10.00',
'currency' => 'USD',
'transactionReference' => '10000165604'
'transactionReference' => '10000165737'
)
);
}
Expand Down Expand Up @@ -89,7 +89,7 @@ public function testEndpoint()
public function testTransactionReference()
{
$data = $this->request->getData();
$this->assertSame('10000165604', $data['TemplateNumber']);
$this->assertSame('10000165737', $data['TemplateNumber']);
}

public function testAmount()
Expand All @@ -111,7 +111,7 @@ public function testSendSuccess()

$this->assertTrue($response->isSuccessful());
$this->assertFalse($response->isRedirect());
$this->assertEquals('10000165604', $response->getTransactionReference());
$this->assertEquals('10000165737', $response->getTransactionReference());
$this->assertNull($response->getMessage());
$this->assertNull($response->getCode());
}
Expand All @@ -123,7 +123,7 @@ public function testSendError()

$this->assertFalse($response->isSuccessful());
$this->assertFalse($response->isRedirect());
$this->assertEquals('10000165604', $response->getTransactionReference());
$this->assertEquals('10000165737', $response->getTransactionReference());
$this->assertEquals('Invalid because the original payment is not a settled debit.', $response->getMessage());
$this->assertEquals('invalid:OriginalPaymentNotSettled', $response->getCode());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Omnipay/Pacnet/Message/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testRefundSuccess()

$this->assertTrue($response->isSuccessful());
$this->assertFalse($response->isRedirect());
$this->assertEquals('10000165604', $response->getTransactionReference());
$this->assertEquals('10000165737', $response->getTransactionReference());
$this->assertNull($response->getMessage());
$this->assertNull($response->getCode());
}
Expand All @@ -79,7 +79,7 @@ public function testRefundFailure()

$this->assertFalse($response->isSuccessful());
$this->assertFalse($response->isRedirect());
$this->assertEquals('10000165604', $response->getTransactionReference());
$this->assertEquals('10000165737', $response->getTransactionReference());
$this->assertEquals('Invalid because the original payment is not a settled debit.', $response->getMessage());
$this->assertEquals('invalid:OriginalPaymentNotSettled', $response->getCode());
}
Expand Down

0 comments on commit 58465c6

Please sign in to comment.