diff --git a/src/Omnipay/Pacnet/Message/Response.php b/src/Omnipay/Pacnet/Message/Response.php index be716e6..096ab4a 100644 --- a/src/Omnipay/Pacnet/Message/Response.php +++ b/src/Omnipay/Pacnet/Message/Response.php @@ -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; } } diff --git a/tests/Omnipay/Pacnet/Message/RefundRequestTest.php b/tests/Omnipay/Pacnet/Message/RefundRequestTest.php index 99cffa9..3ed219d 100644 --- a/tests/Omnipay/Pacnet/Message/RefundRequestTest.php +++ b/tests/Omnipay/Pacnet/Message/RefundRequestTest.php @@ -16,7 +16,7 @@ public function setUp() 'paymentRoutingNumber' => '987743', 'amount' => '10.00', 'currency' => 'USD', - 'transactionReference' => '10000165604' + 'transactionReference' => '10000165737' ) ); } @@ -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() @@ -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()); } @@ -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()); } diff --git a/tests/Omnipay/Pacnet/Message/ResponseTest.php b/tests/Omnipay/Pacnet/Message/ResponseTest.php index 5029ca7..feba539 100644 --- a/tests/Omnipay/Pacnet/Message/ResponseTest.php +++ b/tests/Omnipay/Pacnet/Message/ResponseTest.php @@ -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()); } @@ -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()); }