Skip to content

Commit

Permalink
Base model updates
Browse files Browse the repository at this point in the history
  • Loading branch information
osman-keser committed Mar 18, 2024
1 parent b7e557e commit 5328d95
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/Iyzipay/DefaultHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ public function put($url, $header, $content)
));
}

public function patch($url, $header, $content)
{
return $this->curl->exec($url, array(
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => $content,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_VERBOSE => false,
CURLOPT_HEADER => false,
CURLOPT_HTTPHEADER => $header
));
}

public function delete($url, $header, $content = null)
{
return $this->curl->exec($url, array(
Expand Down
3 changes: 2 additions & 1 deletion src/Iyzipay/IyzipayResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected static function getHttpHeaders(Request $request, Options $options)
return $header;
}

protected static function getHttpHeadersV2($uri, Request $request = null, Options $options)
protected static function getHttpHeadersV2($uri, Request $request = null, Options $options, bool $addRandom = false)
{
$header = array(
"Accept: application/json",
Expand All @@ -36,6 +36,7 @@ protected static function getHttpHeadersV2($uri, Request $request = null, Option

$rnd = uniqid();
array_push($header, "Authorization: " . self::prepareAuthorizationStringV2($uri, $request, $options, $rnd));
$addRandom && array_push($header, "x-iyzi-rnd: " . $rnd);
array_push($header, "x-iyzi-client-version: " . "iyzipay-php-2.0.43");

return $header;
Expand Down
2 changes: 2 additions & 0 deletions src/Iyzipay/Model/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ class Status
{
const SUCCESS = "success";
const FAILURE = "failure";
const ACTIVE = "ACTIVE";
const PASSIVE = "PASSIVE";
}
4 changes: 4 additions & 0 deletions src/Iyzipay/RequestStringBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public static function requestToStringQuery(Request $request, $type = null)
$stringQuery .= "&locale=" . $request->getLocale();
}

if ($type == 'locale') {
$stringQuery = "?locale=" . $request->getLocale();
}

if($type == 'defaultParams' ) {
if($request->getConversationId()) {
$stringQuery = "?conversationId=" . $request->getConversationId();
Expand Down

0 comments on commit 5328d95

Please sign in to comment.