Skip to content

Commit

Permalink
payflexv4pos - fix order status request with transaction_id
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed Aug 17, 2024
1 parent b333850 commit ff4a3c6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ protected function preparePostPaymentOrder(array $order): array
protected function prepareStatusOrder(array $order): array
{
return [
'id' => $order['id'],
'id' => $order['id'],
'transaction_id' => $order['transaction_id'] ?? null,
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ public function testCreate3DFormData(): void
$this->assertEquals($expectedValue, $actualData);
}

/**
* @dataProvider createStatusRequestDataDataProvider
*/
public function testCreateStatusRequestData(array $order, array $expectedData): void
{
$actual = $this->requestDataMapper->createStatusRequestData($this->account, $order);

$this->assertSame($expectedData, $actual);
}

public function testCreateOrderHistoryRequestData(): void
{
$this->expectException(\Mews\Pos\Exceptions\NotImplementedException::class);
Expand All @@ -260,6 +270,45 @@ public function testCreateHistoryRequestData(): void
$this->requestDataMapper->createHistoryRequestData($this->account, []);
}

public static function createStatusRequestDataDataProvider(): array
{
return [
'only_with_order_id' => [
'order' => [
'id' => 'order222',
],
'expected' => [
'MerchantCriteria' => [
'HostMerchantId' => '000000000111111',
'MerchantPassword' => '3XTgER89as',
],
'TransactionCriteria' => [
'TransactionId' => '',
'OrderId' => 'order222',
'AuthCode' => '',
],
],
],
'with_order_id_and_tx_id' => [
'order' => [
'id' => 'order222',
'transaction_id' => 'tx222',
],
'expected' => [
'MerchantCriteria' => [
'HostMerchantId' => '000000000111111',
'MerchantPassword' => '3XTgER89as',
],
'TransactionCriteria' => [
'TransactionId' => 'tx222',
'OrderId' => 'order222',
'AuthCode' => '',
],
],
],
];
}

/**
* @return array
*/
Expand Down

0 comments on commit ff4a3c6

Please sign in to comment.