diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 9a130e27..8a29cbb1 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -9,7 +9,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
- syntaxCheck="false"
verbose="true">
@@ -17,18 +16,4 @@
tests/Iyzipay/Tests
-
-
-
- src/
-
-
-
-
-
-
-
-
diff --git a/samples/create_threeds_v2_payment.php b/samples/create_threeds_v2_payment.php
new file mode 100644
index 00000000..3290084f
--- /dev/null
+++ b/samples/create_threeds_v2_payment.php
@@ -0,0 +1,32 @@
+setLocale(\Iyzipay\Model\Locale::TR);
+$request->setConversationId("123456789");
+$request->setPaymentId("25146302");
+$request->setPaidPrice("1.2");
+$request->setBasketId('B67832');
+$request->setCurrency(\Iyzipay\Model\Currency::TL);
+
+# make request
+$threedsV2Payment = \Iyzipay\Model\ThreedsV2Payment::create($request, Config::options());
+
+# print result
+print_r($threedsV2Payment);
+
+#verify signature
+$paymentId = $threedsV2Payment->getPaymentId();
+$currency = $threedsV2Payment->getCurrency();
+$basketId = $threedsV2Payment->getBasketId();
+$conversationId = $threedsV2Payment->getConversationId();
+$paidPrice = $threedsV2Payment->getPaidPrice();
+$price = $threedsV2Payment->getPrice();
+$signature = $threedsV2Payment->getSignature();
+
+$calculatedSignature = calculateHmacSHA256Signature(array($paymentId, $currency, $basketId, $conversationId, $paidPrice, $price));
+$verified = $signature == $calculatedSignature;
+echo "Signature verified: $verified";
\ No newline at end of file
diff --git a/src/Iyzipay/HashGenerator.php b/src/Iyzipay/HashGenerator.php
deleted file mode 100644
index 8314c097..00000000
--- a/src/Iyzipay/HashGenerator.php
+++ /dev/null
@@ -1,13 +0,0 @@
-toPKIRequestString() : '';
- $hashStr = $apiKey . $randomString . $secretKey . $pKIRequestString;
- return base64_encode(sha1($hashStr, true));
- }
-}
\ No newline at end of file
diff --git a/src/Iyzipay/IyziAuthV2Generator.php b/src/Iyzipay/IyziAuthV2Generator.php
index b8b1cbc2..0c5943fc 100644
--- a/src/Iyzipay/IyziAuthV2Generator.php
+++ b/src/Iyzipay/IyziAuthV2Generator.php
@@ -7,10 +7,7 @@ class IyziAuthV2Generator
public static function generateAuthContent($uri, $apiKey, $secretKey, $randomString, Request $request = null)
{
$hashStr = "apiKey:" . $apiKey . "&randomKey:" . $randomString ."&signature:" . self::getHmacSHA256Signature($uri, $secretKey, $randomString, $request);
-
- $hashStr = base64_encode($hashStr);
-
- return $hashStr;
+ return base64_encode($hashStr);
}
public static function getHmacSHA256Signature($uri, $secretKey, $randomString, Request $request = null)
@@ -18,22 +15,20 @@ public static function getHmacSHA256Signature($uri, $secretKey, $randomString, R
$dataToEncrypt = $randomString . self::getPayload($uri, $request);
$hash = hash_hmac('sha256', $dataToEncrypt, $secretKey, true);
- $token = bin2hex($hash);
-
- return $token;
+ return bin2hex($hash);
}
public static function getPayload($uri, Request $request = null)
{
$uriPath = $uri;
+ $startsWithV2 = strpos($uri, '.com/v2');
$startNumber = strpos($uri, '/v2');
$endNumber = strpos($uri, '?');
-
- if ($startNumber) {
- if (strpos($uri, "subscription") || strpos($uri, "ucs")) {
+ if ($startNumber !== false && $startsWithV2) {
+ if (strpos($uri, "subscription") !== false || strpos($uri, "ucs") !== false) {
$endNumber = strlen($uri);
- if (strpos($uri, '?')) {
+ if (strpos($uri, '?') !== false) {
$endNumber = strpos($uri, '?');
}
}
diff --git a/src/Iyzipay/IyzipayResource.php b/src/Iyzipay/IyzipayResource.php
index 3e80c336..c6768ada 100644
--- a/src/Iyzipay/IyzipayResource.php
+++ b/src/Iyzipay/IyzipayResource.php
@@ -2,8 +2,7 @@
namespace Iyzipay;
-class IyzipayResource extends ApiResource
-{
+class IyzipayResource extends ApiResource {
private $status;
private $errorCode;
private $errorMessage;
@@ -12,132 +11,79 @@ class IyzipayResource extends ApiResource
private $systemTime;
private $conversationId;
- protected static function getHttpHeaders(Request $request, Options $options)
- {
- $header = array(
- "Accept: application/json",
- "Content-type: application/json",
- );
-
- $rnd = uniqid();
- array_push($header, "Authorization: " . self::prepareAuthorizationString($request, $options, $rnd));
- array_push($header, "x-iyzi-rnd: " . $rnd);
- array_push($header, "x-iyzi-client-version: " . "iyzipay-php-2.0.59");
- return $header;
- }
-
- protected static function getHttpHeadersV2($uri, Request $request = null, Options $options, bool $addRandom = false)
- {
+ protected static function getHttpHeadersV2($uri, Request $request = null, Options $options) {
$header = array(
"Accept: application/json",
"Content-type: application/json",
);
$rnd = uniqid();
- array_push($header, "Authorization: " . self::prepareAuthorizationStringV2($uri, $request, $options, $rnd));
- $addRandom && array_push($header, "x-iyzi-rnd: " . $rnd);
- array_push($header, "AUTHORIZATION_FALLBACK_HEADER: " . self::prepareAuthorizationString($request, $options, $rnd));
- array_push($header, "x-iyzi-client-version: " . "iyzipay-php-2.0.59");
+ $header[] = "Authorization: " . self::prepareAuthorizationStringV2($uri, $request, $options, $rnd);
+ $header[] = "x-iyzi-client-version: " . "iyzipay-php-2.0.59";
return $header;
}
- protected static function getHttpHeadersIsV2($uri, Request $request = null, Options $options, bool $addRandom = false)
- {
- $header = array(
- "Accept: application/json",
- "Content-type: application/json",
- );
-
- $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.59");
-
- return $header;
- }
-
- protected static function prepareAuthorizationString($request, Options $options, $rnd)
- {
- $authContent = HashGenerator::generateHash($options->getApiKey(), $options->getSecretKey(), $rnd, $request);
- return vsprintf("IYZWS %s:%s", array($options->getApiKey(), $authContent));
- }
-
- protected static function prepareAuthorizationStringV2($uri, Request $request = null, Options $options, $rnd)
- {
+ protected static function prepareAuthorizationStringV2($uri, Request $request = null, Options $options, $rnd) {
$hash = IyziAuthV2Generator::generateAuthContent($uri, $options->getApiKey(), $options->getSecretKey(), $rnd, $request);
return 'IYZWSv2' . ' ' . $hash;
}
- public function getStatus()
- {
+ public function getStatus() {
return $this->status;
}
- public function setStatus($status)
- {
+ public function setStatus($status) {
$this->status = $status;
}
- public function getErrorCode()
- {
+ public function getErrorCode() {
return $this->errorCode;
}
- public function setErrorCode($errorCode)
- {
+ public function setErrorCode($errorCode) {
$this->errorCode = $errorCode;
}
- public function getErrorMessage()
- {
+ public function getErrorMessage() {
return $this->errorMessage;
}
- public function setErrorMessage($errorMessage)
- {
+ public function setErrorMessage($errorMessage) {
$this->errorMessage = $errorMessage;
}
- public function getErrorGroup()
- {
+ public function getErrorGroup() {
return $this->errorGroup;
}
- public function setErrorGroup($errorGroup)
- {
+ public function setErrorGroup($errorGroup) {
$this->errorGroup = $errorGroup;
}
- public function getLocale()
- {
+ public function getLocale() {
return $this->locale;
}
- public function setLocale($locale)
- {
+ public function setLocale($locale) {
$this->locale = $locale;
}
- public function getSystemTime()
- {
+ public function getSystemTime() {
return $this->systemTime;
}
- public function setSystemTime($systemTime)
- {
+ public function setSystemTime($systemTime) {
$this->systemTime = $systemTime;
}
- public function getConversationId()
- {
+ public function getConversationId() {
return $this->conversationId;
}
- public function setConversationId($conversationId)
- {
+ public function setConversationId($conversationId) {
$this->conversationId = $conversationId;
}
}
diff --git a/src/Iyzipay/Model/AmountBaseRefund.php b/src/Iyzipay/Model/AmountBaseRefund.php
index f336efc6..8522c735 100644
--- a/src/Iyzipay/Model/AmountBaseRefund.php
+++ b/src/Iyzipay/Model/AmountBaseRefund.php
@@ -16,7 +16,7 @@ class AmountBaseRefund extends IyzipayResource
public static function create(AmountBaseRefundRequest $request, Options $options): AmountBaseRefund
{
$uri = '/v2/payment/refund';
- $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options, true), $request->toJsonString());
+ $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString());
return AmountBaseRefundMapper::create($rawResult)->jsonDecode()->mapAmountBaseRefund(new AmountBaseRefund());
}
diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkDeleteProduct.php b/src/Iyzipay/Model/Iyzilink/IyziLinkDeleteProduct.php
index 4464a74b..66f00795 100644
--- a/src/Iyzipay/Model/Iyzilink/IyziLinkDeleteProduct.php
+++ b/src/Iyzipay/Model/Iyzilink/IyziLinkDeleteProduct.php
@@ -13,7 +13,7 @@ class IyziLinkDeleteProduct extends IyziLinkDeleteProductResource
public static function create(Request $request, Options $options, $token)
{
$uri = $options->getBaseUrl() . "/v2/iyzilink/products/" . $token . RequestStringBuilder::requestToStringQuery($request, null);
- $rawResult = parent::httpClient()->delete($uri, parent::getHttpHeadersIsV2($uri, null, $options));
+ $rawResult = parent::httpClient()->delete($uri, parent::getHttpHeadersV2($uri, null, $options));
return IyziLinkDeleteProductMapper::create($rawResult)->jsonDecode()->mapIyziLinkDeleteProduct(new IyziLinkDeleteProduct());
}
}
\ No newline at end of file
diff --git a/src/Iyzipay/Model/Mapper/ThreedsV2PaymentMapper.php b/src/Iyzipay/Model/Mapper/ThreedsV2PaymentMapper.php
new file mode 100644
index 00000000..e9104129
--- /dev/null
+++ b/src/Iyzipay/Model/Mapper/ThreedsV2PaymentMapper.php
@@ -0,0 +1,24 @@
+mapThreedsV2PaymentFrom($auth, $this->jsonObject);
+ }
+}
\ No newline at end of file
diff --git a/src/Iyzipay/Model/ReportingPaymentDetail.php b/src/Iyzipay/Model/ReportingPaymentDetail.php
index 2fa2ca4a..ff7314b8 100644
--- a/src/Iyzipay/Model/ReportingPaymentDetail.php
+++ b/src/Iyzipay/Model/ReportingPaymentDetail.php
@@ -12,7 +12,7 @@ class ReportingPaymentDetail extends ReportingPaymentDetailResource
public static function create(ReportingPaymentDetailRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/reporting/payment/details" . RequestStringBuilder::requestToStringQuery($request, 'reporting');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options));
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return ReportingPaymentDetailMapper::create($rawResult)->jsonDecode()->mapReportingPaymentDetail(new ReportingPaymentDetail());
}
diff --git a/src/Iyzipay/Model/Subscription/RetrieveList.php b/src/Iyzipay/Model/Subscription/RetrieveList.php
index ce592874..ba87138b 100644
--- a/src/Iyzipay/Model/Subscription/RetrieveList.php
+++ b/src/Iyzipay/Model/Subscription/RetrieveList.php
@@ -23,21 +23,21 @@ class RetrieveList extends IyzipayResource
public static function products(SubscriptionListProductsRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/products" . RequestStringBuilder::requestToStringQuery($request, 'subscriptionItems');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return RetrieveListMapper::create($rawResult)->jsonDecode()->mapRetrieveList(new RetrieveList());
}
public static function pricingPlan(SubscriptionListPricingPlanRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/products/" . $request->getProductReferenceCode() . "/pricing-plans" . RequestStringBuilder::requestToStringQuery($request, 'subscriptionItems');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return RetrieveListMapper::create($rawResult)->jsonDecode()->mapRetrieveList(new RetrieveList());
}
public static function customers(SubscriptionListCustomersRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/customers" . RequestStringBuilder::requestToStringQuery($request, 'subscriptionItems');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return RetrieveListMapper::create($rawResult)->jsonDecode()->mapRetrieveList(new RetrieveList());
}
@@ -45,7 +45,7 @@ public static function customers(SubscriptionListCustomersRequest $request, Opti
public static function subscriptions(SubscriptionSearchRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/subscriptions" . RequestStringBuilder::requestToStringQuery($request, 'searchSubscription');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return RetrieveListMapper::create($rawResult)->jsonDecode()->mapRetrieveList(new RetrieveList());
}
diff --git a/src/Iyzipay/Model/Subscription/RetrieveSubscriptionCheckoutForm.php b/src/Iyzipay/Model/Subscription/RetrieveSubscriptionCheckoutForm.php
index c350c95c..2f5f9ec8 100644
--- a/src/Iyzipay/Model/Subscription/RetrieveSubscriptionCheckoutForm.php
+++ b/src/Iyzipay/Model/Subscription/RetrieveSubscriptionCheckoutForm.php
@@ -25,7 +25,7 @@ class RetrieveSubscriptionCheckoutForm extends IyzipayResource
public static function retrieve(RetrieveSubscriptionCreateCheckoutFormRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/checkoutform/".$request->getCheckoutFormToken();
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, $request, $options));
return RetrieveSubscriptionCheckoutFormMapper::create($rawResult)->jsonDecode()->mapSubscriptionCreateCheckoutForm(new RetrieveSubscriptionCheckoutForm());
}
diff --git a/src/Iyzipay/Model/Subscription/SubscriptionCustomer.php b/src/Iyzipay/Model/Subscription/SubscriptionCustomer.php
index 5546728c..4f849cd1 100644
--- a/src/Iyzipay/Model/Subscription/SubscriptionCustomer.php
+++ b/src/Iyzipay/Model/Subscription/SubscriptionCustomer.php
@@ -46,7 +46,7 @@ public static function create(SubscriptionCreateCustomerRequest $request, Option
public static function retrieve(SubscriptionRetrieveCustomerRequest $request, $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/customers/".$request->getCustomerReferenceCode().RequestStringBuilder::requestToStringQuery($request, 'defaultParams');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return SubscriptionCustomerMapper::create($rawResult)->jsonDecode()->mapSubscriptionCustomer(new SubscriptionCustomer());
}
diff --git a/src/Iyzipay/Model/Subscription/SubscriptionDetails.php b/src/Iyzipay/Model/Subscription/SubscriptionDetails.php
index 7b946ea0..5128b075 100644
--- a/src/Iyzipay/Model/Subscription/SubscriptionDetails.php
+++ b/src/Iyzipay/Model/Subscription/SubscriptionDetails.php
@@ -31,7 +31,7 @@ class SubscriptionDetails extends IyzipayResource
public static function retrieve(SubscriptionDetailsRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/subscriptions/".$request->getSubscriptionReferenceCode().RequestStringBuilder::requestToStringQuery($request, 'defaultParams');;
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return SubscriptionDetailsMapper::create($rawResult)->jsonDecode()->mapSubscriptionDetails(new SubscriptionDetails());
}
diff --git a/src/Iyzipay/Model/Subscription/SubscriptionPricingPlan.php b/src/Iyzipay/Model/Subscription/SubscriptionPricingPlan.php
index 29562b9a..23f500d2 100644
--- a/src/Iyzipay/Model/Subscription/SubscriptionPricingPlan.php
+++ b/src/Iyzipay/Model/Subscription/SubscriptionPricingPlan.php
@@ -37,7 +37,7 @@ public static function create(SubscriptionCreatePricingPlanRequest $request, Opt
public static function retrieve(SubscriptionRetrievePricingPlanRequest $request, $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/pricing-plans/".$request->getPricingPlanReferenceCode().RequestStringBuilder::requestToStringQuery($request, 'defaultParams');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return SubscriptionPricingPlanMapper::create($rawResult)->jsonDecode()->mapSubscriptionPricingPlan(new SubscriptionPricingPlan());
}
diff --git a/src/Iyzipay/Model/Subscription/SubscriptionProduct.php b/src/Iyzipay/Model/Subscription/SubscriptionProduct.php
index 63fc2e6f..3b722ef7 100644
--- a/src/Iyzipay/Model/Subscription/SubscriptionProduct.php
+++ b/src/Iyzipay/Model/Subscription/SubscriptionProduct.php
@@ -24,21 +24,21 @@ class SubscriptionProduct extends IyzipayResource
public static function create(SubscriptionCreateProductRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/products";
- $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersIsV2($uri, $request, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString());
return SubscriptionProductMapper::create($rawResult)->jsonDecode()->mapSubscriptionProduct(new SubscriptionProduct());
}
public static function retrieve(SubscriptionRetrieveProductRequest $request, $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/products/" . $request->getProductReferenceCode() . RequestStringBuilder::requestToStringQuery($request, 'defaultParams');
- $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options));
return SubscriptionProductMapper::create($rawResult)->jsonDecode()->mapSubscriptionProduct(new SubscriptionProduct());
}
public static function update(SubscriptionUpdateProductRequest $request, $options)
{
$uri = $options->getBaseUrl() . "/v2/subscription/products/" . $request->getProductReferenceCode();
- $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersIsV2($uri, $request, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString());
return SubscriptionProductMapper::create($rawResult)->jsonDecode()->mapSubscriptionProduct(new SubscriptionProduct());
}
diff --git a/src/Iyzipay/Model/ThreedsV2Payment.php b/src/Iyzipay/Model/ThreedsV2Payment.php
new file mode 100644
index 00000000..d56276a8
--- /dev/null
+++ b/src/Iyzipay/Model/ThreedsV2Payment.php
@@ -0,0 +1,25 @@
+post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString());
+ return ThreedsV2PaymentMapper::create($rawResult)->jsonDecode()->mapThreedsV2Payment(new ThreedsV2Payment());
+ }
+
+ public function getSignature(): ?string {
+ return $this->signature;
+ }
+
+ public function setSignature($signature): void {
+ $this->signature = $signature;
+ }
+}
\ No newline at end of file
diff --git a/src/Iyzipay/Model/UCSInitialize.php b/src/Iyzipay/Model/UCSInitialize.php
index 12928f43..00c65f8c 100644
--- a/src/Iyzipay/Model/UCSInitialize.php
+++ b/src/Iyzipay/Model/UCSInitialize.php
@@ -11,7 +11,7 @@ class UCSInitialize extends UCSInitializeResource
public static function create(UCSInitializeRequest $request, Options $options)
{
$uri = $options->getBaseUrl() . "/v2/ucs/init";
- $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersIsV2($uri, $request, $options), $request->toJsonString());
+ $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString());
return UCSInitializeMapper::create($rawResult)->jsonDecode()->mapUCSInitialize(new UCSInitialize());
}
}
\ No newline at end of file
diff --git a/src/Iyzipay/Request/CreateThreedsV2PaymentRequest.php b/src/Iyzipay/Request/CreateThreedsV2PaymentRequest.php
new file mode 100644
index 00000000..a0b2c569
--- /dev/null
+++ b/src/Iyzipay/Request/CreateThreedsV2PaymentRequest.php
@@ -0,0 +1,68 @@
+paymentId ?? null;
+ }
+
+ public function setPaymentId(string $paymentId): void {
+ $this->paymentId = $paymentId;
+ }
+
+ public function getPaidPrice(): ?float {
+ return $this->paidPrice;
+ }
+
+ public function setPaidPrice(float $paidPrice): void {
+ $this->paidPrice = $paidPrice;
+ }
+
+ public function getBasketId(): ?string {
+ return $this->basketId;
+ }
+
+ public function setBasketId(string $basketId): void {
+ $this->basketId = $basketId;
+ }
+
+ public function getCurrency(): ?string {
+ return $this->currency;
+ }
+
+ public function setCurrency(string $currency): void {
+ $this->currency = $currency;
+ }
+
+
+ public function getJsonObject() {
+ return JsonBuilder::fromJsonObject(parent::getJsonObject())
+ ->add("locale", $this->getLocale())
+ ->add("conversationId", $this->getConversationId())
+ ->add("paymentId", $this->getPaymentId())
+ ->addPrice("paidPrice", $this->getPaidPrice())
+ ->add("basketId", $this->getBasketId())
+ ->add("currency", $this->getCurrency())
+ ->getObject();
+ }
+
+ public function toPKIRequestString() {
+ return RequestStringBuilder::create()
+ ->appendSuper(parent::toPKIRequestString())
+ ->append("paymentId", $this->getPaymentId())
+ ->appendPrice("paidPrice", $this->getPaidPrice())
+ ->append("basketId", $this->getBasketId())
+ ->append("currency", $this->getCurrency())
+ ->getRequestString();
+ }
+}
\ No newline at end of file
diff --git a/tests/Iyzipay/Tests/HashGeneratorTest.php b/tests/Iyzipay/Tests/HashGeneratorTest.php
deleted file mode 100644
index 2228ac75..00000000
--- a/tests/Iyzipay/Tests/HashGeneratorTest.php
+++ /dev/null
@@ -1,19 +0,0 @@
-setLocale(Locale::TR);
- $request->setConversationId("123456");
-
- $this->assertEquals("opW0tI3yAVjzROFRTgHjIGsriHw=", HashGenerator::generateHash("apiKey", "secretKey", "rnd", $request));
- }
-}
\ No newline at end of file
diff --git a/tests/Iyzipay/Tests/IyziAuthV2GeneratorTest.php b/tests/Iyzipay/Tests/IyziAuthV2GeneratorTest.php
index ad1b19be..7a9090ce 100644
--- a/tests/Iyzipay/Tests/IyziAuthV2GeneratorTest.php
+++ b/tests/Iyzipay/Tests/IyziAuthV2GeneratorTest.php
@@ -2,9 +2,7 @@
namespace Iyzipay\Tests;
-use Iyzipay\HashGenerator;
use Iyzipay\IyziAuthV2Generator;
-use Iyzipay\Model\Locale;
use Iyzipay\Request;
class IyziAuthV2GeneratorTest extends TestCase
@@ -19,8 +17,8 @@ public function test_should_generate_auth_content_default()
$iyziAuthV2Generator = new IyziAuthV2Generator();
$result = $iyziAuthV2Generator->generateAuthContent($uri, $apiKey, $secretKey, $randomString, $request);
+ $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6OGM2NzI5MGYwMGZjN2FjOGE2NDczZDQ3OGEyMmRmYjY5YzgxNzFjZjc5Mzk4NDVmNzdiMWQwYjNmODQ3MGQ1MA==";
- $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6Y2Y0Mjk5ZTQwYzZkZThmMzYzZGQyMWZiN2QzNjI3MjE2YTUxNjM2MDY1YTViOTM0YTMxODJiNTk0YjQ2ZjVhMA==";
$this->assertEquals($authContent, $result);
}
@@ -35,7 +33,7 @@ public function test_should_generate_auth_content_parameters()
$iyziAuthV2Generator = new IyziAuthV2Generator();
$result = $iyziAuthV2Generator->generateAuthContent($uri, $apiKey, $secretKey, $randomString, $request);
- $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6Nzg3NjFjMmJhZDQ0ZmE2MWI5NDNhZDIyYmM4NmJjNThjM2ZhMWQ3NDgwMDFjMTEzNTdlY2EzZjkwNGM0NGQxYg==";
+ $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6YjE4NjFmMDBjNmE3NzljMTRmODA0ZTIwOTJhYjEwNjkxMDA2ODU2OWYwNzVjY2M5OWY2NzAwMjhmZjYzYTllNg==";
$this->assertEquals($authContent, $result);
}
@@ -50,7 +48,7 @@ public function test_should_generate_auth_content_no_parameters()
$iyziAuthV2Generator = new IyziAuthV2Generator();
$result = $iyziAuthV2Generator->generateAuthContent($uri, $apiKey, $secretKey, $randomString, $request);
- $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6Y2Y0Mjk5ZTQwYzZkZThmMzYzZGQyMWZiN2QzNjI3MjE2YTUxNjM2MDY1YTViOTM0YTMxODJiNTk0YjQ2ZjVhMA==";
+ $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6ZWUyNjM0NTA5MTg2ODhlN2IzNzg2ODI3YjhjMGZiMDQ1YzhiODgyYTQwMjJiOWIwNWM1ODlhMjYwOTYzMGM2ZA==";
$this->assertEquals($authContent, $result);
}
@@ -65,7 +63,7 @@ public function test_should_generate_subscription_auth_content_no_body_with_get_
$iyziAuthV2Generator = new IyziAuthV2Generator();
$result = $iyziAuthV2Generator->generateAuthContent($uri, $apiKey, $secretKey, $randomString, $request);
- $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6NmYzODQwOTlhYWUzMjhmNzJkYWY5Y2RhYjEwNWViMzdmYjI5NjIwMjUxYzQ3YjRjNTgzZDc0OGQ5ZDBhYjc2NA==";
+ $authContent = 'YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6NmYzODQwOTlhYWUzMjhmNzJkYWY5Y2RhYjEwNWViMzdmYjI5NjIwMjUxYzQ3YjRjNTgzZDc0OGQ5ZDBhYjc2NA==';
$this->assertEquals($authContent, $result);
}
@@ -80,7 +78,7 @@ public function test_should_generate_subscription_auth_content_with_body_paramet
$iyziAuthV2Generator = new IyziAuthV2Generator();
$result = $iyziAuthV2Generator->generateAuthContent($uri, $apiKey, $secretKey, $randomString, $request);
- $authContent = "YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6YmM0NGIyZjRkZmI4ZGY3NDE0N2IxZjUyN2ZmNjM2NDQ0YzNiM2QzYTFmZjk3ZGNiMzM2NmJjMjkzZmFjZjI5OA==";
+ $authContent = 'YXBpS2V5OnRlc3QmcmFuZG9tS2V5OjEyMzQ1Njc4OSZzaWduYXR1cmU6YmM0NGIyZjRkZmI4ZGY3NDE0N2IxZjUyN2ZmNjM2NDQ0YzNiM2QzYTFmZjk3ZGNiMzM2NmJjMjkzZmFjZjI5OA==';
$this->assertEquals($authContent, $result);
}
diff --git a/tests/Iyzipay/Tests/IyzipayResourceTest.php b/tests/Iyzipay/Tests/IyzipayResourceTest.php
index 169d6020..41ca230f 100644
--- a/tests/Iyzipay/Tests/IyzipayResourceTest.php
+++ b/tests/Iyzipay/Tests/IyzipayResourceTest.php
@@ -5,34 +5,37 @@
use Iyzipay\IyzipayResource;
use Iyzipay\Model\Locale;
use Iyzipay\Request;
+use Iyzipay\Options;
class IyzipayResourceTest extends TestCase
{
public function test_should_get_http_headers()
{
+ $options = new Options();
$request = new Request();
$request->setLocale(Locale::TR);
$request->setConversationId("123456");
+ $url = $options->getBaseUrl() . "/payment/test";
- $headers = parent::callMethod(new IyzipayResource(), "getHttpHeaders", array($request, $this->options));
-
+ $headers = parent::callMethod(new IyzipayResource(), "getHttpHeadersV2", array($url, $request, $this->options));
$this->assertNotEmpty($headers);
- $this->assertEquals(5, count($headers));
+ $this->assertEquals(4, count($headers));
$this->assertEquals("Accept: application/json", $headers[0]);
$this->assertEquals("Content-type: application/json", $headers[1]);
$this->assertStringStartsWith("Authorization: ", $headers[2]);
- $this->assertStringStartsWith("x-iyzi-rnd: ", $headers[3]);
- $this->assertStringStartsWith("x-iyzi-client-version: ", $headers[4]);
+ $this->assertStringStartsWith("x-iyzi-client-version: ", $headers[3]);
}
public function test_should_prepare_authorization_string()
{
+ $options = new Options();
$request = new Request();
$request->setLocale(Locale::TR);
$request->setConversationId("123456");
+ $uri = $options->getBaseUrl() . "/payment/test";
+ $expected_hash = 'IYZWSv2 YXBpS2V5OmFwaUtleSZyYW5kb21LZXk6cm5kJnNpZ25hdHVyZTpkMDBiYWE0YjZkYzU5MzA0NzJlNGQyMmEzYzUwZmIwN2RlNTBiMGRmYjhmNWFmNWI5ZjczMTU4ZDZiMTg0ZmY2';
- $str = parent::callMethod(new IyzipayResource(), "prepareAuthorizationString", array($request, $this->options, "rnd"));
-
- $this->assertEquals("IYZWS apiKey:opW0tI3yAVjzROFRTgHjIGsriHw=", $str);
+ $str = parent::callMethod(new IyzipayResource(), "prepareAuthorizationStringV2", array($uri, $request, $this->options, "rnd"));
+ $this->assertEquals($expected_hash, $str);
}
}
\ No newline at end of file
diff --git a/tests/Iyzipay/Tests/Model/Mapper/ThreedsV2PaymentMapperTest.php b/tests/Iyzipay/Tests/Model/Mapper/ThreedsV2PaymentMapperTest.php
new file mode 100644
index 00000000..0466f2c0
--- /dev/null
+++ b/tests/Iyzipay/Tests/Model/Mapper/ThreedsV2PaymentMapperTest.php
@@ -0,0 +1,151 @@
+retrieveJsonFile("create-payment.json");
+
+ $threedsV2Payment = ThreedsV2PaymentMapper::create($json)->jsonDecode()->mapThreedsV2Payment(new ThreedsV2Payment());
+
+ $this->assertNotEmpty($threedsV2Payment);
+ $this->assertEquals(Status::FAILURE, $threedsV2Payment->getStatus());
+ $this->assertEquals("10000", $threedsV2Payment->getErrorCode());
+ $this->assertEquals("error message", $threedsV2Payment->getErrorMessage());
+ $this->assertEquals("ERROR_GROUP", $threedsV2Payment->getErrorGroup());
+ $this->assertEquals(Locale::TR, $threedsV2Payment->getLocale());
+ $this->assertEquals("1458545234852", $threedsV2Payment->getSystemTime());
+ $this->assertEquals("123456", $threedsV2Payment->getConversationId());
+ $this->assertJson($threedsV2Payment->getRawResult());
+ $this->assertJsonStringEqualsJsonString($json, $threedsV2Payment->getRawResult());
+ $this->assertEquals("1.0", $threedsV2Payment->getPrice());
+ $this->assertEquals("1.1", $threedsV2Payment->getPaidPrice());
+ $this->assertEquals("1", $threedsV2Payment->getInstallment());
+ $this->assertEquals("1", $threedsV2Payment->getPaymentId());
+ $this->assertEquals("SUCCESS", $threedsV2Payment->getPaymentStatus());
+ $this->assertEquals("1", $threedsV2Payment->getFraudStatus());
+ $this->assertEquals("10.00000000", $threedsV2Payment->getMerchantCommissionRate());
+ $this->assertEquals("0.1", $threedsV2Payment->getMerchantCommissionRateAmount());
+ $this->assertEquals("0.03245000", $threedsV2Payment->getIyziCommissionRateAmount());
+ $this->assertEquals("0.29500000", $threedsV2Payment->getIyziCommissionFee());
+ $this->assertEquals("CREDIT_CARD", $threedsV2Payment->getCardType());
+ $this->assertEquals("MASTER_CARD", $threedsV2Payment->getCardAssociation());
+ $this->assertEquals("Bonus", $threedsV2Payment->getCardFamily());
+ $this->assertEquals("cardUserKey", $threedsV2Payment->getCardUserKey());
+ $this->assertEquals("cardToken", $threedsV2Payment->getCardToken());
+ $this->assertEquals("554960", $threedsV2Payment->getBinNumber());
+ $this->assertEquals("B67832", $threedsV2Payment->getBasketId());
+ $this->assertEquals(Currency::TL, $threedsV2Payment->getCurrency());
+ $this->assertEquals("connector name", $threedsV2Payment->getConnectorName());
+ $this->assertEquals("auth code", $threedsV2Payment->getAuthCode());
+ $this->assertEquals("AUTH", $threedsV2Payment->getPhase());
+ $this->assertEquals("0000", $threedsV2Payment->getLastFourDigits());
+ $this->assertEquals("posOrderId", $threedsV2Payment->getPosOrderId());
+
+ $paymentItems = $threedsV2Payment->getPaymentItems();
+ $this->assertNotEmpty($threedsV2Payment->getPaymentItems());
+ $this->assertEquals(3, count($threedsV2Payment->getPaymentItems()));
+
+ $paymentItem = $paymentItems[0];
+ $this->assertEquals("BI101", $paymentItem->getItemId());
+ $this->assertEquals("4977", $paymentItem->getPaymentTransactionId());
+ $this->assertEquals("2", $paymentItem->getTransactionStatus());
+ $this->assertEquals("0.3", $paymentItem->getPrice());
+ $this->assertEquals("0.33000000", $paymentItem->getPaidPrice());
+ $this->assertEquals("10.00000000", $paymentItem->getMerchantCommissionRate());
+ $this->assertEquals("0.03000000", $paymentItem->getMerchantCommissionRateAmount());
+ $this->assertEquals("0.00973500", $paymentItem->getIyziCommissionRateAmount());
+ $this->assertEquals("0.08850000", $paymentItem->getIyziCommissionFee());
+ $this->assertEquals("10.00000000", $paymentItem->getBlockageRate());
+ $this->assertEquals("0.03300000", $paymentItem->getBlockageRateAmountMerchant());
+ $this->assertEquals("0", $paymentItem->getBlockageRateAmountSubMerchant());
+ $this->assertEquals("2016-03-28 09:27:14", $paymentItem->getBlockageResolvedDate());
+ $this->assertEquals("subMerchantKey", $paymentItem->getSubMerchantKey());
+ $this->assertEquals("0", $paymentItem->getSubMerchantPrice());
+ $this->assertEquals("0E-8", $paymentItem->getSubMerchantPayoutRate());
+ $this->assertEquals("0", $paymentItem->getSubMerchantPayoutAmount());
+ $this->assertEquals("0.19876500", $paymentItem->getMerchantPayoutAmount());
+ $this->assertNotEmpty($paymentItem->getConvertedPayout());
+ $this->assertEquals("0.33000000", $paymentItem->getConvertedPayout()->getPaidPrice());
+ $this->assertEquals("0.00973500", $paymentItem->getConvertedPayout()->getIyziCommissionRateAmount());
+ $this->assertEquals("0.08850000", $paymentItem->getConvertedPayout()->getIyziCommissionFee());
+ $this->assertEquals("0.03300000", $paymentItem->getConvertedPayout()->getBlockageRateAmountMerchant());
+ $this->assertEquals("0E-8", $paymentItem->getConvertedPayout()->getBlockageRateAmountSubMerchant());
+ $this->assertEquals("0E-8", $paymentItem->getConvertedPayout()->getSubMerchantPayoutAmount());
+ $this->assertEquals("0.19876500", $paymentItem->getConvertedPayout()->getMerchantPayoutAmount());
+ $this->assertEquals("0", $paymentItem->getConvertedPayout()->getIyziConversionRate());
+ $this->assertEquals("0", $paymentItem->getConvertedPayout()->getIyziConversionRateAmount());
+ $this->assertEquals(Currency::TL, $paymentItem->getConvertedPayout()->getCurrency());
+
+ $paymentItem = $paymentItems[1];
+ $this->assertEquals("BI102", $paymentItem->getItemId());
+ $this->assertEquals("4978", $paymentItem->getPaymentTransactionId());
+ $this->assertEquals("2", $paymentItem->getTransactionStatus());
+ $this->assertEquals("0.5", $paymentItem->getPrice());
+ $this->assertEquals("0.55000000", $paymentItem->getPaidPrice());
+ $this->assertEquals("10.00000000", $paymentItem->getMerchantCommissionRate());
+ $this->assertEquals("0.05000000", $paymentItem->getMerchantCommissionRateAmount());
+ $this->assertEquals("0.01622500", $paymentItem->getIyziCommissionRateAmount());
+ $this->assertEquals("0.14750000", $paymentItem->getIyziCommissionFee());
+ $this->assertEquals("10.00000000", $paymentItem->getBlockageRate());
+ $this->assertEquals("0.05500000", $paymentItem->getBlockageRateAmountMerchant());
+ $this->assertEquals("0", $paymentItem->getBlockageRateAmountSubMerchant());
+ $this->assertEquals("2016-03-28 09:27:14", $paymentItem->getBlockageResolvedDate());
+ $this->assertEquals("subMerchantKey", $paymentItem->getSubMerchantKey());
+ $this->assertEquals("0", $paymentItem->getSubMerchantPrice());
+ $this->assertEquals("0E-8", $paymentItem->getSubMerchantPayoutRate());
+ $this->assertEquals("0", $paymentItem->getSubMerchantPayoutAmount());
+ $this->assertEquals("0.33127500", $paymentItem->getMerchantPayoutAmount());
+ $this->assertNotEmpty($paymentItem->getConvertedPayout());
+ $this->assertEquals("0.55000000", $paymentItem->getConvertedPayout()->getPaidPrice());
+ $this->assertEquals("0.01622500", $paymentItem->getConvertedPayout()->getIyziCommissionRateAmount());
+ $this->assertEquals("0.14750000", $paymentItem->getConvertedPayout()->getIyziCommissionFee());
+ $this->assertEquals("0.05500000", $paymentItem->getConvertedPayout()->getBlockageRateAmountMerchant());
+ $this->assertEquals("0E-8", $paymentItem->getConvertedPayout()->getBlockageRateAmountSubMerchant());
+ $this->assertEquals("0E-8", $paymentItem->getConvertedPayout()->getSubMerchantPayoutAmount());
+ $this->assertEquals("0.33127500", $paymentItem->getConvertedPayout()->getMerchantPayoutAmount());
+ $this->assertEquals("0", $paymentItem->getConvertedPayout()->getIyziConversionRate());
+ $this->assertEquals("0", $paymentItem->getConvertedPayout()->getIyziConversionRateAmount());
+ $this->assertEquals(Currency::TL, $paymentItem->getConvertedPayout()->getCurrency());
+
+ $paymentItem = $paymentItems[2];
+ $this->assertEquals("BI103", $paymentItem->getItemId());
+ $this->assertEquals("4979", $paymentItem->getPaymentTransactionId());
+ $this->assertEquals("2", $paymentItem->getTransactionStatus());
+ $this->assertEquals("0.2", $paymentItem->getPrice());
+ $this->assertEquals("0.22000000", $paymentItem->getPaidPrice());
+ $this->assertEquals("10.00000000", $paymentItem->getMerchantCommissionRate());
+ $this->assertEquals("0.02000000", $paymentItem->getMerchantCommissionRateAmount());
+ $this->assertEquals("0.00649000", $paymentItem->getIyziCommissionRateAmount());
+ $this->assertEquals("0.05900000", $paymentItem->getIyziCommissionFee());
+ $this->assertEquals("10.00000000", $paymentItem->getBlockageRate());
+ $this->assertEquals("0.02200000", $paymentItem->getBlockageRateAmountMerchant());
+ $this->assertEquals("0", $paymentItem->getBlockageRateAmountSubMerchant());
+ $this->assertEquals("2016-03-28 09:27:14", $paymentItem->getBlockageResolvedDate());
+ $this->assertEquals("subMerchantKey", $paymentItem->getSubMerchantKey());
+ $this->assertEquals("0", $paymentItem->getSubMerchantPrice());
+ $this->assertEquals("0E-8", $paymentItem->getSubMerchantPayoutRate());
+ $this->assertEquals("0", $paymentItem->getSubMerchantPayoutAmount());
+ $this->assertEquals("0.13251000", $paymentItem->getMerchantPayoutAmount());
+ $this->assertNotEmpty($paymentItem->getConvertedPayout());
+ $this->assertEquals("0.22000000", $paymentItem->getConvertedPayout()->getPaidPrice());
+ $this->assertEquals("0.00649000", $paymentItem->getConvertedPayout()->getIyziCommissionRateAmount());
+ $this->assertEquals("0.05900000", $paymentItem->getConvertedPayout()->getIyziCommissionFee());
+ $this->assertEquals("0.02200000", $paymentItem->getConvertedPayout()->getBlockageRateAmountMerchant());
+ $this->assertEquals("0E-8", $paymentItem->getConvertedPayout()->getBlockageRateAmountSubMerchant());
+ $this->assertEquals("0E-8", $paymentItem->getConvertedPayout()->getSubMerchantPayoutAmount());
+ $this->assertEquals("0.13251000", $paymentItem->getConvertedPayout()->getMerchantPayoutAmount());
+ $this->assertEquals("0", $paymentItem->getConvertedPayout()->getIyziConversionRate());
+ $this->assertEquals("0", $paymentItem->getConvertedPayout()->getIyziConversionRateAmount());
+ $this->assertEquals(Currency::TL, $paymentItem->getConvertedPayout()->getCurrency());
+ }
+}
diff --git a/tests/Iyzipay/Tests/Model/ThreedsV2PaymentTest.php b/tests/Iyzipay/Tests/Model/ThreedsV2PaymentTest.php
new file mode 100644
index 00000000..be77cd1a
--- /dev/null
+++ b/tests/Iyzipay/Tests/Model/ThreedsV2PaymentTest.php
@@ -0,0 +1,19 @@
+expectHttpPost();
+
+ $threedsV2Payment = ThreedsV2Payment::create(new CreateThreedsV2PaymentRequest(), $this->options);
+
+ $this->verifyResource($threedsV2Payment);
+ }
+}
\ No newline at end of file
diff --git a/tests/Iyzipay/Tests/Request/CreateThreedsV2PaymentRequestTest.php b/tests/Iyzipay/Tests/Request/CreateThreedsV2PaymentRequestTest.php
new file mode 100644
index 00000000..13286246
--- /dev/null
+++ b/tests/Iyzipay/Tests/Request/CreateThreedsV2PaymentRequestTest.php
@@ -0,0 +1,68 @@
+prepareRequest();
+ $jsonObject = $request->getJsonObject();
+
+ $this->assertEquals(Locale::TR, $jsonObject["locale"]);
+ $this->assertEquals("123456789", $jsonObject["conversationId"]);
+ $this->assertEquals("1", $jsonObject["paymentId"]);
+ $this->assertEquals("1.2", $jsonObject["paidPrice"]);
+ $this->assertEquals("B123456", $jsonObject["basketId"]);
+ $this->assertEquals(Currency::EUR, $jsonObject["currency"]);
+ }
+
+ public function test_should_convert_to_pki_request_string()
+ {
+ $request = $this->prepareRequest();
+
+ $str = "[locale=tr," .
+ "conversationId=123456789," .
+ "paymentId=1," .
+ "paidPrice=1.2," .
+ "basketId=B123456," .
+ "currency=EUR]";
+
+ $this->assertEquals($str, $request->toPKIRequestString());
+ }
+
+ public function test_should_get_json_string()
+ {
+ $request = $this->prepareRequest();
+
+ $json = '
+ {
+ "locale":"tr",
+ "conversationId":"123456789",
+ "paymentId":"1",
+ "paidPrice":"1.2",
+ "basketId":"B123456",
+ "currency":"EUR"
+ }';
+
+ $this->assertJson($request->toJsonString());
+ $this->assertJsonStringEqualsJsonString($json, $request->toJsonString());
+ }
+
+ private function prepareRequest()
+ {
+ $request = new CreateThreedsV2PaymentRequest();
+ $request->setLocale(Locale::TR);
+ $request->setConversationId("123456789");
+ $request->setPaymentId("1");
+ $request->setPaidPrice("1.2");
+ $request->setBasketId("B123456");
+ $request->setCurrency(Currency::EUR);
+ return $request;
+ }
+}
\ No newline at end of file