Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PT-1263] Confirm order request change. #17

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Controller/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function execute()
throw new \Exception('Mondu: Not found');
}

$monduOrder = $this->_client->getMonduOrder($orderUuid);
$response = $this->_client->confirmOrder($orderUuid);

if (isset($response['state']) && $response['state'] == 'confirmed') {
Expand Down
10 changes: 6 additions & 4 deletions Core/Http/HttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ public function delete(string $url, array $data = [], array $headers = ['Content
/**
* for sending request
*
* @param array $data
* @param boolean $token
* @param string $url
* @param array|null $data
* @param string $method
* @return array $response
* @throws InvalidRequestException
*/
public function send_request(string $url, array $data, string $method)
public function send_request(string $url, ?array $data, string $method)
{
$this->curl = curl_init();

Expand All @@ -125,7 +127,7 @@ public function send_request(string $url, array $data, string $method)

if ($method === 'POST') {
curl_setopt($this->curl, CURLOPT_POST, true);
curl_setopt($this->curl, CURLOPT_POSTFIELDS, json_encode($data));
if ($data) curl_setopt($this->curl, CURLOPT_POSTFIELDS, json_encode($data));
}

curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
Expand Down
2 changes: 1 addition & 1 deletion Core/Http/MonduClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function updateOrderExternalInfo($orderUuid, $data = [])
return $order['order'] ?? null;
}

public function confirmOrder($orderUuid, $data = [])
public function confirmOrder($orderUuid, $data = null)
{
$order = $this->sendRequest('POST', 'orders/' . $orderUuid . '/confirm', $data);
return $order['order'] ?? null;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mondu/bnpl-checkout-oxid",
"description": "Mondu payment method for the OXID eShop.",
"type": "oxideshop-module",
"version": "1.1.2",
"version": "1.1.3",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'en' => 'Module for Mondu payment.',
),
'thumbnail' => 'out/src/images/logo.png',
'version' => '1.1.2',
'version' => '1.1.3',
'author' => 'Mondu GmbH',
'url' => 'https://www.mondu.ai',
'email' => '[email protected]',
Expand Down