-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new subscription card update method (#118)
- Loading branch information
1 parent
1215114
commit 66a43b6
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
samples/subscription-samples/card_update_with_subscription_reference_code.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
require dirname(__DIR__) . '/config.php'; | ||
|
||
$request = new \Iyzipay\Request\Subscription\SubscriptionCardUpdateWithSubscriptionReferenceCodeRequest(); | ||
$request->setLocale("tr"); | ||
$request->setConversationId("123456789"); | ||
$request->setSubscriptionReferenceCode("7ad4cc50-c96c-45c6-a3f3-5f1db261e511"); | ||
$request->setCallBackUrl("https://www.callbackurl.com"); | ||
$result = \Iyzipay\Model\Subscription\SubscriptionCardUpdate::updateWithSubscriptionReferenceCode($request,Config::options()); | ||
print_r($result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...zipay/Request/Subscription/SubscriptionCardUpdateWithSubscriptionReferenceCodeRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Iyzipay\Request\Subscription; | ||
|
||
use Iyzipay\JsonBuilder; | ||
use Iyzipay\Request; | ||
|
||
class SubscriptionCardUpdateWithSubscriptionReferenceCodeRequest extends Request | ||
{ | ||
|
||
private $subscriptionReferenceCode; | ||
private $callbackUrl; | ||
|
||
public function getCallbackUrl() | ||
{ | ||
return $this->callbackUrl; | ||
} | ||
|
||
public function setCallbackUrl($callbackUrl) | ||
{ | ||
$this->callbackUrl = $callbackUrl; | ||
} | ||
|
||
public function getSubscriptionReferenceCode() | ||
{ | ||
return $this->subscriptionReferenceCode ; | ||
} | ||
|
||
public function setSubscriptionReferenceCode($subscriptionReferenceCode) | ||
{ | ||
$this->subscriptionReferenceCode = $subscriptionReferenceCode; | ||
} | ||
|
||
public function getJsonObject() | ||
{ | ||
return JsonBuilder::fromJsonObject(parent::getJsonObject()) | ||
->add("locale", $this->getLocale()) | ||
->add("conversationId", $this->getConversationId()) | ||
->add("callbackUrl", $this->getCallbackUrl()) | ||
->add("subscriptionReferenceCode", $this->getSubscriptionReferenceCode()) | ||
->getObject(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...s/Request/Subscription/SubscriptionCardUpdateWithSubscriptionReferenceCodeRequestTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Iyzipay\Tests\Request\Subscription; | ||
|
||
use Iyzipay\Request\Subscription\SubscriptionCardUpdateWithSubscriptionReferenceCodeRequest; | ||
use Iyzipay\Tests\TestCase; | ||
use Iyzipay\Model\Locale; | ||
|
||
class SubscriptionCardUpdateWithSubscriptionReferenceCodeRequestTest extends TestCase | ||
{ | ||
public function test_should_get_json_object() | ||
{ | ||
$request = $this->prepareRequest(); | ||
$jsonObject = $request->getJsonObject(); | ||
$this->assertEquals(Locale::TR, $jsonObject["locale"]); | ||
$this->assertEquals("123456789", $jsonObject["conversationId"]); | ||
$this->assertEquals("7ad4cc50-c96c-45c6-a3f3-5f1db261e511", $jsonObject["subscriptionReferenceCode"]);; | ||
$this->assertEquals("https://www.callbackurl.com", $jsonObject["callbackUrl"]); | ||
} | ||
|
||
public function test_should_get_json_string() | ||
{ | ||
$request = $this->prepareRequest(); | ||
$json = '{ | ||
"callbackUrl": "https://www.callbackurl.com", | ||
"conversationId": "123456789", | ||
"subscriptionReferenceCode": "7ad4cc50-c96c-45c6-a3f3-5f1db261e511", | ||
"locale": "tr" | ||
}'; | ||
|
||
$this->assertJson($request->toJsonString()); | ||
$this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); | ||
} | ||
|
||
private function prepareRequest() | ||
{ | ||
$request = new SubscriptionCardUpdateWithSubscriptionReferenceCodeRequest(); | ||
$request->setLocale("tr"); | ||
$request->setConversationId("123456789"); | ||
$request->setSubscriptionReferenceCode("7ad4cc50-c96c-45c6-a3f3-5f1db261e511"); | ||
$request->setCallBackUrl("https://www.callbackurl.com"); | ||
return $request; | ||
} | ||
} |