Skip to content

Commit

Permalink
Adjust building of parameter query due to changes in checkout session…
Browse files Browse the repository at this point in the history
… endpoints.
  • Loading branch information
jaimehing committed Jul 24, 2024
1 parent cc02045 commit 6bc1838
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 35 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.1.3] - 2024-07-24

- Adjust building of parameter query due to changes in checkout session endpoints.

## [0.1.2] - 2024-07-24

- Add checkout session endpoints.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.1.3
1 change: 0 additions & 1 deletion initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
$srcDir = dirname(__FILE__) . '/src';

require $srcDir . '/Payrex.php';
require $srcDir . '/Helpers/Parameter.php';
require $srcDir . '/PayrexClient.php';
require $srcDir . '/ApiResource.php';
require $srcDir . '/Error.php';
Expand Down
31 changes: 0 additions & 31 deletions src/Helpers/Parameter.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function request($opts)
$url = $opts['url'];

if (isset($opts['params']) && $opts['method'] === 'GET') {
$url .= '?' . http_build_query($opts['params']);
$url .= '?' . preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', http_build_query($opts['params']));
}

$ch = curl_init($url);
Expand All @@ -43,7 +43,7 @@ public function request($opts)

if (in_array($opts['method'], ['DELETE', 'POST', 'PUT'])) {
if (isset($opts['params'])) {
curl_setopt($ch, CURLOPT_POSTFIELDS, \Payrex\Helpers\Parameter::encode($opts['params']));
curl_setopt($ch, CURLOPT_POSTFIELDS, preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', http_build_query($opts['params'])));
}
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $opts['method']);
curl_setopt($ch, CURLOPT_POST, 1);
Expand Down

0 comments on commit 6bc1838

Please sign in to comment.