From 40ee36688b94175b512faeaba7cd7d2d4954caa7 Mon Sep 17 00:00:00 2001 From: Osman Keser Date: Mon, 23 Sep 2024 17:21:16 +0300 Subject: [PATCH] Ok complete (#195) * PHP version update * Card Blacklist services & tests * iyziLink Ccreate Product service upgrade complete, FastLink with 404 error * IyziLink FastLink create complete * IyziLink Update Product Status Complete * requestToStringQuery type update * IyziLink / Search Merchant Products complete * PHP version update * Create C2C Submerchant complete * Verify C2C Submerchant complete * Create & Verify C2C Submerchant tests complete * create function return type added * Minor type fixes * Amount Bsee Refund Services & sample complete * Amount Base Refund tests complete * PlusInstallment: Create Payment service complete * PlusInstallment: Create Payment sample & tests complete * Base model updates * Mail address change * getHttpHeadersV2 function params update * reportingScrollTransaction type added * Reporting: Scroll Transaction Reporting service complete * Reporting: Scroll Transaction Reporting sample & tests complete * Subscription List service partially complete with date format error. * Subscription List sample & tests complete * Uncommented lines * Subscription: Delete Customer service complete * Subscription: Delete Customer sample & tests complete * Date filters format fix * sms verification code encryption for verify endpoint complete * payload uri re-structured for v2 headers * signature verification function implemented * CheckoutFormInitialize service updated to v2 headers * Removed unused line * Function updated to reflect params order variations * Added signature verification sample codes * BKM Initialize service updated with v2 headers along with signature verification sample * CheckoutForm Retrieve service updated to v2 Headers * BKM Retrieve service updated to v2 headers * Payment Service Initialize 3D Payment updated to v2 headers * Payment Service Create 3D Payment updated to v2 headers * Payment Service Create Non3D Payment updated to v2 headers * Payment Service Retrieve Payment Result updated to v2 headers * Cleanup * Provision Service Create Non3D Preauth updated to v2 headers along with a sample file * Provision Service Initialize 3D Preatuh updated to v2 headers along with a sample file * Provision Service Initialize CheckoutForm Preauth updated to v2 headers along with a sample file * Provision Service Create PostAuth updated to v2 headers along with a sample file * PWI Services Initialize updated to v2 headers * Cleanup * PWI Services Retrieve updated to v2 headers * removed used token * AUTHORIZATION_FALLBACK_HEADER added to v2 headers * APM Service Initialize & Retrieve updated to v2 headers * Updated Service in sample file * Signature verification test codes added * Signature field moved to Resource file * paymentId field added into request and sample file * sample file create_threads_preauth renamed to initialize_checkoutform_preauth * Loyalty/Inquire service updated to v2 headers * Marketplace Services updated to v2 headers * Marketplace C2C Services updated to v2 headers * Payment Services updated to v2 headers * PlusInstallment Service updated to v2 headers * Reporting Service updated to v2 headers * Card Register Service updated to v2 headers * Card BlackList Service updated to v2 headers * Payment & iyziUp Services updated to v2 headers * PaymentPreAuth Retrieve updated to v2 headers along with a signature verification test codes included sample file * iyziUp Form Services updated to v2 headers * installmentHtml Service updated to v2 headers * Crossbooking Services updated to v2 headers * Payment Services updated to v2 headers * callbackUrl & webhook signature validation files added to samples folder * Variable name fixes * chore: Update IyziAuthV2Generator.php and AmountBaseRefund.php * chore: Update .gitignore to exclude index.php file * gitignore updated * ReportingPaymentDetailRequest bug fix * amount_base_refund uri bug fix * getHttpHeadersIsV2 method added * Remove test.php file * ucs_init.php print_r fixed * getHttpHeadersV2 to getHttpHeadersIsV2 * Refactor ThreedsPayment::retrieve method to use getHttpHeadersV2 for API request * Refactor ThreedsPayment::retrieve method to use getHttpHeadersV2 for API request * Update github_pull_request.yml Signed-off-by: Erdem Demir <35841628+erdemdmr@users.noreply.github.com> * Update PHP version requirement to 7.4 and later * Update github_pull_request.yml Signed-off-by: Erdem Demir <35841628+erdemdmr@users.noreply.github.com> * Update PHPUnit version requirement to 5.4.* * Update PHPUnit version requirement to ~9.6 * FileBase64Encoder rename FileBase64EncoderTest * Refactor test classes to extend TestCase * Ok fixes (#196) * getHttpHeaders function added * Function updated to allow nullable request * Function updated to allow nullable request * Fixes to pass tests in accordance with respective request class * fixes failure "Iyzipay\Tests\Request\CreateBasicBkmInitializeRequestTest::test_should_get_json_object" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "7) Iyzipay\Tests\Request\CreateCheckoutFormInitializeRequestTest::test_should_get_json_string" * fixes failure "8) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestTest::test_should_get_json_string" * fixes failure "9) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestWithInitialConsumerTest::test_should_get_json_string" * fixes failure "10) Iyzipay\Tests\Request\Subscription\SubscriptionUpgradeRequestTest::test_should_get_json_string" * fixes failure "11) Iyzipay\Tests\Request\UpdateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "5) Iyzipay\Tests\Request\CreateBasicPaymentRequestTest::test_should_get_json_string" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "1) Iyzipay\Tests\DefaultHttpClientTest::test_should_check_if_options_not_empty" --------- Co-authored-by: Osman Keser * Ok fixes (#197) * getHttpHeaders function added * Function updated to allow nullable request * Function updated to allow nullable request * Fixes to pass tests in accordance with respective request class * fixes failure "Iyzipay\Tests\Request\CreateBasicBkmInitializeRequestTest::test_should_get_json_object" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "7) Iyzipay\Tests\Request\CreateCheckoutFormInitializeRequestTest::test_should_get_json_string" * fixes failure "8) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestTest::test_should_get_json_string" * fixes failure "9) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestWithInitialConsumerTest::test_should_get_json_string" * fixes failure "10) Iyzipay\Tests\Request\Subscription\SubscriptionUpgradeRequestTest::test_should_get_json_string" * fixes failure "11) Iyzipay\Tests\Request\UpdateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "5) Iyzipay\Tests\Request\CreateBasicPaymentRequestTest::test_should_get_json_string" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "1) Iyzipay\Tests\DefaultHttpClientTest::test_should_check_if_options_not_empty" * fixes error 1 "Call to undefined method..." * fixes error 2 "file_get_contents/.... Failed to open stream" --------- Co-authored-by: Osman Keser * Ok fixes (#198) * getHttpHeaders function added * Function updated to allow nullable request * Function updated to allow nullable request * Fixes to pass tests in accordance with respective request class * fixes failure "Iyzipay\Tests\Request\CreateBasicBkmInitializeRequestTest::test_should_get_json_object" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "7) Iyzipay\Tests\Request\CreateCheckoutFormInitializeRequestTest::test_should_get_json_string" * fixes failure "8) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestTest::test_should_get_json_string" * fixes failure "9) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestWithInitialConsumerTest::test_should_get_json_string" * fixes failure "10) Iyzipay\Tests\Request\Subscription\SubscriptionUpgradeRequestTest::test_should_get_json_string" * fixes failure "11) Iyzipay\Tests\Request\UpdateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "5) Iyzipay\Tests\Request\CreateBasicPaymentRequestTest::test_should_get_json_string" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "1) Iyzipay\Tests\DefaultHttpClientTest::test_should_check_if_options_not_empty" * fixes error 1 "Call to undefined method..." * fixes error 2 "file_get_contents/.... Failed to open stream" * Put, Patch fix --------- Co-authored-by: Osman Keser * Ok fixes (#200) * getHttpHeaders function added * Function updated to allow nullable request * Function updated to allow nullable request * Fixes to pass tests in accordance with respective request class * fixes failure "Iyzipay\Tests\Request\CreateBasicBkmInitializeRequestTest::test_should_get_json_object" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "7) Iyzipay\Tests\Request\CreateCheckoutFormInitializeRequestTest::test_should_get_json_string" * fixes failure "8) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestTest::test_should_get_json_string" * fixes failure "9) Iyzipay\Tests\Request\CreateIyziupFormInitializeRequestWithInitialConsumerTest::test_should_get_json_string" * fixes failure "10) Iyzipay\Tests\Request\Subscription\SubscriptionUpgradeRequestTest::test_should_get_json_string" * fixes failure "11) Iyzipay\Tests\Request\UpdateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "5) Iyzipay\Tests\Request\CreateBasicPaymentRequestTest::test_should_get_json_string" * fixes failure "6) Iyzipay\Tests\Request\CreateBlacklistedCardRequestTest::test_should_convert_to_pki_request_string" * fixes failure "1) Iyzipay\Tests\DefaultHttpClientTest::test_should_check_if_options_not_empty" * fixes error 1 "Call to undefined method..." * fixes error 2 "file_get_contents/.... Failed to open stream" * Put, Patch fix * Put, Patch fix --------- Co-authored-by: Osman Keser --------- Signed-off-by: Erdem Demir <35841628+erdemdmr@users.noreply.github.com> Co-authored-by: Osman Keser Co-authored-by: tarikkamat Co-authored-by: Erdem Demir <35841628+erdemdmr@users.noreply.github.com> --- .github/workflows/github_pull_request.yml | 6 +- .gitignore | 11 + README.md | 2 +- composer.json | 6 +- samples/amount_base_refund.php | 17 ++ samples/callbackUrl_Signature_Validation.php | 50 ++++ samples/create_blacklisted_card.php | 16 ++ samples/create_c2c_sub_merchant.php | 22 ++ samples/create_payment.php | 16 +- samples/create_payment_postauth.php | 32 +++ samples/create_payment_preauth.php | 105 ++++++++ .../create_payment_with_registered_card.php | 15 +- samples/create_plus_installment_payment.php | 87 ++++++ samples/create_threeds_payment.php | 16 +- samples/initialize_apm.php | 12 +- samples/initialize_bkm.php | 12 +- samples/initialize_checkout_form.php | 12 +- samples/initialize_checkoutform_preauth.php | 99 +++++++ samples/initialize_pay_with_iyzico.php | 11 +- samples/initialize_threeds.php | 12 +- samples/initialize_threeds_preauth.php | 102 +++++++ samples/iyzilink_add_product_sample.php | 3 + samples/iyzilink_create_fastlink_sample.php | 18 ++ ...ilink_search_merchant_products_example.php | 16 ++ samples/iyzilink_update_product_status.php | 15 ++ samples/reporting_payment_detail.php | 3 + samples/reporting_scroll_transaction.php | 16 ++ samples/retrieve_apm.php | 17 +- samples/retrieve_bkm_result.php | 20 +- samples/retrieve_blacklisted_card.php | 15 ++ samples/retrieve_checkout_form_result.php | 18 +- samples/retrieve_pay_with_iyzico_result.php | 18 +- samples/retrieve_payment_preauth.php | 29 ++ samples/retrieve_payment_result.php | 18 +- samples/signature_verification.php | 9 + .../subscription-samples/delete_customer.php | 12 + .../subscription_list.php | 22 ++ samples/ucs_init.php | 4 +- samples/update_blacklisted_card.php | 16 ++ samples/verify_c2c_sub_merchant.php | 24 ++ samples/webhook_Signature_Validation.php | 98 +++++++ src/Iyzipay/DefaultHttpClient.php | 12 + src/Iyzipay/HashGenerator.php | 5 +- src/Iyzipay/IyziAuthV2Generator.php | 19 +- src/Iyzipay/IyzipayResource.php | 27 +- src/Iyzipay/Model/AmountBaseRefund.php | 52 ++++ src/Iyzipay/Model/Apm.php | 6 +- src/Iyzipay/Model/ApmResource.php | 11 + src/Iyzipay/Model/Approval.php | 3 +- src/Iyzipay/Model/BasicBkm.php | 3 +- src/Iyzipay/Model/BasicBkmInitialize.php | 3 +- src/Iyzipay/Model/BasicPayment.php | 3 +- src/Iyzipay/Model/BasicPaymentPostAuth.php | 3 +- src/Iyzipay/Model/BasicPaymentPreAuth.php | 3 +- src/Iyzipay/Model/BasicThreedsInitialize.php | 3 +- .../Model/BasicThreedsInitializePreAuth.php | 3 +- src/Iyzipay/Model/BasicThreedsPayment.php | 3 +- src/Iyzipay/Model/BinNumber.php | 3 +- src/Iyzipay/Model/Bkm.php | 12 +- src/Iyzipay/Model/BkmInitialize.php | 14 +- src/Iyzipay/Model/BlacklistedCard.php | 58 ++++ src/Iyzipay/Model/BouncedBankTransferList.php | 3 +- src/Iyzipay/Model/C2CSubMerchant.php | 119 ++++++++ .../Model/C2CSubMerchantApiCredentials.php | 24 ++ ...ubMerchantSmsVerificationCodeEncrypter.php | 19 ++ src/Iyzipay/Model/Cancel.php | 3 +- src/Iyzipay/Model/Card.php | 5 +- src/Iyzipay/Model/CardList.php | 3 +- src/Iyzipay/Model/CheckoutForm.php | 15 +- src/Iyzipay/Model/CheckoutFormInitialize.php | 3 +- .../Model/CheckoutFormInitializePreAuth.php | 3 +- .../Model/CheckoutFormInitializeResource.php | 9 + .../Model/CrossBookingFromSubMerchant.php | 3 +- .../Model/CrossBookingToSubMerchant.php | 3 +- src/Iyzipay/Model/Disapproval.php | 3 +- src/Iyzipay/Model/InstallmentHtml.php | 3 +- src/Iyzipay/Model/InstallmentInfo.php | 3 +- .../Model/Iyzilink/IyziLinkDeleteProduct.php | 2 +- .../Model/Iyzilink/IyziLinkFastLink.php | 54 ++++ .../Iyzilink/IyziLinkRetrieveProduct.php | 2 +- .../Model/Iyzilink/IyziLinkSaveProduct.php | 10 +- .../Iyzilink/IyziLinkSaveProductResource.php | 33 +++ .../IyziLinkSearchMerchantProducts.php | 36 +++ .../Iyzilink/IyziLinkUpdateProductStatus.php | 38 +++ src/Iyzipay/Model/IyziupForm.php | 3 +- src/Iyzipay/Model/IyziupFormInitialize.php | 3 +- src/Iyzipay/Model/Loyalty.php | 3 +- .../Model/Mapper/AmountBaseRefundMapper.php | 33 +++ .../Model/Mapper/ApmResourceMapper.php | 3 + .../Model/Mapper/BkmInitializeMapper.php | 3 + .../Model/Mapper/BlacklistedCardMapper.php | 41 +++ .../Model/Mapper/C2CSubMerchantMapper.php | 61 +++++ .../CheckoutFormInitializeResourceMapper.php | 3 + .../Iyzilink/IyziLinkCreateFastLinkMapper.php | 38 +++ .../IyziLinkSearchMerchantProductsMapper.php | 30 +++ .../IyziLinkUpdateProductStatusMapper.php | 30 +++ .../PayWithIyzicoInitializeResourceMapper.php | 3 + .../Model/Mapper/PayWithIyzicoMapper.php | 6 + .../Model/Mapper/PaymentResourceMapper.php | 3 + .../Mapper/PlusInstallmentPaymentMapper.php | 20 ++ .../PlusInstallmentPaymentResourceMapper.php | 77 ++++++ .../ReportingScrollTransactionMapper.php | 33 +++ .../SubscriptionDeleteCustomerMapper.php | 28 ++ .../Subscription/SubscriptionListMapper.php | 58 ++++ .../Model/Mapper/ThreedsInitializeMapper.php | 6 + .../Mapper/ThreedsInitializePreAuthMapper.php | 6 + src/Iyzipay/Model/PayWithIyzico.php | 24 +- src/Iyzipay/Model/PayWithIyzicoInitialize.php | 4 +- .../Model/PayWithIyzicoInitializeResource.php | 10 + src/Iyzipay/Model/Payment.php | 8 +- src/Iyzipay/Model/PaymentPostAuth.php | 14 +- src/Iyzipay/Model/PaymentPreAuth.php | 6 +- src/Iyzipay/Model/PaymentResource.php | 11 + .../Model/PayoutCompletedTransactionList.php | 3 +- src/Iyzipay/Model/PlusInstallmentPayment.php | 15 ++ .../Model/PlusInstallmentPaymentResource.php | 134 ++++++++++ src/Iyzipay/Model/ProtectedOverleyScript.php | 3 +- src/Iyzipay/Model/Refund.php | 3 +- .../Model/RefundChargedFromMerchant.php | 3 +- src/Iyzipay/Model/RefundToBalance.php | 3 +- src/Iyzipay/Model/ReportingPaymentDetail.php | 4 +- .../Model/ReportingScrollTransaction.php | 46 ++++ src/Iyzipay/Model/SettlementToBalance.php | 3 +- src/Iyzipay/Model/Status.php | 5 +- src/Iyzipay/Model/SubMerchant.php | 9 +- .../Model/SubMerchantPaymentItemUpdate.php | 3 +- .../Model/Subscription/RetrieveList.php | 16 +- .../SubscriptionDeleteCustomer.php | 27 ++ .../Model/Subscription/SubscriptionList.php | 101 +++++++ .../Subscription/SubscriptionProduct.php | 12 +- src/Iyzipay/Model/ThreedsInitialize.php | 36 ++- .../Model/ThreedsInitializePreAuth.php | 25 +- src/Iyzipay/Model/ThreedsPayment.php | 18 +- src/Iyzipay/Model/UCSInitialize.php | 2 +- .../Request/AmountBaseRefundRequest.php | 53 ++++ .../Request/CreateBlackListedCardRequest.php | 43 +++ .../Request/CreateC2CSubMerchantRequest.php | 109 ++++++++ .../CreatePlusInstallmentPaymentRequest.php | 180 +++++++++++++ .../IyziLinkCreateFastLinkRequest.php | 54 ++++ .../Iyzilink/IyziLinkSaveProductRequest.php | 36 +++ .../IyziLinkSearchMerchantProductsRequest.php | 43 +++ .../IyziLinkUpdateProductStatusRequest.php | 34 +++ .../Request/ReportingPaymentDetailRequest.php | 14 +- .../ReportingScrollTransactionRequest.php | 44 +++ .../RetrieveBlacklistedCardRequest.php | 32 +++ .../SubscriptionDeleteCustomerRequest.php | 24 ++ .../Subscription/SubscriptionListRequest.php | 104 +++++++ .../Request/UpdateBlackListedCardRequest.php | 43 +++ .../Request/VerifyC2CSubMerchantRequest.php | 43 +++ src/Iyzipay/RequestStringBuilder.php | 19 +- tests/Iyzipay/Tests/ApiResourceTest.php | 2 +- tests/Iyzipay/Tests/CurlTest.php | 5 +- tests/Iyzipay/Tests/DefaultHttpClientTest.php | 6 +- ...4Encoder.php => FileBase64EncoderTest.php} | 4 +- .../Iyzipay/Tests/IyzipayResourceTestCase.php | 29 +- .../Tests/Model/AmountBaseRefundTest.php | 15 ++ .../Tests/Model/BlacklistedCardTest.php | 29 ++ .../Tests/Model/C2CSubMerchantTest.php | 47 ++++ .../Iyzilink/IyziLinkCreateFastLinkTest.php | 23 ++ .../IyziLinkSearchMerchantProductsTest.php | 21 ++ .../IyziLinkUpdateProductStatusTest.php | 21 ++ .../Mapper/BlacklistedCardMapperTest.php | 43 +++ .../IyziLinkUpdateProductStatusMapperTest.php | 21 ++ .../Model/PlusInstallmentPaymentTest.php | 102 +++++++ .../Model/ReportingScrollTransactionTest.php | 22 ++ .../SubscriptionDeleteCustomerTest.php | 18 ++ .../Subscription/SubscriptionListTest.php | 26 ++ .../Request/AmountBaseRefundRequestTest.php | 73 +++++ .../CreateBasicBkmInitializeRequestTest.php | 4 +- .../Request/CreateBasicPaymentRequestTest.php | 2 +- .../CreateBlacklistedCardRequestTest.php | 55 ++++ .../CreateC2CSubMerchantRequestTest.php | 79 ++++++ ...reateCheckoutFormInitializeRequestTest.php | 2 +- .../CreateIyziupFormInitializeRequestTest.php | 2 +- ...itializeRequestWithInitialConsumerTest.php | 2 +- .../IyziLinkCreateFastLinkRequestTest.php | 35 +++ .../IyziLinkSaveRequestProductTest.php | 8 +- ...iLinkSearchMerchantProductsRequestTest.php | 29 ++ ...IyziLinkUpdateProductStatusRequestTest.php | 28 ++ ...lusInstallmentCreatePaymentRequestTest.php | 253 ++++++++++++++++++ .../ReportingScrollTransactionRequestTest.php | 27 ++ .../RetrieveBlacklistedCardRequestTest.php | 50 ++++ .../SubscriptionDeleteCustomerRequestTest.php | 21 ++ .../SubscriptionListRequestTest.php | 37 +++ .../SubscriptionUpgradeRequestTest.php | 8 +- .../UpdateBlacklistedCardRequestTest.php | 55 ++++ .../VerifyC2CSubMerchantRequestTest.php | 56 ++++ tests/Iyzipay/Tests/TestCase.php | 8 +- .../Iyzipay/Tests/mock/blacklisted-card.json | 12 + .../mock/iyzilink-update-product-status.json | 5 + .../Tests/mock/retrieve-blacklisted-card.json | 10 + 191 files changed, 4750 insertions(+), 153 deletions(-) create mode 100644 samples/amount_base_refund.php create mode 100644 samples/callbackUrl_Signature_Validation.php create mode 100644 samples/create_blacklisted_card.php create mode 100644 samples/create_c2c_sub_merchant.php create mode 100644 samples/create_payment_postauth.php create mode 100644 samples/create_payment_preauth.php create mode 100644 samples/create_plus_installment_payment.php create mode 100644 samples/initialize_checkoutform_preauth.php create mode 100644 samples/initialize_threeds_preauth.php create mode 100644 samples/iyzilink_create_fastlink_sample.php create mode 100644 samples/iyzilink_search_merchant_products_example.php create mode 100644 samples/iyzilink_update_product_status.php create mode 100644 samples/reporting_scroll_transaction.php create mode 100644 samples/retrieve_blacklisted_card.php create mode 100644 samples/retrieve_payment_preauth.php create mode 100644 samples/signature_verification.php create mode 100644 samples/subscription-samples/delete_customer.php create mode 100644 samples/subscription-samples/subscription_list.php create mode 100644 samples/update_blacklisted_card.php create mode 100644 samples/verify_c2c_sub_merchant.php create mode 100644 samples/webhook_Signature_Validation.php create mode 100644 src/Iyzipay/Model/AmountBaseRefund.php create mode 100644 src/Iyzipay/Model/BlacklistedCard.php create mode 100644 src/Iyzipay/Model/C2CSubMerchant.php create mode 100644 src/Iyzipay/Model/C2CSubMerchantApiCredentials.php create mode 100644 src/Iyzipay/Model/C2CSubMerchantSmsVerificationCodeEncrypter.php create mode 100644 src/Iyzipay/Model/Iyzilink/IyziLinkFastLink.php create mode 100644 src/Iyzipay/Model/Iyzilink/IyziLinkSearchMerchantProducts.php create mode 100644 src/Iyzipay/Model/Iyzilink/IyziLinkUpdateProductStatus.php create mode 100644 src/Iyzipay/Model/Mapper/AmountBaseRefundMapper.php create mode 100644 src/Iyzipay/Model/Mapper/BlacklistedCardMapper.php create mode 100644 src/Iyzipay/Model/Mapper/C2CSubMerchantMapper.php create mode 100644 src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkCreateFastLinkMapper.php create mode 100644 src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkSearchMerchantProductsMapper.php create mode 100644 src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapper.php create mode 100644 src/Iyzipay/Model/Mapper/PlusInstallmentPaymentMapper.php create mode 100644 src/Iyzipay/Model/Mapper/PlusInstallmentPaymentResourceMapper.php create mode 100644 src/Iyzipay/Model/Mapper/ReportingScrollTransactionMapper.php create mode 100644 src/Iyzipay/Model/Mapper/Subscription/SubscriptionDeleteCustomerMapper.php create mode 100644 src/Iyzipay/Model/Mapper/Subscription/SubscriptionListMapper.php create mode 100644 src/Iyzipay/Model/PlusInstallmentPayment.php create mode 100644 src/Iyzipay/Model/PlusInstallmentPaymentResource.php create mode 100644 src/Iyzipay/Model/ReportingScrollTransaction.php create mode 100644 src/Iyzipay/Model/Subscription/SubscriptionDeleteCustomer.php create mode 100644 src/Iyzipay/Model/Subscription/SubscriptionList.php create mode 100644 src/Iyzipay/Request/AmountBaseRefundRequest.php create mode 100644 src/Iyzipay/Request/CreateBlackListedCardRequest.php create mode 100644 src/Iyzipay/Request/CreateC2CSubMerchantRequest.php create mode 100644 src/Iyzipay/Request/CreatePlusInstallmentPaymentRequest.php create mode 100644 src/Iyzipay/Request/Iyzilink/IyziLinkCreateFastLinkRequest.php create mode 100644 src/Iyzipay/Request/Iyzilink/IyziLinkSearchMerchantProductsRequest.php create mode 100644 src/Iyzipay/Request/Iyzilink/IyziLinkUpdateProductStatusRequest.php create mode 100644 src/Iyzipay/Request/ReportingScrollTransactionRequest.php create mode 100644 src/Iyzipay/Request/RetrieveBlacklistedCardRequest.php create mode 100644 src/Iyzipay/Request/Subscription/SubscriptionDeleteCustomerRequest.php create mode 100644 src/Iyzipay/Request/Subscription/SubscriptionListRequest.php create mode 100644 src/Iyzipay/Request/UpdateBlackListedCardRequest.php create mode 100644 src/Iyzipay/Request/VerifyC2CSubMerchantRequest.php rename tests/Iyzipay/Tests/{FileBase64Encoder.php => FileBase64EncoderTest.php} (68%) create mode 100644 tests/Iyzipay/Tests/Model/AmountBaseRefundTest.php create mode 100644 tests/Iyzipay/Tests/Model/BlacklistedCardTest.php create mode 100644 tests/Iyzipay/Tests/Model/C2CSubMerchantTest.php create mode 100644 tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkCreateFastLinkTest.php create mode 100644 tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkSearchMerchantProductsTest.php create mode 100644 tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php create mode 100644 tests/Iyzipay/Tests/Model/Mapper/BlacklistedCardMapperTest.php create mode 100644 tests/Iyzipay/Tests/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapperTest.php create mode 100644 tests/Iyzipay/Tests/Model/PlusInstallmentPaymentTest.php create mode 100644 tests/Iyzipay/Tests/Model/ReportingScrollTransactionTest.php create mode 100644 tests/Iyzipay/Tests/Model/Subscription/SubscriptionDeleteCustomerTest.php create mode 100644 tests/Iyzipay/Tests/Model/Subscription/SubscriptionListTest.php create mode 100644 tests/Iyzipay/Tests/Request/AmountBaseRefundRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/CreateBlacklistedCardRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/CreateC2CSubMerchantRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkCreateFastLinkRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSearchMerchantProductsRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkUpdateProductStatusRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/PlusInstallmentCreatePaymentRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/ReportingScrollTransactionRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/RetrieveBlacklistedCardRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/Subscription/SubscriptionDeleteCustomerRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/Subscription/SubscriptionListRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/UpdateBlacklistedCardRequestTest.php create mode 100644 tests/Iyzipay/Tests/Request/VerifyC2CSubMerchantRequestTest.php create mode 100644 tests/Iyzipay/Tests/mock/blacklisted-card.json create mode 100644 tests/Iyzipay/Tests/mock/iyzilink-update-product-status.json create mode 100644 tests/Iyzipay/Tests/mock/retrieve-blacklisted-card.json diff --git a/.github/workflows/github_pull_request.yml b/.github/workflows/github_pull_request.yml index 363beef8..4797d89b 100644 --- a/.github/workflows/github_pull_request.yml +++ b/.github/workflows/github_pull_request.yml @@ -9,14 +9,12 @@ permissions: jobs: build: - runs-on: ubuntu-latest - strategy: matrix: - php-versions: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2'] + php-versions: ['7.4', '8.0', '8.1', '8.2'] include: - - php-versions: '5.3' + - php-versions: '7.4' steps: - uses: actions/checkout@v3 diff --git a/.gitignore b/.gitignore index 5017d9c4..9aaba441 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,14 @@ build/ composer.lock composer.phar vendor/* + +.phpunit.result.cache + +# PHPFiles +index.php + +# VSCode +.vscode + +# SonarQube +.scannerwork \ No newline at end of file diff --git a/README.md b/README.md index 742fa1db..a614da3c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ You can sign up for an iyzico account at https://iyzico.com # Requirements -PHP 5.6 and later. +PHP 7.4 and later. ### Note diff --git a/composer.json b/composer.json index c829ea44..ce2643c4 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,11 @@ } ], "require": { - "php": ">=5.3.0", + "php": ">=7.4.0", "ext-curl": "*" }, "require-dev": { - "phpunit/phpunit": "~4.0", + "phpunit/phpunit": "~9.6", "satooshi/php-coveralls": "~0.6.1" }, "autoload": { @@ -41,4 +41,4 @@ "scripts": { "test": "vendor/bin/phpunit --colors" } -} +} \ No newline at end of file diff --git a/samples/amount_base_refund.php b/samples/amount_base_refund.php new file mode 100644 index 00000000..e039806b --- /dev/null +++ b/samples/amount_base_refund.php @@ -0,0 +1,17 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId('123456789'); + $request->setPaymentId('2921546163'); + $request->setPrice(3.12); + $request->setIp('85.34.78.112'); + + $amountBaseRefund = \Iyzipay\Model\AmountBaseRefund::create($request, Config::options()); + print_r($amountBaseRefund); +} + +amountBaseRefund(); diff --git a/samples/callbackUrl_Signature_Validation.php b/samples/callbackUrl_Signature_Validation.php new file mode 100644 index 00000000..70b771d8 --- /dev/null +++ b/samples/callbackUrl_Signature_Validation.php @@ -0,0 +1,50 @@ + \ No newline at end of file diff --git a/samples/create_blacklisted_card.php b/samples/create_blacklisted_card.php new file mode 100644 index 00000000..be1ac1ae --- /dev/null +++ b/samples/create_blacklisted_card.php @@ -0,0 +1,16 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId("123456789"); + $request->setCardToken('G7Zzo5Y24cxwaIwC4h+jUJXtqTA='); + $request->setCardUserKey('ew9hzoujBUJgOUer8st0ler0dOQ='); + + $blacklistedCard = \Iyzipay\Model\BlacklistedCard::create($request, Config::options()); + print_r($blacklistedCard); +} + +createBlacklistedCard(); diff --git a/samples/create_c2c_sub_merchant.php b/samples/create_c2c_sub_merchant.php new file mode 100644 index 00000000..38605602 --- /dev/null +++ b/samples/create_c2c_sub_merchant.php @@ -0,0 +1,22 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId('299487456'); + $request->setName('John'); + $request->setSurname('Doe'); + $request->setEmail('email@email.com'); + $request->setGsmNumber('+905558001479'); + $request->setTckNo('55555555555'); + $request->setBirthDate('1996-10-07'); + $request->setAddress('Besiktas / Istanbul'); + $request->setExternalId('ccd74b86-e4a8-469e-b3d3-312f0544ea6e'); + + $c2cSubMerchant = \Iyzipay\Model\C2CSubMerchant::create($request, Config::options()); + print_r($c2cSubMerchant); +} + +createC2CSubMerchant(); diff --git a/samples/create_payment.php b/samples/create_payment.php index ba57d45a..68989ff4 100644 --- a/samples/create_payment.php +++ b/samples/create_payment.php @@ -1,6 +1,7 @@ getPaymentId(); +$currency = $payment->getCurrency(); +$basketId = $payment->getBasketId(); +$conversationId = $payment->getConversationId(); +$paidPrice = $payment->getPaidPrice(); +$price = $payment->getPrice(); +$signature = $payment->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/samples/create_payment_postauth.php b/samples/create_payment_postauth.php new file mode 100644 index 00000000..0efc1be6 --- /dev/null +++ b/samples/create_payment_postauth.php @@ -0,0 +1,32 @@ +setLocale(\Iyzipay\Model\Locale::TR); +$request->setConversationId("123456789"); +$request->setPaymentId("1"); +$request->setPaidPrice("1.2"); +$request->setIp("85.34.78.112"); +$request->setCurrency(\Iyzipay\Model\Currency::TL); + +# make request +$postAuth = \Iyzipay\Model\PaymentPostAuth::create($request, Config::options()); + +# print result +print_r($postAuth); + +#verify signature +$paymentId = $postAuth->getPaymentId(); +$currency = $postAuth->getCurrency(); +$basketId = $postAuth->getBasketId(); +$conversationId = $postAuth->getConversationId(); +$paidPrice = $postAuth->getPaidPrice(1); +$price = $postAuth->getPrice(); +$signature = $postAuth->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/samples/create_payment_preauth.php b/samples/create_payment_preauth.php new file mode 100644 index 00000000..9081d124 --- /dev/null +++ b/samples/create_payment_preauth.php @@ -0,0 +1,105 @@ +setLocale(\Iyzipay\Model\Locale::TR); +$request->setConversationId("123456789"); +$request->setPrice("1"); +$request->setPaidPrice("1.2"); +$request->setCurrency(\Iyzipay\Model\Currency::TL); +$request->setInstallment(1); +$request->setBasketId("B67832"); +$request->setPaymentChannel(\Iyzipay\Model\PaymentChannel::WEB); +$request->setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT); + +$paymentCard = new \Iyzipay\Model\PaymentCard(); +$paymentCard->setCardHolderName("John Doe"); +$paymentCard->setCardNumber("5528790000000008"); +$paymentCard->setExpireMonth("12"); +$paymentCard->setExpireYear("2030"); +$paymentCard->setCvc("123"); +$paymentCard->setRegisterCard(0); +$request->setPaymentCard($paymentCard); + +$buyer = new \Iyzipay\Model\Buyer(); +$buyer->setId("BY789"); +$buyer->setName("John"); +$buyer->setSurname("Doe"); +$buyer->setGsmNumber("+905350000000"); +$buyer->setEmail("email@email.com"); +$buyer->setIdentityNumber("74300864791"); +$buyer->setLastLoginDate("2015-10-05 12:43:35"); +$buyer->setRegistrationDate("2013-04-21 15:12:09"); +$buyer->setRegistrationAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$buyer->setIp("85.34.78.112"); +$buyer->setCity("Istanbul"); +$buyer->setCountry("Turkey"); +$buyer->setZipCode("34732"); +$request->setBuyer($buyer); + +$shippingAddress = new \Iyzipay\Model\Address(); +$shippingAddress->setContactName("Jane Doe"); +$shippingAddress->setCity("Istanbul"); +$shippingAddress->setCountry("Turkey"); +$shippingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$shippingAddress->setZipCode("34742"); +$request->setShippingAddress($shippingAddress); + +$billingAddress = new \Iyzipay\Model\Address(); +$billingAddress->setContactName("Jane Doe"); +$billingAddress->setCity("Istanbul"); +$billingAddress->setCountry("Turkey"); +$billingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$billingAddress->setZipCode("34742"); +$request->setBillingAddress($billingAddress); + +$basketItems = array(); +$firstBasketItem = new \Iyzipay\Model\BasketItem(); +$firstBasketItem->setId("BI101"); +$firstBasketItem->setName("Binocular"); +$firstBasketItem->setCategory1("Collectibles"); +$firstBasketItem->setCategory2("Accessories"); +$firstBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); +$firstBasketItem->setPrice("0.3"); +$basketItems[0] = $firstBasketItem; + +$secondBasketItem = new \Iyzipay\Model\BasketItem(); +$secondBasketItem->setId("BI102"); +$secondBasketItem->setName("Game code"); +$secondBasketItem->setCategory1("Game"); +$secondBasketItem->setCategory2("Online Game Items"); +$secondBasketItem->setItemType(\Iyzipay\Model\BasketItemType::VIRTUAL); +$secondBasketItem->setPrice("0.5"); +$basketItems[1] = $secondBasketItem; + +$thirdBasketItem = new \Iyzipay\Model\BasketItem(); +$thirdBasketItem->setId("BI103"); +$thirdBasketItem->setName("Usb"); +$thirdBasketItem->setCategory1("Electronics"); +$thirdBasketItem->setCategory2("Usb / Cable"); +$thirdBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); +$thirdBasketItem->setPrice("0.2"); +$basketItems[2] = $thirdBasketItem; +$request->setBasketItems($basketItems); + +# make request +$payment = \Iyzipay\Model\PaymentPreAuth::create($request, Config::options()); + +# print response +print_r($payment); + +#verify signature +$paymentId = $payment->getPaymentId(); +$currency = $payment->getCurrency(); +$basketId = $payment->getBasketId(); +$conversationId = $payment->getConversationId(); +$paidPrice = $payment->getPaidPrice(); +$price = $payment->getPrice(); +$signature = $payment->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/samples/create_payment_with_registered_card.php b/samples/create_payment_with_registered_card.php index 1a2784b3..e30b8f55 100644 --- a/samples/create_payment_with_registered_card.php +++ b/samples/create_payment_with_registered_card.php @@ -84,4 +84,17 @@ $payment = \Iyzipay\Model\Payment::create($request, Config::options()); # print response -print_r($payment); \ No newline at end of file +print_r($payment); + +#verify signature +$paymentId = $payment->getPaymentId(); +$currency = $payment->getCurrency(); +$basketId = $payment->getBasketId(); +$conversationId = $payment->getConversationId(); +$paidPrice = $payment->getPaidPrice(); +$price = $payment->getPrice(); +$signature = $payment->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/samples/create_plus_installment_payment.php b/samples/create_plus_installment_payment.php new file mode 100644 index 00000000..bfd3abff --- /dev/null +++ b/samples/create_plus_installment_payment.php @@ -0,0 +1,87 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId("123456789"); + $request->setPrice(1); + $request->setPaidPrice(1.1); + $request->setCurrency('TRY'); + $request->setInstallment(1); + $request->setPaymentChannel(Iyzipay\Model\PaymentChannel::WEB); + $request->setBasketId('B67832'); + $request->setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT); + + $card = new \Iyzipay\Model\PaymentCard(); + $card->setCardHolderName('John Doe'); + $card->setCardNumber('5528790000000008'); + $card->setExpireYear('2030'); + $card->setExpireMonth('12'); + $card->setCvc('123'); + $card->setRegisterCard(0); + $request->setPaymentCard($card); + + $buyer = new \Iyzipay\Model\Buyer(); + $buyer->setId('BY789'); + $buyer->setName('John'); + $buyer->setSurname('Doe'); + $buyer->setIdentityNumber('74300864791'); + $buyer->setEmail('email@email.com'); + $buyer->setGsmNumber('+905350000000'); + $buyer->setRegistrationDate('2013-04-21 15:12:09'); + $buyer->setLastLoginDate('2015-10-05 12:43:35'); + $buyer->setRegistrationAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $buyer->setCity('Istanbul'); + $buyer->setCountry('Turkey'); + $buyer->setZipCode('34732'); + $buyer->setIp('85.34.78.112'); + $request->setBuyer($buyer); + + $shippingAddress = new \Iyzipay\Model\Address(); + $shippingAddress->setAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $shippingAddress->setZipCode('34742'); + $shippingAddress->setContactName('Jane Doe'); + $shippingAddress->setCity('Istanbul'); + $shippingAddress->setCountry('Turkey'); + $request->setShippingAddress($shippingAddress); + + $billingAddress = new \Iyzipay\Model\Address(); + $billingAddress->setAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $billingAddress->setZipCode('34742'); + $billingAddress->setContactName('Jane Doe'); + $billingAddress->setCity('Istanbul'); + $billingAddress->setCountry('Turkey'); + $request->setBillingAddress($billingAddress); + + $firstBasketItem = new Iyzipay\Model\BasketItem(); + $firstBasketItem->setId('BI101'); + $firstBasketItem->setPrice(0.3); + $firstBasketItem->setName('Binocular'); + $firstBasketItem->setCategory1('Collectibles'); + $firstBasketItem->setCategory2('Accessories'); + $firstBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); + + $secondBasketItem = new Iyzipay\Model\BasketItem(); + $secondBasketItem->setId('BI101'); + $secondBasketItem->setPrice(0.5); + $secondBasketItem->setName('Binocular'); + $secondBasketItem->setCategory1('Collectibles'); + $secondBasketItem->setCategory2('Accessories'); + $secondBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); + + $thirdBasketItem = new Iyzipay\Model\BasketItem(); + $thirdBasketItem->setId('BI101'); + $thirdBasketItem->setPrice(0.2); + $thirdBasketItem->setName('Binocular'); + $thirdBasketItem->setCategory1('Collectibles'); + $thirdBasketItem->setCategory2('Accessories'); + $thirdBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); + $request->setBasketItems([$firstBasketItem, $secondBasketItem, $thirdBasketItem]); + + $plusInstallmentPayment = \Iyzipay\Model\PlusInstallmentPayment::create($request, Config::options()); + print_r($plusInstallmentPayment); +} + +createPlusInstallmentPayment(); diff --git a/samples/create_threeds_payment.php b/samples/create_threeds_payment.php index 3518378a..cc0d27c0 100644 --- a/samples/create_threeds_payment.php +++ b/samples/create_threeds_payment.php @@ -1,6 +1,7 @@ getPaymentId(); +$currency = $threedsPayment->getCurrency(); +$basketId = $threedsPayment->getBasketId(); +$conversationId = $threedsPayment->getConversationId(); +$paidPrice = $threedsPayment->getPaidPrice(); +$price = $threedsPayment->getPrice(); +$signature = $threedsPayment->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/samples/initialize_apm.php b/samples/initialize_apm.php index ebd23227..aebafd62 100644 --- a/samples/initialize_apm.php +++ b/samples/initialize_apm.php @@ -1,6 +1,7 @@ getPaymentId(); +$redirectUrl = $apmInitialize->getRedirectUrl(); +$signature = $apmInitialize->getSignature(); + +$calculatedSignature = calculateHmacSHA256Signature(array($paymentId, $redirectUrl)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/initialize_bkm.php b/samples/initialize_bkm.php index a2d4a365..240df3df 100644 --- a/samples/initialize_bkm.php +++ b/samples/initialize_bkm.php @@ -1,6 +1,7 @@ getSignature(); +$token = $bkmInitialize->getToken(); +$conversationId = $bkmInitialize->getConversationId(); + +$calculatedSignature = calculateHmacSHA256Signature(array($token, $conversationId)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/initialize_checkout_form.php b/samples/initialize_checkout_form.php index 6642f673..ab152ab4 100644 --- a/samples/initialize_checkout_form.php +++ b/samples/initialize_checkout_form.php @@ -1,6 +1,7 @@ getSignature(); +$token = $checkoutFormInitialize->getToken(); +$conversationId = $checkoutFormInitialize->getConversationId(); + +$calculatedSignature = calculateHmacSHA256Signature(array($conversationId, $token)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; diff --git a/samples/initialize_checkoutform_preauth.php b/samples/initialize_checkoutform_preauth.php new file mode 100644 index 00000000..e2f71e08 --- /dev/null +++ b/samples/initialize_checkoutform_preauth.php @@ -0,0 +1,99 @@ +setLocale(\Iyzipay\Model\Locale::TR); +$request->setConversationId("123456789"); +$request->setPrice("1"); +$request->setPaidPrice("1.2"); +$request->setCurrency(\Iyzipay\Model\Currency::TL); +$request->setBasketId("B67832"); +$request->setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT); +$request->setCallbackUrl("https://www.merchant.com/callback"); + +$paymentCard = new \Iyzipay\Model\PaymentCard(); +$paymentCard->setCardHolderName("John Doe"); +$paymentCard->setCardNumber("5528790000000008"); +$paymentCard->setExpireMonth("12"); +$paymentCard->setExpireYear("2030"); +$paymentCard->setCvc("123"); +$paymentCard->setRegisterCard(0); + +$buyer = new \Iyzipay\Model\Buyer(); +$buyer->setId("BY789"); +$buyer->setName("John"); +$buyer->setSurname("Doe"); +$buyer->setGsmNumber("+905350000000"); +$buyer->setEmail("email@email.com"); +$buyer->setIdentityNumber("74300864791"); +$buyer->setLastLoginDate("2015-10-05 12:43:35"); +$buyer->setRegistrationDate("2013-04-21 15:12:09"); +$buyer->setRegistrationAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$buyer->setIp("85.34.78.112"); +$buyer->setCity("Istanbul"); +$buyer->setCountry("Turkey"); +$buyer->setZipCode("34732"); +$request->setBuyer($buyer); + +$shippingAddress = new \Iyzipay\Model\Address(); +$shippingAddress->setContactName("Jane Doe"); +$shippingAddress->setCity("Istanbul"); +$shippingAddress->setCountry("Turkey"); +$shippingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$shippingAddress->setZipCode("34742"); +$request->setShippingAddress($shippingAddress); + +$billingAddress = new \Iyzipay\Model\Address(); +$billingAddress->setContactName("Jane Doe"); +$billingAddress->setCity("Istanbul"); +$billingAddress->setCountry("Turkey"); +$billingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$billingAddress->setZipCode("34742"); +$request->setBillingAddress($billingAddress); + +$basketItems = array(); +$firstBasketItem = new \Iyzipay\Model\BasketItem(); +$firstBasketItem->setId("BI101"); +$firstBasketItem->setName("Binocular"); +$firstBasketItem->setCategory1("Collectibles"); +$firstBasketItem->setCategory2("Accessories"); +$firstBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); +$firstBasketItem->setPrice("0.3"); +$basketItems[0] = $firstBasketItem; + +$secondBasketItem = new \Iyzipay\Model\BasketItem(); +$secondBasketItem->setId("BI102"); +$secondBasketItem->setName("Game code"); +$secondBasketItem->setCategory1("Game"); +$secondBasketItem->setCategory2("Online Game Items"); +$secondBasketItem->setItemType(\Iyzipay\Model\BasketItemType::VIRTUAL); +$secondBasketItem->setPrice("0.5"); +$basketItems[1] = $secondBasketItem; + +$thirdBasketItem = new \Iyzipay\Model\BasketItem(); +$thirdBasketItem->setId("BI103"); +$thirdBasketItem->setName("Usb"); +$thirdBasketItem->setCategory1("Electronics"); +$thirdBasketItem->setCategory2("Usb / Cable"); +$thirdBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); +$thirdBasketItem->setPrice("0.2"); +$basketItems[2] = $thirdBasketItem; +$request->setBasketItems($basketItems); + +# make request +$threedsInitialize = \Iyzipay\Model\CheckoutFormInitializePreAuth::create($request, Config::options()); + +# print result +print_r($threedsInitialize); + +#verify signature +$token = $threedsInitialize->getToken(); +$conversationId = $threedsInitialize->getConversationId(); +$signature = $threedsInitialize->getSignature(); + +$calculatedSignature = calculateHmacSHA256Signature(array($conversationId, $token)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/initialize_pay_with_iyzico.php b/samples/initialize_pay_with_iyzico.php index d74cf3b8..21027da1 100755 --- a/samples/initialize_pay_with_iyzico.php +++ b/samples/initialize_pay_with_iyzico.php @@ -1,6 +1,7 @@ '; -print_r($payWithIyzicoInitialize); \ No newline at end of file +print_r($payWithIyzicoInitialize); + +#verify signature +$conversationId = $payWithIyzicoInitialize->getConversationId(); +$token = $payWithIyzicoInitialize->getToken(); +$signature = $payWithIyzicoInitialize->getSignature(); +$calculatedSignature = calculateHmacSHA256Signature(array($conversationId, $token)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/initialize_threeds.php b/samples/initialize_threeds.php index bd0ec2e1..d0ef88cb 100644 --- a/samples/initialize_threeds.php +++ b/samples/initialize_threeds.php @@ -1,6 +1,7 @@ getPaymentId(); +$conversationId = $threedsInitialize->getConversationId(); +$signature = $threedsInitialize->getSignature(); + +$calculatedSignature = calculateHmacSHA256Signature(array($paymentId, $conversationId)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/initialize_threeds_preauth.php b/samples/initialize_threeds_preauth.php new file mode 100644 index 00000000..018ac885 --- /dev/null +++ b/samples/initialize_threeds_preauth.php @@ -0,0 +1,102 @@ +setLocale(\Iyzipay\Model\Locale::TR); +$request->setConversationId("123456789"); +$request->setPrice("1"); +$request->setPaidPrice("1.2"); +$request->setCurrency(\Iyzipay\Model\Currency::TL); +$request->setInstallment(1); +$request->setBasketId("B67832"); +$request->setPaymentChannel(\Iyzipay\Model\PaymentChannel::WEB); +$request->setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT); +$request->setCallbackUrl("https://www.merchant.com/callback"); + +$paymentCard = new \Iyzipay\Model\PaymentCard(); +$paymentCard->setCardHolderName("John Doe"); +$paymentCard->setCardNumber("5528790000000008"); +$paymentCard->setExpireMonth("12"); +$paymentCard->setExpireYear("2030"); +$paymentCard->setCvc("123"); +$paymentCard->setRegisterCard(0); +$request->setPaymentCard($paymentCard); + +$buyer = new \Iyzipay\Model\Buyer(); +$buyer->setId("BY789"); +$buyer->setName("John"); +$buyer->setSurname("Doe"); +$buyer->setGsmNumber("+905350000000"); +$buyer->setEmail("email@email.com"); +$buyer->setIdentityNumber("74300864791"); +$buyer->setLastLoginDate("2015-10-05 12:43:35"); +$buyer->setRegistrationDate("2013-04-21 15:12:09"); +$buyer->setRegistrationAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$buyer->setIp("85.34.78.112"); +$buyer->setCity("Istanbul"); +$buyer->setCountry("Turkey"); +$buyer->setZipCode("34732"); +$request->setBuyer($buyer); + +$shippingAddress = new \Iyzipay\Model\Address(); +$shippingAddress->setContactName("Jane Doe"); +$shippingAddress->setCity("Istanbul"); +$shippingAddress->setCountry("Turkey"); +$shippingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$shippingAddress->setZipCode("34742"); +$request->setShippingAddress($shippingAddress); + +$billingAddress = new \Iyzipay\Model\Address(); +$billingAddress->setContactName("Jane Doe"); +$billingAddress->setCity("Istanbul"); +$billingAddress->setCountry("Turkey"); +$billingAddress->setAddress("Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"); +$billingAddress->setZipCode("34742"); +$request->setBillingAddress($billingAddress); + +$basketItems = array(); +$firstBasketItem = new \Iyzipay\Model\BasketItem(); +$firstBasketItem->setId("BI101"); +$firstBasketItem->setName("Binocular"); +$firstBasketItem->setCategory1("Collectibles"); +$firstBasketItem->setCategory2("Accessories"); +$firstBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); +$firstBasketItem->setPrice("0.3"); +$basketItems[0] = $firstBasketItem; + +$secondBasketItem = new \Iyzipay\Model\BasketItem(); +$secondBasketItem->setId("BI102"); +$secondBasketItem->setName("Game code"); +$secondBasketItem->setCategory1("Game"); +$secondBasketItem->setCategory2("Online Game Items"); +$secondBasketItem->setItemType(\Iyzipay\Model\BasketItemType::VIRTUAL); +$secondBasketItem->setPrice("0.5"); +$basketItems[1] = $secondBasketItem; + +$thirdBasketItem = new \Iyzipay\Model\BasketItem(); +$thirdBasketItem->setId("BI103"); +$thirdBasketItem->setName("Usb"); +$thirdBasketItem->setCategory1("Electronics"); +$thirdBasketItem->setCategory2("Usb / Cable"); +$thirdBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); +$thirdBasketItem->setPrice("0.2"); +$basketItems[2] = $thirdBasketItem; +$request->setBasketItems($basketItems); + +# make request +$threedsInitialize = \Iyzipay\Model\ThreedsInitializePreAuth::create($request, Config::options()); + +# print result +print_r($threedsInitialize); + +#verify signature +$paymentId = $threedsInitialize->getPaymentId(); +$conversationId = $threedsInitialize->getConversationId(); +$signature = $threedsInitialize->getSignature(); + +$calculatedSignature = calculateHmacSHA256Signature(array($paymentId, $conversationId)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/iyzilink_add_product_sample.php b/samples/iyzilink_add_product_sample.php index 27d517ef..e009e198 100644 --- a/samples/iyzilink_add_product_sample.php +++ b/samples/iyzilink_add_product_sample.php @@ -14,6 +14,9 @@ $request->setAddressIgnorable(false); $request->setSoldLimit(1); $request->setInstallmentRequest(false); +$request->setSourceType('API'); +$request->setStockEnabled(true); +$request->setStockCount(1); $response = \Iyzipay\Model\Iyzilink\IyziLinkSaveProduct::create($request, Config::options()); print_r($response); diff --git a/samples/iyzilink_create_fastlink_sample.php b/samples/iyzilink_create_fastlink_sample.php new file mode 100644 index 00000000..d6c788e2 --- /dev/null +++ b/samples/iyzilink_create_fastlink_sample.php @@ -0,0 +1,18 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId("123456789"); + $request->setDescription("ft-description-fast-link"); + $request->setPrice(99.73); + $request->setCurrencyCode("TRY"); + $request->setSourceType("WEB"); + + $iyzilinkFastLink = \Iyzipay\Model\Iyzilink\IyziLinkFastLink::create($request, Config::options()); + print_r($iyzilinkFastLink); +} + +iyzilinkCreateFastLink(); diff --git a/samples/iyzilink_search_merchant_products_example.php b/samples/iyzilink_search_merchant_products_example.php new file mode 100644 index 00000000..ee1c7e25 --- /dev/null +++ b/samples/iyzilink_search_merchant_products_example.php @@ -0,0 +1,16 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setPage(1); + $request->setCount(10); + $request->setConversationId('123456'); + + $iyziLinkSearchMerchantProducts= \Iyzipay\Model\Iyzilink\IyziLinkSearchMerchantProducts::create($request,Config::options()); + print_r($iyziLinkSearchMerchantProducts); +} + +iyzilinkSearchMerchantProducts(); diff --git a/samples/iyzilink_update_product_status.php b/samples/iyzilink_update_product_status.php new file mode 100644 index 00000000..87a058b3 --- /dev/null +++ b/samples/iyzilink_update_product_status.php @@ -0,0 +1,15 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setProductStatus(\Iyzipay\Model\Status::PASSIVE); + $request->setToken('AAM'); + + $iyzilinkUpdateProductStatus = \Iyzipay\Model\Iyzilink\IyziLinkUpdateProductStatus::create($request, Config::options()); + print_r($iyzilinkUpdateProductStatus); +} + +iyzilinkUpdateProductStatus(); diff --git a/samples/reporting_payment_detail.php b/samples/reporting_payment_detail.php index cd206fef..0d60cddd 100644 --- a/samples/reporting_payment_detail.php +++ b/samples/reporting_payment_detail.php @@ -4,7 +4,10 @@ $request = new \Iyzipay\Request\ReportingPaymentDetailRequest(); $request->setPaymentConversationId("123456789"); +$request->setPaymentId("paymentId"); +// Both paymentConversationId and paymentId are not mandatory. +// One of them is enough for the request. $result = \Iyzipay\Model\ReportingPaymentDetail::create($request, Config::options()); diff --git a/samples/reporting_scroll_transaction.php b/samples/reporting_scroll_transaction.php new file mode 100644 index 00000000..749e25f3 --- /dev/null +++ b/samples/reporting_scroll_transaction.php @@ -0,0 +1,16 @@ +setConversationId('1234567890'); + $request->setTransactionDate('2023-08-17'); + $request->setDocumentScrollVoSortingOrder('ASC'); + $request->setLastId('1689853839161'); + + $result = \Iyzipay\Model\ReportingScrollTransaction::create($request, Config::options()); + print_r($result); +} + +reportingScrollTransaction(); diff --git a/samples/retrieve_apm.php b/samples/retrieve_apm.php index 158456ee..2b2add38 100644 --- a/samples/retrieve_apm.php +++ b/samples/retrieve_apm.php @@ -1,6 +1,7 @@ getCurrency(); +$basketId = $apmRetrieve->getBasketId(); +$conversationId = $apmRetrieve->getConversationId(); +$paidPrice = $apmRetrieve->getPaidPrice(); +$price = $apmRetrieve->getPrice(); +$paymentId = $apmRetrieve->getPaymentId(); +$redirectUrl = $apmRetrieve->getRedirectUrl(); +$signature = $apmRetrieve->getSignature(); + +$calculatedSignature = calculateHmacSHA256Signature(array($currency, $basketId, $conversationId, $paidPrice, $price, $paymentId, $redirectUrl)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/retrieve_bkm_result.php b/samples/retrieve_bkm_result.php index f33356c5..d245e260 100644 --- a/samples/retrieve_bkm_result.php +++ b/samples/retrieve_bkm_result.php @@ -1,15 +1,31 @@ setLocale(\Iyzipay\Model\Locale::TR); $request->setConversationId("123456789"); -$request->setToken("token"); +$request->setToken("mockToken_1720101397775"); # make request $bkm = \Iyzipay\Model\Bkm::retrieve($request, Config::options()); # print result -print_r($bkm); \ No newline at end of file +print_r($bkm); + +#verify signature +$paymentId = $bkm->getPaymentId(); +$paymentStatus = $bkm->getPaymentStatus(); +$basketId = $bkm->getBasketId(); +$conversationId = $bkm->getConversationId(); +$currency = $bkm->getCurrency(); +$paidPrice = $bkm->getPaidPrice(); +$price = $bkm->getPrice(); +$token = $bkm->getToken(); +$signature = $bkm->getSignature(); + +$calculatedSignature = calculateHmacSHA256Signature(array($paymentId,$paymentStatus, $basketId, $conversationId, $currency, $paidPrice, $price, $token)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/retrieve_blacklisted_card.php b/samples/retrieve_blacklisted_card.php new file mode 100644 index 00000000..1d0f9f02 --- /dev/null +++ b/samples/retrieve_blacklisted_card.php @@ -0,0 +1,15 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId("123456789"); + $request->setCardNumber('5528790000000008'); + + $blacklistedCard = \Iyzipay\Model\BlacklistedCard::retrieve($request, Config::options()); + print_r($blacklistedCard); +} + +retrieveBlacklistedCard(); diff --git a/samples/retrieve_checkout_form_result.php b/samples/retrieve_checkout_form_result.php index a6e68ade..05ad21e9 100644 --- a/samples/retrieve_checkout_form_result.php +++ b/samples/retrieve_checkout_form_result.php @@ -1,6 +1,7 @@ getPaymentStatus(); +$paymentId = $checkoutForm->getPaymentId(); +$currency = $checkoutForm->getCurrency(); +$basketId = $checkoutForm->getBasketId(); +$conversationId = $checkoutForm->getConversationId(); +$paidPrice = $checkoutForm->getPaidPrice(); +$price = $checkoutForm->getPrice(); +$token = $checkoutForm->getToken(); +$signature = $checkoutForm->getSignature(); + +$calculatedSignature = calculateHmacSHA256Signature(array($paymentStatus, $paymentId, $currency, $basketId, $conversationId, $paidPrice, $price, $token)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/retrieve_pay_with_iyzico_result.php b/samples/retrieve_pay_with_iyzico_result.php index e56384fb..fa585b14 100755 --- a/samples/retrieve_pay_with_iyzico_result.php +++ b/samples/retrieve_pay_with_iyzico_result.php @@ -1,6 +1,7 @@ getPaymentStatus(); +$paymentId = $payWithIyzico->getPaymentId(); +$currency = $payWithIyzico->getCurrency(); +$basketId = $payWithIyzico->getBasketId(); +$conversationId = $payWithIyzico->getConversationId(); +$paidPrice = $payWithIyzico->getPaidPrice(); +$price = $payWithIyzico->getPrice(); +$signature = $payWithIyzico->getSignature(); +$token = $payWithIyzico->getToken(); + +$calculatedSignature = calculateHmacSHA256Signature(array($paymentStatus, $paymentId, $currency, $basketId, $conversationId, $paidPrice, $price, $token)); +$verified = $signature == $calculatedSignature; +echo "Signature verified: $verified"; \ No newline at end of file diff --git a/samples/retrieve_payment_preauth.php b/samples/retrieve_payment_preauth.php new file mode 100644 index 00000000..1044d109 --- /dev/null +++ b/samples/retrieve_payment_preauth.php @@ -0,0 +1,29 @@ +setLocale(\Iyzipay\Model\Locale::TR); +$request->setConversationId("123456789"); +$request->setPaymentId("123456789"); +$request->setPaymentConversationId("123456789"); + +# make request +$payment = \Iyzipay\Model\PaymentPreAuth::retrieve($request, Config::options()); + +# print response +print_r($payment); + +#verify signature +$paymentId = $payment->getPaymentId(); +$currency = $payment->getCurrency(); +$basketId = $payment->getBasketId(); +$conversationId = $payment->getConversationId(); +$paidPrice = $payment->getPaidPrice(); +$price = $payment->getPrice(); +$signature = $payment->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/samples/retrieve_payment_result.php b/samples/retrieve_payment_result.php index c669e8c3..8e407f0a 100644 --- a/samples/retrieve_payment_result.php +++ b/samples/retrieve_payment_result.php @@ -1,16 +1,30 @@ setLocale(\Iyzipay\Model\Locale::TR); $request->setConversationId("123456789"); $request->setPaymentId("1"); -$request->setPaymentConversationId("123456789"); +$request->setPaymentConversationId("123456789");; # make request $payment = \Iyzipay\Model\Payment::retrieve($request, Config::options()); # print result -print_r($payment); \ No newline at end of file +print_r($payment); + +#verify signature +$paymentId = $payment->getPaymentId(); +$currency = $payment->getCurrency(); +$basketId = $payment->getBasketId(); +$conversationId = $payment->getConversationId(); +$paidPrice = $payment->getPaidPrice(); +$price = $payment->getPrice(); +$signature = $payment->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/samples/signature_verification.php b/samples/signature_verification.php new file mode 100644 index 00000000..9b1a10dd --- /dev/null +++ b/samples/signature_verification.php @@ -0,0 +1,9 @@ +getSecretKey(); + $dataToSign = implode(':', $params); + $mac = hash_hmac('sha256', $dataToSign, $secretKey, true); + return bin2hex($mac); +} diff --git a/samples/subscription-samples/delete_customer.php b/samples/subscription-samples/delete_customer.php new file mode 100644 index 00000000..71cd8747 --- /dev/null +++ b/samples/subscription-samples/delete_customer.php @@ -0,0 +1,12 @@ +setCustomerReferenceCode('566b2e1a-5046-4438-9b62-c8cf761f61d1'); + $result = \Iyzipay\Model\Subscription\SubscriptionDeleteCustomer::delete($request, Config::options()); + print_r($result); +} + +deleteSubscriptionCustomer(); diff --git a/samples/subscription-samples/subscription_list.php b/samples/subscription-samples/subscription_list.php new file mode 100644 index 00000000..e06dbe5c --- /dev/null +++ b/samples/subscription-samples/subscription_list.php @@ -0,0 +1,22 @@ +setPage(1); + $request->setCount(10); + $request->setSubscriptionStatus(\Iyzipay\Model\Status::ACTIVE); + $request->setSubscriptionReferenceCode('c8ab43da-f4b3-40d2-b1ef-620da93ec3e9'); + $request->setCustomerReferenceCode('566b2e1a-5046-4438-9b62-c8cf761f61d1'); + $request->setPricingPlanReferenceCode('c1d489b6-9adc-42fa-88ae-47ea2e5dbe1e'); + $request->setParentReferenceCode('f219267d-ce05-4039-a773-225ea44aacd1'); + $request->setStartDate('2024-01-01 23:56:00'); + $request->setEndDate('2024-02-02 23:56:00'); + + $result = \Iyzipay\Model\Subscription\SubscriptionList::create($request, Config::options()); + print_r($result); +} + +subscriptionList(); diff --git a/samples/ucs_init.php b/samples/ucs_init.php index 077df386..911431c9 100644 --- a/samples/ucs_init.php +++ b/samples/ucs_init.php @@ -8,7 +8,7 @@ $request->setGsmNumber("+905555555555"); # make request -$result = \Iyzipay\Model\UCSInitialize::create($request,Config::options()); +$result = \Iyzipay\Model\UCSInitialize::create($request, Config::options()); # print result -print_r($payment); \ No newline at end of file +print_r($result); \ No newline at end of file diff --git a/samples/update_blacklisted_card.php b/samples/update_blacklisted_card.php new file mode 100644 index 00000000..82153f2d --- /dev/null +++ b/samples/update_blacklisted_card.php @@ -0,0 +1,16 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId("123456789"); + $request->setCardToken('G7Zzo5Y24cxwaIwC4h+jUJXtqTA='); + $request->setCardUserKey('ew9hzoujBUJgOUer8st0ler0dOQ='); + + $blacklistedCard = \Iyzipay\Model\BlacklistedCard::update($request,Config::options()); + print_r($blacklistedCard); +} + +updateBlacklistedCard(); diff --git a/samples/verify_c2c_sub_merchant.php b/samples/verify_c2c_sub_merchant.php new file mode 100644 index 00000000..ff35c5fe --- /dev/null +++ b/samples/verify_c2c_sub_merchant.php @@ -0,0 +1,24 @@ +setSalt('Merchant onboarding salt'); + $credentials->setSecretKey('Merchant onboarding secret key'); + + $encryptedVerificationCode = \Iyzipay\Model\C2CSubMerchantSmsVerificationCodeEncrypter::encrypt($credentials, '123456'); + + $request = new \Iyzipay\Request\VerifyC2CSubMerchantRequest(); + $request->setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId('422117402'); + $request->setTxId('txId obtained from create subMerchant'); + +// Encrypted code won't work in Sandbox + $request->setSmsVerificationCode($encryptedVerificationCode); + + $c2cSubMerchant = \Iyzipay\Model\C2CSubMerchant::verify($request, Config::options()); + print_r($c2cSubMerchant); +} + +verifyC2CSubMerchant(); diff --git a/samples/webhook_Signature_Validation.php b/samples/webhook_Signature_Validation.php new file mode 100644 index 00000000..7ab1e8aa --- /dev/null +++ b/samples/webhook_Signature_Validation.php @@ -0,0 +1,98 @@ + \ No newline at end of file diff --git a/src/Iyzipay/DefaultHttpClient.php b/src/Iyzipay/DefaultHttpClient.php index cab25812..08d159b2 100644 --- a/src/Iyzipay/DefaultHttpClient.php +++ b/src/Iyzipay/DefaultHttpClient.php @@ -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( diff --git a/src/Iyzipay/HashGenerator.php b/src/Iyzipay/HashGenerator.php index b0d797a4..8314c097 100644 --- a/src/Iyzipay/HashGenerator.php +++ b/src/Iyzipay/HashGenerator.php @@ -4,9 +4,10 @@ class HashGenerator { - public static function generateHash($apiKey, $secretKey, $randomString, Request $request) + public static function generateHash($apiKey, $secretKey, $randomString, $request) { - $hashStr = $apiKey . $randomString . $secretKey . $request->toPKIRequestString(); + $pKIRequestString = $request ? $request->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 a5372680..b8b1cbc2 100644 --- a/src/Iyzipay/IyziAuthV2Generator.php +++ b/src/Iyzipay/IyziAuthV2Generator.php @@ -25,18 +25,21 @@ public static function getHmacSHA256Signature($uri, $secretKey, $randomString, R public static function getPayload($uri, Request $request = null) { - + $uriPath = $uri; $startNumber = strpos($uri, '/v2'); $endNumber = strpos($uri, '?'); - if(strpos($uri,"subscription") || strpos($uri,"ucs")){ - $endNumber = strlen($uri); - if(strpos($uri,'?')){ - $endNumber = strpos($uri, '?'); + + + if ($startNumber) { + if (strpos($uri, "subscription") || strpos($uri, "ucs")) { + $endNumber = strlen($uri); + if (strpos($uri, '?')) { + $endNumber = strpos($uri, '?'); + } } + $endNumber -= $startNumber; + $uriPath = substr($uri, $startNumber, $endNumber); } - $endNumber-= $startNumber; - - $uriPath = substr($uri, $startNumber, $endNumber); if (!empty($request) && $request->toJsonString() != '[]') $uriPath = $uriPath.$request->toJsonString(); diff --git a/src/Iyzipay/IyzipayResource.php b/src/Iyzipay/IyzipayResource.php index cfb27d17..0b2bcc3a 100644 --- a/src/Iyzipay/IyzipayResource.php +++ b/src/Iyzipay/IyzipayResource.php @@ -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", @@ -36,12 +36,29 @@ protected static function getHttpHeadersV2($uri, Request $request = null, Option $rnd = uniqid(); array_push($header, "Authorization: " . self::prepareAuthorizationStringV2($uri, $request, $options, $rnd)); - array_push($header, "x-iyzi-client-version: " . "iyzipay-php-2.0.43"); + $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.55"); + + 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.55"); return $header; } - protected static function prepareAuthorizationString(Request $request, Options $options, $rnd) + 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)); @@ -51,7 +68,7 @@ protected static function prepareAuthorizationStringV2($uri, Request $request = { $hash = IyziAuthV2Generator::generateAuthContent($uri, $options->getApiKey(), $options->getSecretKey(), $rnd, $request); - return 'IYZWSv2'.' '.$hash; + return 'IYZWSv2' . ' ' . $hash; } public function getStatus() @@ -123,4 +140,4 @@ public function setConversationId($conversationId) { $this->conversationId = $conversationId; } -} \ No newline at end of file +} diff --git a/src/Iyzipay/Model/AmountBaseRefund.php b/src/Iyzipay/Model/AmountBaseRefund.php new file mode 100644 index 00000000..f336efc6 --- /dev/null +++ b/src/Iyzipay/Model/AmountBaseRefund.php @@ -0,0 +1,52 @@ +post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options, true), $request->toJsonString()); + return AmountBaseRefundMapper::create($rawResult)->jsonDecode()->mapAmountBaseRefund(new AmountBaseRefund()); + } + + public function getPaymentId(): string + { + return $this->paymentId; + } + + public function setPaymentId(string $paymentId): void + { + $this->paymentId = $paymentId; + } + + public function getPrice(): float + { + return $this->price; + } + + public function setPrice(float $price): void + { + $this->price = $price; + } + + public function getIp(): string + { + return $this->ip; + } + + public function setIp(string $ip): void + { + $this->ip = $ip; + } +} diff --git a/src/Iyzipay/Model/Apm.php b/src/Iyzipay/Model/Apm.php index bd763ef8..93bd042a 100644 --- a/src/Iyzipay/Model/Apm.php +++ b/src/Iyzipay/Model/Apm.php @@ -11,13 +11,15 @@ class Apm extends ApmResource { public static function create(CreateApmInitializeRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/apm/initialize", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/apm/initialize"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return ApmMapper::create($rawResult)->jsonDecode()->mapApm(new Apm()); } public static function retrieve(RetrieveApmRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/apm/retrieve", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/apm/retrieve"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return ApmMapper::create($rawResult)->jsonDecode()->mapApm(new Apm()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/ApmResource.php b/src/Iyzipay/Model/ApmResource.php index 85333c09..a97e2c84 100644 --- a/src/Iyzipay/Model/ApmResource.php +++ b/src/Iyzipay/Model/ApmResource.php @@ -29,6 +29,7 @@ class ApmResource extends IyzipayResource private $apm; private $mobilePhone; private $paymentStatus; + private $signature; public function getRedirectUrl() { @@ -259,4 +260,14 @@ public function setPaymentStatus($paymentStatus) { $this->paymentStatus = $paymentStatus; } + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + $this->signature = $signature; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/Approval.php b/src/Iyzipay/Model/Approval.php index 81b9d44a..a88c14ae 100644 --- a/src/Iyzipay/Model/Approval.php +++ b/src/Iyzipay/Model/Approval.php @@ -13,7 +13,8 @@ class Approval extends IyzipayResource public static function create(CreateApprovalRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/item/approve", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/iyzipos/item/approve"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return ApprovalMapper::create($rawResult)->jsonDecode()->mapApproval(new Approval()); } diff --git a/src/Iyzipay/Model/BasicBkm.php b/src/Iyzipay/Model/BasicBkm.php index 08f40c69..d2c6b1ca 100644 --- a/src/Iyzipay/Model/BasicBkm.php +++ b/src/Iyzipay/Model/BasicBkm.php @@ -14,7 +14,8 @@ class BasicBkm extends BasicPaymentResource public static function retrieve(RetrieveBkmRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/bkm/auth/detail/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/bkm/auth/detail/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicBkmMapper::create($rawResult)->jsonDecode()->mapBasicBkm(new BasicBkm()); } diff --git a/src/Iyzipay/Model/BasicBkmInitialize.php b/src/Iyzipay/Model/BasicBkmInitialize.php index e660a757..363119a9 100644 --- a/src/Iyzipay/Model/BasicBkmInitialize.php +++ b/src/Iyzipay/Model/BasicBkmInitialize.php @@ -14,7 +14,8 @@ class BasicBkmInitialize extends IyzipayResource public static function create(CreateBasicBkmInitializeRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/bkm/initialize/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/bkm/initialize/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicBkmInitializeMapper::create($rawResult)->jsonDecode()->mapBasicBkmInitialize(new BasicBkmInitialize()); } diff --git a/src/Iyzipay/Model/BasicPayment.php b/src/Iyzipay/Model/BasicPayment.php index 622cbbde..59c40a28 100644 --- a/src/Iyzipay/Model/BasicPayment.php +++ b/src/Iyzipay/Model/BasicPayment.php @@ -10,7 +10,8 @@ class BasicPayment extends BasicPaymentResource { public static function create(CreateBasicPaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/auth/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/auth/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicPaymentMapper::create($rawResult)->jsonDecode()->mapBasicPayment(new BasicPayment()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/BasicPaymentPostAuth.php b/src/Iyzipay/Model/BasicPaymentPostAuth.php index 52813792..f5fe00d1 100644 --- a/src/Iyzipay/Model/BasicPaymentPostAuth.php +++ b/src/Iyzipay/Model/BasicPaymentPostAuth.php @@ -10,7 +10,8 @@ class BasicPaymentPostAuth extends BasicPaymentResource { public static function create(CreatePaymentPostAuthRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/postauth/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/postauth/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicPaymentPostAuthMapper::create($rawResult)->jsonDecode()->mapBasicPaymentPostAuth(new BasicPaymentPostAuth()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/BasicPaymentPreAuth.php b/src/Iyzipay/Model/BasicPaymentPreAuth.php index a5bb7872..cd7d62d4 100644 --- a/src/Iyzipay/Model/BasicPaymentPreAuth.php +++ b/src/Iyzipay/Model/BasicPaymentPreAuth.php @@ -10,7 +10,8 @@ class BasicPaymentPreAuth extends BasicPaymentResource { public static function create(CreateBasicPaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/preauth/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/preauth/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicPaymentPreAuthMapper::create($rawResult)->jsonDecode()->mapBasicPaymentPreAuth(new BasicPaymentPreAuth()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/BasicThreedsInitialize.php b/src/Iyzipay/Model/BasicThreedsInitialize.php index 4e84230c..7e4747ab 100644 --- a/src/Iyzipay/Model/BasicThreedsInitialize.php +++ b/src/Iyzipay/Model/BasicThreedsInitialize.php @@ -13,7 +13,8 @@ class BasicThreedsInitialize extends IyzipayResource public static function create(CreateBasicPaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/3dsecure/initialize/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/3dsecure/initialize/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicThreedsInitializeMapper::create($rawResult)->jsonDecode()->mapBasicThreedsInitialize(new BasicThreedsInitialize()); } diff --git a/src/Iyzipay/Model/BasicThreedsInitializePreAuth.php b/src/Iyzipay/Model/BasicThreedsInitializePreAuth.php index 84b4e39c..117eab1f 100644 --- a/src/Iyzipay/Model/BasicThreedsInitializePreAuth.php +++ b/src/Iyzipay/Model/BasicThreedsInitializePreAuth.php @@ -13,7 +13,8 @@ class BasicThreedsInitializePreAuth extends IyzipayResource public static function create(CreateBasicPaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/3dsecure/initialize/preauth/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/3dsecure/initialize/preauth/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicThreedsInitializePreAuthMapper::create($rawResult)->jsonDecode()->mapBasicThreedsInitializePreAuth(new BasicThreedsInitializePreAuth()); } diff --git a/src/Iyzipay/Model/BasicThreedsPayment.php b/src/Iyzipay/Model/BasicThreedsPayment.php index de71bb85..c8df974a 100644 --- a/src/Iyzipay/Model/BasicThreedsPayment.php +++ b/src/Iyzipay/Model/BasicThreedsPayment.php @@ -10,7 +10,8 @@ class BasicThreedsPayment extends BasicPaymentResource { public static function create(CreateThreedsPaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/3dsecure/auth/basic", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/3dsecure/auth/basic"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BasicThreedsPaymentMapper::create($rawResult)->jsonDecode()->mapBasicThreedsPayment(new BasicThreedsPayment()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/BinNumber.php b/src/Iyzipay/Model/BinNumber.php index a770ccee..a7b754a8 100644 --- a/src/Iyzipay/Model/BinNumber.php +++ b/src/Iyzipay/Model/BinNumber.php @@ -19,7 +19,8 @@ class BinNumber extends IyzipayResource public static function retrieve(RetrieveBinNumberRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/bin/check", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/bin/check"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BinNumberMapper::create($rawResult)->jsonDecode()->mapBinNumber(new BinNumber()); } diff --git a/src/Iyzipay/Model/Bkm.php b/src/Iyzipay/Model/Bkm.php index 87908a2b..ad0b83eb 100644 --- a/src/Iyzipay/Model/Bkm.php +++ b/src/Iyzipay/Model/Bkm.php @@ -10,10 +10,12 @@ class Bkm extends PaymentResource { private $token; private $callbackUrl; + private $signature; public static function retrieve(RetrieveBkmRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/bkm/auth/detail", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/bkm/auth/detail"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return BkmMapper::create($rawResult)->jsonDecode()->mapBkm(new Bkm()); } @@ -36,4 +38,12 @@ public function setCallbackUrl($callbackUrl) { $this->callbackUrl = $callbackUrl; } + + public function getSignature() { + return $this->signature; + } + + public function setSignature($signature) { + $this->signature = $signature; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/BkmInitialize.php b/src/Iyzipay/Model/BkmInitialize.php index 4ec83d12..ac75915d 100644 --- a/src/Iyzipay/Model/BkmInitialize.php +++ b/src/Iyzipay/Model/BkmInitialize.php @@ -11,10 +11,12 @@ class BkmInitialize extends IyzipayResource { private $htmlContent; private $token; + private $signature; public static function create(CreateBkmInitializeRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/bkm/initialize", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/bkm/initialize"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return BkmInitializeMapper::create($rawResult)->jsonDecode()->mapBkmInitialize(new BkmInitialize()); } @@ -37,4 +39,14 @@ public function setToken($token) { $this->token = $token; } + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + $this->signature = $signature; + } } diff --git a/src/Iyzipay/Model/BlacklistedCard.php b/src/Iyzipay/Model/BlacklistedCard.php new file mode 100644 index 00000000..33793142 --- /dev/null +++ b/src/Iyzipay/Model/BlacklistedCard.php @@ -0,0 +1,58 @@ +post($options->getBaseUrl() . self::URL, parent::getHttpHeadersV2(self::URL, $request, $options), $request->toJsonString()); + return BlacklistedCardMapper::create($rawResult)->jsonDecode()->mapBlacklistedCard(new BlacklistedCard()); + } + + public static function retrieve(RetrieveBlacklistedCardRequest $request, Options $options): BlacklistedCard { + $url = self::URL . '/retrieve'; + $rawResult = parent::httpClient()->post(($options)->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); + return BlacklistedCardMapper::create($rawResult)->jsonDecode()->mapRetrieveBlacklistedCard(new BlacklistedCard()); + } + + public static function update(UpdateBlackListedCardRequest $request, Options $options): BlacklistedCard { + $url = self::URL . '/inactive'; + $rawResult = parent::httpClient()->post(($options)->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); + return BlacklistedCardMapper::create($rawResult)->jsonDecode()->mapBlacklistedCard(new BlacklistedCard()); + } + + public function getCardUserKey(): string { + return $this->cardUserKey; + } + + public function setCardUserKey($cardUserKey): void { + $this->cardUserKey = $cardUserKey; + } + + public function getCardToken(): string { + return $this->cardToken; + } + + public function setCardToken($cardToken): void { + $this->cardToken = $cardToken; + } + + public function getCardNumber(): string { + return $this->cardNumber; + } + + public function setCardNumber(string $cardNumber): void { + $this->cardNumber = $cardNumber; + } +} \ No newline at end of file diff --git a/src/Iyzipay/Model/BouncedBankTransferList.php b/src/Iyzipay/Model/BouncedBankTransferList.php index fb0c34ef..acb828dd 100644 --- a/src/Iyzipay/Model/BouncedBankTransferList.php +++ b/src/Iyzipay/Model/BouncedBankTransferList.php @@ -13,7 +13,8 @@ class BouncedBankTransferList extends IyzipayResource public static function retrieve(RetrieveTransactionsRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/reporting/settlement/bounced", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/reporting/settlement/bounced"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return BouncedBankTransferListMapper::create($rawResult)->jsonDecode()->mapBouncedBankTransferList(new BouncedBankTransferList()); } diff --git a/src/Iyzipay/Model/C2CSubMerchant.php b/src/Iyzipay/Model/C2CSubMerchant.php new file mode 100644 index 00000000..81e612f4 --- /dev/null +++ b/src/Iyzipay/Model/C2CSubMerchant.php @@ -0,0 +1,119 @@ +jsonDecode()->mapC2CSubMerchant(new C2CSubMerchant()); + } + + public static function create(CreateC2CSubMerchantRequest $request, Options $options): C2CSubMerchant { + $url = '/onboarding/settlement-to-balance/submerchant'; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); + return self::mappedResult($rawResult); + } + + public static function verify(VerifyC2CSubMerchantRequest $request, Options $options): C2CSubMerchant { + $url = '/onboarding/settlement-to-balance/submerchant/verify'; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); + return self::mappedResult($rawResult); + } + + public function getName(): string { + return $this->name; + } + + public function setName(string $name): void { + $this->name = $name; + } + + public function getSurname(): string { + return $this->surname; + } + + public function setSurname(string $surname): void { + $this->surname = $surname; + } + + public function getEmail(): string { + return $this->email; + } + + public function setEmail(string $email): void { + $this->email = $email; + } + + public function getGsmNumber(): string { + return $this->gsmNumber; + } + + public function setGsmNumber(string $gsmNumber): void { + $this->gsmNumber = $gsmNumber; + } + + public function getTckNo(): string { + return $this->tckNo; + } + + public function setTckNo(string $tckNo): void { + $this->tckNo = $tckNo; + } + + public function getBirthDate(): string { + return $this->birthDate; + } + + public function setBirthDate(string $birthDate): void { + $this->birthDate = $birthDate; + } + + public function getAddress(): string { + return $this->address; + } + + public function setAddress(string $address): void { + $this->address = $address; + } + + public function getExternalId(): string { + return $this->externalId; + } + + public function setExternalId(string $externalId): void { + $this->externalId = $externalId; + } + + public function getTxId(): string { + return $this->txId; + } + + public function setTxId(string $txId): void { + $this->txId = $txId; + } + + public function getSmsVerificationCode(): string { + return $this->smsVerificationCode; + } + + public function setSmsVerificationCode(string $smsVerificationCode): void { + $this->smsVerificationCode = $smsVerificationCode; + } +} diff --git a/src/Iyzipay/Model/C2CSubMerchantApiCredentials.php b/src/Iyzipay/Model/C2CSubMerchantApiCredentials.php new file mode 100644 index 00000000..f11dd9aa --- /dev/null +++ b/src/Iyzipay/Model/C2CSubMerchantApiCredentials.php @@ -0,0 +1,24 @@ +salt ?? null; + } + + public function setSalt(string $salt): void { + $this->salt = $salt; + } + + public function getSecretKey(): ?string { + return $this->secretKey ?? null; + } + + public function setSecretKey(string $secretKey): void { + $this->secretKey = $secretKey; + } +} diff --git a/src/Iyzipay/Model/C2CSubMerchantSmsVerificationCodeEncrypter.php b/src/Iyzipay/Model/C2CSubMerchantSmsVerificationCodeEncrypter.php new file mode 100644 index 00000000..56a5389a --- /dev/null +++ b/src/Iyzipay/Model/C2CSubMerchantSmsVerificationCodeEncrypter.php @@ -0,0 +1,19 @@ +getSalt(); + $secretKey = $credentials->getSecretKey(); + + if (is_null($salt) || is_null($secretKey)) { + throw new \InvalidArgumentException('Please setup credentials!'); + } + + $data = hash_pbkdf2('sha256', $smsVerificationCode, $salt, 65536, 0, true); + $initVector = openssl_random_pseudo_bytes(16, $crypto_strong); + $ciphertext = openssl_encrypt($data, 'aes-256-cbc-hmac-sha256', $secretKey, OPENSSL_RAW_DATA, $initVector); + return base64_encode($ciphertext); + } +} diff --git a/src/Iyzipay/Model/Cancel.php b/src/Iyzipay/Model/Cancel.php index d51eb591..0fd15931 100644 --- a/src/Iyzipay/Model/Cancel.php +++ b/src/Iyzipay/Model/Cancel.php @@ -17,7 +17,8 @@ class Cancel extends IyzipayResource public static function create(CreateCancelRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/cancel", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/cancel"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return CancelMapper::create($rawResult)->jsonDecode()->mapCancel(new Cancel()); } diff --git a/src/Iyzipay/Model/Card.php b/src/Iyzipay/Model/Card.php index d05c23b2..b44a424e 100644 --- a/src/Iyzipay/Model/Card.php +++ b/src/Iyzipay/Model/Card.php @@ -22,16 +22,17 @@ class Card extends IyzipayResource private $cardFamily; private $cardBankCode; private $cardBankName; + const URL = "/cardstorage/card"; public static function create(CreateCardRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/cardstorage/card", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $rawResult = parent::httpClient()->post($options->getBaseUrl() . self::URL, parent::getHttpHeadersV2(self::URL, $request, $options), $request->toJsonString()); return CardMapper::create($rawResult)->jsonDecode()->mapCard(new Card()); } public static function delete(DeleteCardRequest $request, Options $options) { - $rawResult = parent::httpClient()->delete($options->getBaseUrl() . "/cardstorage/card", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $rawResult = parent::httpClient()->delete($options->getBaseUrl() . self::URL, parent::getHttpHeadersV2(self::URL, $request, $options), $request->toJsonString()); return CardMapper::create($rawResult)->jsonDecode()->mapCard(new Card()); } diff --git a/src/Iyzipay/Model/CardList.php b/src/Iyzipay/Model/CardList.php index 2434cc16..0d1d4a62 100644 --- a/src/Iyzipay/Model/CardList.php +++ b/src/Iyzipay/Model/CardList.php @@ -14,7 +14,8 @@ class CardList extends IyzipayResource public static function retrieve(RetrieveCardListRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/cardstorage/cards", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/cardstorage/cards"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return CardListMapper::create($rawResult)->jsonDecode()->mapCardList(new CardList()); } diff --git a/src/Iyzipay/Model/CheckoutForm.php b/src/Iyzipay/Model/CheckoutForm.php index 92160209..74b4778a 100644 --- a/src/Iyzipay/Model/CheckoutForm.php +++ b/src/Iyzipay/Model/CheckoutForm.php @@ -10,10 +10,13 @@ class CheckoutForm extends PaymentResource { private $token; private $callbackUrl; + private $signature; public static function retrieve(RetrieveCheckoutFormRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/checkoutform/auth/ecom/detail", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $token = $request->getToken(); + $uri = "/payment/iyzipos/checkoutform/auth/ecom/detail/"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return CheckoutFormMapper::create($rawResult)->jsonDecode()->mapCheckoutForm(new CheckoutForm()); } @@ -36,4 +39,14 @@ public function setCallbackUrl($callbackUrl) { $this->callbackUrl = $callbackUrl; } + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + return $this->signature = $signature; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/CheckoutFormInitialize.php b/src/Iyzipay/Model/CheckoutFormInitialize.php index 9f50136a..8d427479 100644 --- a/src/Iyzipay/Model/CheckoutFormInitialize.php +++ b/src/Iyzipay/Model/CheckoutFormInitialize.php @@ -10,7 +10,8 @@ class CheckoutFormInitialize extends CheckoutFormInitializeResource { public static function create(CreateCheckoutFormInitializeRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/checkoutform/initialize/auth/ecom", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/iyzipos/checkoutform/initialize/auth/ecom"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return CheckoutFormInitializeMapper::create($rawResult)->jsonDecode()->mapCheckoutFormInitialize(new CheckoutFormInitialize()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/CheckoutFormInitializePreAuth.php b/src/Iyzipay/Model/CheckoutFormInitializePreAuth.php index af7dac1c..346e95fb 100644 --- a/src/Iyzipay/Model/CheckoutFormInitializePreAuth.php +++ b/src/Iyzipay/Model/CheckoutFormInitializePreAuth.php @@ -10,7 +10,8 @@ class CheckoutFormInitializePreAuth extends CheckoutFormInitializeResource { public static function create(CreateCheckoutFormInitializeRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/checkoutform/initialize/preauth/ecom", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/iyzipos/checkoutform/initialize/preauth/ecom"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return CheckoutFormInitializePreAuthMapper::create($rawResult)->jsonDecode()->mapCheckoutFormInitializePreAuth(new CheckoutFormInitializePreAuth()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/CheckoutFormInitializeResource.php b/src/Iyzipay/Model/CheckoutFormInitializeResource.php index 47b6fbb7..16080a6e 100644 --- a/src/Iyzipay/Model/CheckoutFormInitializeResource.php +++ b/src/Iyzipay/Model/CheckoutFormInitializeResource.php @@ -10,6 +10,7 @@ class CheckoutFormInitializeResource extends IyzipayResource private $checkoutFormContent; private $tokenExpireTime; private $paymentPageUrl; + private $signature; public function getToken() { @@ -50,4 +51,12 @@ public function setPaymentPageUrl($paymentPageUrl) { $this->paymentPageUrl = $paymentPageUrl; } + + public function getSignature() { + return $this->signature; + } + + public function setSignature($signature) { + $this->signature = $signature; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/CrossBookingFromSubMerchant.php b/src/Iyzipay/Model/CrossBookingFromSubMerchant.php index ebd8f6c3..bfffe1d9 100644 --- a/src/Iyzipay/Model/CrossBookingFromSubMerchant.php +++ b/src/Iyzipay/Model/CrossBookingFromSubMerchant.php @@ -11,7 +11,8 @@ class CrossBookingFromSubMerchant extends IyzipayResource { public static function create(CreateCrossBookingRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/crossbooking/receive", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/crossbooking/receive"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return CrossBookingFromSubMerchantMapper::create($rawResult)->jsonDecode()->mapCrossBookingFromSubMerchant(new CrossBookingFromSubMerchant()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/CrossBookingToSubMerchant.php b/src/Iyzipay/Model/CrossBookingToSubMerchant.php index 6a1622d2..fd502a4b 100644 --- a/src/Iyzipay/Model/CrossBookingToSubMerchant.php +++ b/src/Iyzipay/Model/CrossBookingToSubMerchant.php @@ -11,7 +11,8 @@ class CrossBookingToSubMerchant extends IyzipayResource { public static function create(CreateCrossBookingRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/crossbooking/send", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/crossbooking/send"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return CrossBookingToSubMerchantMapper::create($rawResult)->jsonDecode()->mapCrossBookingToSubMerchant(new CrossBookingToSubMerchant()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/Disapproval.php b/src/Iyzipay/Model/Disapproval.php index e2821a52..18e3d02d 100644 --- a/src/Iyzipay/Model/Disapproval.php +++ b/src/Iyzipay/Model/Disapproval.php @@ -13,7 +13,8 @@ class Disapproval extends IyzipayResource public static function create(CreateApprovalRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/item/disapprove", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/iyzipos/item/disapprove"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return DisapprovalMapper::create($rawResult)->jsonDecode()->mapDisapproval(new Disapproval()); } diff --git a/src/Iyzipay/Model/InstallmentHtml.php b/src/Iyzipay/Model/InstallmentHtml.php index 4fcae175..236148dd 100644 --- a/src/Iyzipay/Model/InstallmentHtml.php +++ b/src/Iyzipay/Model/InstallmentHtml.php @@ -13,7 +13,8 @@ class InstallmentHtml extends IyzipayResource public static function retrieve(RetrieveInstallmentInfoRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/installment/html/horizontal", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/iyzipos/installment/html/horizontal"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return InstallmentHtmlMapper::create($rawResult)->jsonDecode()->mapInstallmentHtml(new InstallmentHtml()); } diff --git a/src/Iyzipay/Model/InstallmentInfo.php b/src/Iyzipay/Model/InstallmentInfo.php index 26b22cb1..ba6b35a1 100644 --- a/src/Iyzipay/Model/InstallmentInfo.php +++ b/src/Iyzipay/Model/InstallmentInfo.php @@ -13,7 +13,8 @@ class InstallmentInfo extends IyzipayResource public static function retrieve(RetrieveInstallmentInfoRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/installment", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/iyzipos/installment"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return InstallmentInfoMapper::create($rawResult)->jsonDecode()->mapInstallmentInfo(new InstallmentInfo()); } diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkDeleteProduct.php b/src/Iyzipay/Model/Iyzilink/IyziLinkDeleteProduct.php index 66f00795..4464a74b 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::getHttpHeadersV2($uri, null, $options)); + $rawResult = parent::httpClient()->delete($uri, parent::getHttpHeadersIsV2($uri, null, $options)); return IyziLinkDeleteProductMapper::create($rawResult)->jsonDecode()->mapIyziLinkDeleteProduct(new IyziLinkDeleteProduct()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkFastLink.php b/src/Iyzipay/Model/Iyzilink/IyziLinkFastLink.php new file mode 100644 index 00000000..67c3a754 --- /dev/null +++ b/src/Iyzipay/Model/Iyzilink/IyziLinkFastLink.php @@ -0,0 +1,54 @@ +getBaseUrl() . "/v2/iyzilink/fast-link/products" . RequestStringBuilder::requestToStringQuery($request, 'locale'); + $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); + return IyziLinkCreateFastLinkMapper::create($rawResult)->jsonDecode()->mapIyziLinkCreateFastLink(new IyziLinkFastLink()); + } + + public function getDescription(): string { + return $this->description; + } + + public function setDescription(string $description): void { + $this->description = $description; + } + + public function getPrice() { + return $this->price; + } + + public function setPrice($price): void { + $this->price = $price; + } + + public function getCurrencyCode(): string { + return $this->currencyCode; + } + + public function setCurrencyCode(string $currencyCode): void { + $this->currencyCode = $currencyCode; + } + + public function getSourceType(): string { + return $this->sourceType; + } + + public function setSourceType(string $sourceType): void { + $this->sourceType = $sourceType; + } +} diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkRetrieveProduct.php b/src/Iyzipay/Model/Iyzilink/IyziLinkRetrieveProduct.php index 2cd93c1e..ee98589d 100644 --- a/src/Iyzipay/Model/Iyzilink/IyziLinkRetrieveProduct.php +++ b/src/Iyzipay/Model/Iyzilink/IyziLinkRetrieveProduct.php @@ -9,7 +9,7 @@ class IyziLinkRetrieveProduct extends IyziLinkRetrieveProductResource { - public static function create(Request $request, Options $options, $token) + public static function create($request, Options $options, $token) { $uri = $options->getBaseUrl() . "/v2/iyzilink/products/" . $token. RequestStringBuilder::requestToStringQuery($request, null); $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options)); diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProduct.php b/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProduct.php index a31611ac..afeba3c5 100644 --- a/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProduct.php +++ b/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProduct.php @@ -7,12 +7,10 @@ use Iyzipay\Options; use Iyzipay\RequestStringBuilder; -class IyziLinkSaveProduct extends IyziLinkSaveProductResource -{ - public static function create(IyziLinkSaveProductRequest $request, Options $options) - { - $uri = $options->getBaseUrl() . "/v2/iyzilink/products/". RequestStringBuilder::requestToStringQuery($request, null); - $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); +class IyziLinkSaveProduct extends IyziLinkSaveProductResource { + public static function create(IyziLinkSaveProductRequest $request, Options $options): IyziLinkSaveProduct { + $uri = $options->getBaseUrl() . "/v2/iyzilink/products/" . RequestStringBuilder::requestToStringQuery($request, null); + $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/v2/iyzilink/products/", parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return IyziLinkSaveProductMapper::create($rawResult)->jsonDecode()->mapIyziLinkSaveProduct(new IyziLinkSaveProduct()); } } diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProductResource.php b/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProductResource.php index 98691297..0a82b9ac 100644 --- a/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProductResource.php +++ b/src/Iyzipay/Model/Iyzilink/IyziLinkSaveProductResource.php @@ -15,6 +15,9 @@ class IyziLinkSaveProductResource extends IyzipayResource private $token; private $url; private $imageUrl; + private $sourceType; + private $stockEnabled; + private $stockCount; public function getBase64EncodedImage() { @@ -71,4 +74,34 @@ public function setImageUrl($imageUrl) { $this->imageUrl = $imageUrl; } + + public function getSourceType() + { + return $this->sourceType; + } + + public function setSourceType($sourceType) + { + $this->sourceType = $sourceType; + } + + public function getStockEnabled() + { + return $this->stockEnabled; + } + + public function setStockEnabled($stockEnabled) + { + $this->stockEnabled = $stockEnabled; + } + + public function getStockCount() + { + return $this->stockCount; + } + + public function setStockCount($stockCount) + { + $this->stockCount = $stockCount; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkSearchMerchantProducts.php b/src/Iyzipay/Model/Iyzilink/IyziLinkSearchMerchantProducts.php new file mode 100644 index 00000000..d2e6da5c --- /dev/null +++ b/src/Iyzipay/Model/Iyzilink/IyziLinkSearchMerchantProducts.php @@ -0,0 +1,36 @@ +page; + } + + public function setPage(int $page): void { + $this->page = $page; + } + + public function getCount(): int { + return $this->count; + } + + public function setCount(int $count): void { + $this->count = $count; + } + + public static function create(IyziLinkSearchMerchantProductsRequest $request, Options $options): IyziLinkSearchMerchantProducts { + $uri = $options->getBaseUrl() . "/v2/iyzilink/products" . RequestStringBuilder::requestToStringQuery($request, 'pages'); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options)); + return IyziLinkSearchMerchantProductsMapper::create($rawResult)->jsonDecode()->mapIyziLinkSearchMerchantProducts(new IyziLinkSearchMerchantProducts()); + } +} diff --git a/src/Iyzipay/Model/Iyzilink/IyziLinkUpdateProductStatus.php b/src/Iyzipay/Model/Iyzilink/IyziLinkUpdateProductStatus.php new file mode 100644 index 00000000..1c58397a --- /dev/null +++ b/src/Iyzipay/Model/Iyzilink/IyziLinkUpdateProductStatus.php @@ -0,0 +1,38 @@ +token; + } + + public function setToken(string $token): void { + $this->token = $token; + } + + public function getProductStatus(): string { + return $this->productStatus; + } + + public function setProductStatus(string $productStatus): void { + $this->productStatus = $productStatus; + } + + public static function create(IyziLinkUpdateProductStatusRequest $request, Options $options) { + $token = $request->getToken(); + $productStatus = $request->getProductStatus(); + $uri = $options->getBaseUrl() . "/v2/iyzilink/products/$token/status/$productStatus" . RequestStringBuilder::requestToStringQuery($request, 'locale'); + $rawResult = parent::httpClient()->patch($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); + return IyziLinkUpdateProductStatusMapper::create($rawResult)->jsonDecode()->mapIyziLinkUpdateProductStatus(new IyziLinkUpdateProductStatus()); + } +} diff --git a/src/Iyzipay/Model/IyziupForm.php b/src/Iyzipay/Model/IyziupForm.php index cf7c421e..1f89659f 100644 --- a/src/Iyzipay/Model/IyziupForm.php +++ b/src/Iyzipay/Model/IyziupForm.php @@ -20,7 +20,8 @@ class IyziupForm extends IyzipayResource public static function retrieve(RetrieveIyziupFormRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/v1/iyziup/form/order/retrieve", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/v1/iyziup/form/order/retrieve"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return IyziupFormMapper::create($rawResult)->jsonDecode()->mapIyziupForm(new IyziupForm()); } diff --git a/src/Iyzipay/Model/IyziupFormInitialize.php b/src/Iyzipay/Model/IyziupFormInitialize.php index c86769c8..7e6f4e79 100644 --- a/src/Iyzipay/Model/IyziupFormInitialize.php +++ b/src/Iyzipay/Model/IyziupFormInitialize.php @@ -10,7 +10,8 @@ class IyziupFormInitialize extends IyziupFormInitializeResource { public static function create(CreateIyziupFormInitializeRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/v1/iyziup/form/initialize", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/v1/iyziup/form/initialize"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return IyziupFormInitializeMapper::create($rawResult)->jsonDecode()->mapIyziupFormInitialize(new IyziupFormInitialize()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/Loyalty.php b/src/Iyzipay/Model/Loyalty.php index ace5c551..5c633f5c 100644 --- a/src/Iyzipay/Model/Loyalty.php +++ b/src/Iyzipay/Model/Loyalty.php @@ -11,7 +11,8 @@ class Loyalty extends IyzipayResource { public static function retrieve(RetrieveLoyaltyRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/loyalty/inquire", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/loyalty/inquire"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return LoyaltyMapper::create($rawResult)->jsonDecode()->mapLoyalty(new Loyalty()); } diff --git a/src/Iyzipay/Model/Mapper/AmountBaseRefundMapper.php b/src/Iyzipay/Model/Mapper/AmountBaseRefundMapper.php new file mode 100644 index 00000000..4ec7188c --- /dev/null +++ b/src/Iyzipay/Model/Mapper/AmountBaseRefundMapper.php @@ -0,0 +1,33 @@ +paymentId)) { + $amountBaseRefund->setPaymentId($jsonObject->paymentId); + } + + if (isset($jsonObject->price)) { + $amountBaseRefund->setPrice($jsonObject->price); + } + + if (isset($jsonObject->ip)) { + $amountBaseRefund->setIp($jsonObject->ip); + } + + return $amountBaseRefund; + } + + public function mapAmountBaseRefund(AmountBaseRefund $amountBaseRefund): AmountBaseRefund { + return $this->mapAmountBaseRefundFrom($amountBaseRefund, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/ApmResourceMapper.php b/src/Iyzipay/Model/Mapper/ApmResourceMapper.php index 3c915c5b..2f8af47e 100644 --- a/src/Iyzipay/Model/Mapper/ApmResourceMapper.php +++ b/src/Iyzipay/Model/Mapper/ApmResourceMapper.php @@ -84,6 +84,9 @@ public function mapApmResourceFrom(ApmResource $apmResource, $jsonObject) if (isset($jsonObject->paymentStatus)) { $apmResource->setPaymentStatus($jsonObject->paymentStatus); } + if (isset($jsonObject->signature)) { + $apmResource->setSignature($jsonObject->signature); + } return $apmResource; } diff --git a/src/Iyzipay/Model/Mapper/BkmInitializeMapper.php b/src/Iyzipay/Model/Mapper/BkmInitializeMapper.php index 37e146ea..c2366348 100644 --- a/src/Iyzipay/Model/Mapper/BkmInitializeMapper.php +++ b/src/Iyzipay/Model/Mapper/BkmInitializeMapper.php @@ -21,6 +21,9 @@ public function mapBkmInitializeFrom(BkmInitialize $initialize, $jsonObject) if (isset($jsonObject->token)) { $initialize->setToken($jsonObject->token); } + if (isset($jsonObject->signature)) { + $initialize->setSignature($jsonObject->signature); + } return $initialize; } diff --git a/src/Iyzipay/Model/Mapper/BlacklistedCardMapper.php b/src/Iyzipay/Model/Mapper/BlacklistedCardMapper.php new file mode 100644 index 00000000..48afe8c7 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/BlacklistedCardMapper.php @@ -0,0 +1,41 @@ +cardUserKey)) { + $blacklistedCard->setCardUserKey($jsonObject->cardUserKey); + } + if (isset($jsonObject->cardToken)) { + $blacklistedCard->setCardToken($jsonObject->cardToken); + } + + return $blacklistedCard; + } + + public function mapRetrieveBlacklistedCardForm(BlacklistedCard $blacklistedCard, $jsonObject): BlacklistedCard { + parent::mapResourceFrom($blacklistedCard, $jsonObject); + + if (isset($jsonObject->cardNumber)) { + $blacklistedCard->setCardNumber(($jsonObject->cardNumber)); + } + return $blacklistedCard; + } + + public function mapBlacklistedCard(BlacklistedCard $blacklistedCard): BlacklistedCard { + return $this->mapBlacklistedCardForm($blacklistedCard, $this->jsonObject); + } + + public function mapRetrieveBlacklistedCard(BlacklistedCard $blacklistedCard): BlacklistedCard { + return $this->mapRetrieveBlacklistedCardForm($blacklistedCard, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/C2CSubMerchantMapper.php b/src/Iyzipay/Model/Mapper/C2CSubMerchantMapper.php new file mode 100644 index 00000000..1b79239e --- /dev/null +++ b/src/Iyzipay/Model/Mapper/C2CSubMerchantMapper.php @@ -0,0 +1,61 @@ +name)) { + $c2CSubMerchant->setName($jsonObject->name); + } + + if (isset($jsonObject->surname)) { + $c2CSubMerchant->setSurname($jsonObject->surname); + } + + if (isset($jsonObject->email)) { + $c2CSubMerchant->setEmail($jsonObject->email); + } + + if (isset($jsonObject->gsmNumber)) { + $c2CSubMerchant->setGsmNumber($jsonObject->gsmNumber); + } + + if (isset($jsonObject->tckNo)) { + $c2CSubMerchant->setTckNo($jsonObject->tckNo); + } + + if (isset($jsonObject->birthDate)) { + $c2CSubMerchant->setBirthDate($jsonObject->birthDate); + } + + if (isset($jsonObject->address)) { + $c2CSubMerchant->setAddress($jsonObject->address); + } + + if (isset($jsonObject->externalId)) { + $c2CSubMerchant->setExternalId($jsonObject->externalId); + } + + if (isset($jsonObject->txId)) { + $c2CSubMerchant->setTxId($jsonObject->txId); + } + + if (isset($jsonObject->smsVerificationCode)) { + $c2CSubMerchant->setSmsVerificationCode($jsonObject->smsVerificationCode); + } + + return $c2CSubMerchant; + } + + public function mapC2CSubMerchant(C2CSubMerchant $c2CSubMerchant): C2CSubMerchant { + return $this->mapC2CSubMerchantFrom($c2CSubMerchant, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/CheckoutFormInitializeResourceMapper.php b/src/Iyzipay/Model/Mapper/CheckoutFormInitializeResourceMapper.php index f2458ff2..4a18092b 100644 --- a/src/Iyzipay/Model/Mapper/CheckoutFormInitializeResourceMapper.php +++ b/src/Iyzipay/Model/Mapper/CheckoutFormInitializeResourceMapper.php @@ -27,6 +27,9 @@ public function mapCheckoutFormInitializeResourceFrom(CheckoutFormInitializeReso if (isset($jsonObject->paymentPageUrl)) { $initialize->setPaymentPageUrl($jsonObject->paymentPageUrl); } + if (isset($jsonObject->signature)) { + $initialize->setSignature($jsonObject->signature); + } return $initialize; } diff --git a/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkCreateFastLinkMapper.php b/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkCreateFastLinkMapper.php new file mode 100644 index 00000000..aaf8ca71 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkCreateFastLinkMapper.php @@ -0,0 +1,38 @@ +description)) { + $iyzilinkFastLink->setDescription(($jsonObjet->description)); + } + + if (isset($jsonObjet->price)) { + $iyzilinkFastLink->setPrice($jsonObjet->pricr); + } + + if (isset($jsonObjet->currencyCode)) { + $iyzilinkFastLink->setCurrencyCode($jsonObjet->currencyCode); + } + + if (isset($jsonObjet->sourceType)) { + $iyzilinkFastLink->setSourceType($jsonObjet->sourceType); + } + + return $iyzilinkFastLink; + } + + public function mapIyziLinkCreateFastLink(IyziLinkFastLink $iyziLinkFastLink): IyziLinkFastLink { + return $this->mapIyziLinkCreateFastLinkFrom($iyziLinkFastLink, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkSearchMerchantProductsMapper.php b/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkSearchMerchantProductsMapper.php new file mode 100644 index 00000000..0c2720b9 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkSearchMerchantProductsMapper.php @@ -0,0 +1,30 @@ +page)) { + $iyziLinkSearchMerchantProducts->setPage($jsonObject->page); + } + + if (isset($jsonObject->count)) { + $iyziLinkSearchMerchantProducts->setCount($jsonObject->count); + } + + return $iyziLinkSearchMerchantProducts; + } + + public function mapIyziLinkSearchMerchantProducts(IyziLinkSearchMerchantProducts $iyziLinkSearchMerchantProducts): IyziLinkSearchMerchantProducts { + return $this->mapIyziLinkSearchMerchantProductsFrom($iyziLinkSearchMerchantProducts, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapper.php b/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapper.php new file mode 100644 index 00000000..adc39b30 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapper.php @@ -0,0 +1,30 @@ +token)) { + $iyziLinkUpdateProductStatus->setToken($jsonObject->token); + } + + if (isset($jsonObject->productStatus)) { + $iyziLinkUpdateProductStatus->setProductStatus($jsonObject->productStatus); + } + + return $iyziLinkUpdateProductStatus; + } + + public function mapIyziLinkUpdateProductStatus(IyziLinkUpdateProductStatus $iyziLinkUpdateProductStatus): IyziLinkUpdateProductStatus { + return $this->mapIyziLinkUpdateProductStatusFrom($iyziLinkUpdateProductStatus, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/PayWithIyzicoInitializeResourceMapper.php b/src/Iyzipay/Model/Mapper/PayWithIyzicoInitializeResourceMapper.php index bc02af46..3143757f 100755 --- a/src/Iyzipay/Model/Mapper/PayWithIyzicoInitializeResourceMapper.php +++ b/src/Iyzipay/Model/Mapper/PayWithIyzicoInitializeResourceMapper.php @@ -27,6 +27,9 @@ public function mapPayWithIyzicoInitializeResourceFrom(PayWithIyzicoInitializeRe if (isset($jsonObject->payWithIyzicoPageUrl)) { $initialize->setPaymentPageUrl($jsonObject->payWithIyzicoPageUrl); } + if (isset($jsonObject->signature)) { + $initialize->setSignature($jsonObject->signature); + } return $initialize; } diff --git a/src/Iyzipay/Model/Mapper/PayWithIyzicoMapper.php b/src/Iyzipay/Model/Mapper/PayWithIyzicoMapper.php index 009b09a8..4cb8edde 100755 --- a/src/Iyzipay/Model/Mapper/PayWithIyzicoMapper.php +++ b/src/Iyzipay/Model/Mapper/PayWithIyzicoMapper.php @@ -21,6 +21,12 @@ public function mapPayWithIyzicoFrom(PayWithIyzico $auth, $jsonObject) if (isset($jsonObject->callbackUrl)) { $auth->setCallbackUrl($jsonObject->callbackUrl); } + if (isset($jsonObject->paymentStatus)) { + $auth->setPaymentStatus($jsonObject->paymentStatus); + } + if (isset($jsonObject->signature)) { + $auth->setSignature($jsonObject->signature); + } return $auth; } diff --git a/src/Iyzipay/Model/Mapper/PaymentResourceMapper.php b/src/Iyzipay/Model/Mapper/PaymentResourceMapper.php index 2bb4809a..0623babe 100644 --- a/src/Iyzipay/Model/Mapper/PaymentResourceMapper.php +++ b/src/Iyzipay/Model/Mapper/PaymentResourceMapper.php @@ -87,6 +87,9 @@ public function mapPaymentResourceFrom(PaymentResource $paymentResource, $jsonOb if (isset($jsonObject->posOrderId)) { $paymentResource->setPosOrderId($jsonObject->posOrderId); } + if (isset($jsonObject->signature)) { + $paymentResource->setSignature($jsonObject->signature); + } return $paymentResource; } diff --git a/src/Iyzipay/Model/Mapper/PlusInstallmentPaymentMapper.php b/src/Iyzipay/Model/Mapper/PlusInstallmentPaymentMapper.php new file mode 100644 index 00000000..e93744d9 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/PlusInstallmentPaymentMapper.php @@ -0,0 +1,20 @@ +mapPlusInstallmentPaymentFrom($payment, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/PlusInstallmentPaymentResourceMapper.php b/src/Iyzipay/Model/Mapper/PlusInstallmentPaymentResourceMapper.php new file mode 100644 index 00000000..244b4b34 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/PlusInstallmentPaymentResourceMapper.php @@ -0,0 +1,77 @@ +price)) { + $resource->setPrice($jsonObject->price); + } + + if (isset($jsonObject->paidPrice)) { + $resource->setPaidPrice($jsonObject->paidPrice); + } + + if (isset($jsonObject->currency)) { + $resource->setCurrency($jsonObject->currency); + } + + if (isset($jsonObject->installment)) { + $resource->setInstallment($jsonObject->installment); + } + + if (isset($jsonObject->paymentChannel)) { + $resource->setPaymentChannel($jsonObject->paymentChannel); + } + + if (isset($jsonObject->basketId)) { + $resource->setBasketId($jsonObject->basketId); + } + + if (isset($jsonObject->paymentGroup)) { + $resource->setPaymentGroup($jsonObject->paymentGroup); + } + +// if (isset($jsonObject->connectorName)) { +// $resource->setConnectorName($jsonObject->connectorName); +// } +// +// if (isset($jsonObject->plusInstallmentUsage)) { +// $resource->setPlusInstallmentUsage($jsonObject->plusInstallmentUsage); +// } + + if (isset($jsonObject->paymentCard)) { + $resource->setPaymentCard($jsonObject->paymentCard); + } + + if (isset($jsonObject->buyer)) { + $resource->setBuyer($jsonObject->buyer); + } + + if (isset($jsonObject->shippingAddress)) { + $resource->setShippingAddress($jsonObject->shippingAddress); + } + + if (isset($jsonObject->billingAddress)) { + $resource->setBillingAddress($jsonObject->billingAddress); + } + + if (isset($jsonObject->basketItems)) { + $resource->setBasketItems($jsonObject->basketItems); + } + + return $resource; + } + + public function mapPlusInstallmentPaymentResource(PlusInstallmentPaymentResource $resource): PlusInstallmentPaymentResource { + return $this->mapPlusInstallmentPaymentResourceFrom($resource, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/ReportingScrollTransactionMapper.php b/src/Iyzipay/Model/Mapper/ReportingScrollTransactionMapper.php new file mode 100644 index 00000000..8eddb26b --- /dev/null +++ b/src/Iyzipay/Model/Mapper/ReportingScrollTransactionMapper.php @@ -0,0 +1,33 @@ +transactionDate)) { + $transaction->setTransactionDate($jsonObject->transactionDate); + } + + if (isset($jsonObject->documentScrollVoSortingOrder)) { + $transaction->setDocumentScrollVoSortingOrder($jsonObject->documentScrollVoSortingOrder); + } + + if (isset($jsonObject->lastId)) { + $transaction->setLastId($jsonObject->lastId); + } + + return $transaction; + } + + public function mapReportingScrollTransaction(ReportingScrollTransaction $transaction): ReportingScrollTransaction { + return $this->mapReportingScrollTransactionFrom($transaction, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/Subscription/SubscriptionDeleteCustomerMapper.php b/src/Iyzipay/Model/Mapper/Subscription/SubscriptionDeleteCustomerMapper.php new file mode 100644 index 00000000..92a76114 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/Subscription/SubscriptionDeleteCustomerMapper.php @@ -0,0 +1,28 @@ +customerReferenceCode)) { + $customer->setCustomerReferenceCode($jsonObject->customerReferenceCode); + } + + return $customer; + } + + public function mapSubscriptionDeleteCustomer(SubscriptionDeleteCustomer $customer): SubscriptionDeleteCustomer { + return $this->mapSubscriptionDeleteCustomerFrom($customer, $this->jsonObject); + } +} + + diff --git a/src/Iyzipay/Model/Mapper/Subscription/SubscriptionListMapper.php b/src/Iyzipay/Model/Mapper/Subscription/SubscriptionListMapper.php new file mode 100644 index 00000000..13f203e7 --- /dev/null +++ b/src/Iyzipay/Model/Mapper/Subscription/SubscriptionListMapper.php @@ -0,0 +1,58 @@ +subscriptionReferenceCode)) { + $subscriptionList->setSubscriptionReferenceCode($jsonObject->subscriptionReferenceCode); + } + + if (isset($jsonObject->subscriptionStatus)) { + $subscriptionList->setSubscriptionStatus($jsonObject->subscriptionStatus); + } + + if (isset($jsonObject->page)) { + $subscriptionList->setPage($jsonObject->page); + } + + if (isset($jsonObject->count)) { + $subscriptionList->setCount($jsonObject->count); + } + + if (isset($jsonObject->customerReferenceCode)) { + $subscriptionList->setCustomerReferenceCode($jsonObject->customerReferenceCode); + } + + if (isset($jsonObject->parentReferenceCode)) { + $subscriptionList->setParentReferenceCode($jsonObject->parentReferenceCode); + } + + if (isset($jsonObject->startDate)) { + $subscriptionList->setStartDate($jsonObject->startDate); + } + + if (isset($jsonObject->endDate)) { + $subscriptionList->setEndDate($jsonObject->endDate); + } + + if (isset($jsonObject->pricingPlanReferenceCode)) { + $subscriptionList->setPricingPlanReferenceCode($jsonObject->pricingPlanReferenceCode); + } + + return $subscriptionList; + } + + public function mapSubscriptionList(SubscriptionList $subscriptionList): \Iyzipay\Model\Subscription\SubscriptionList { + return $this->mapSubscriptionListFrom($subscriptionList, $this->jsonObject); + } +} diff --git a/src/Iyzipay/Model/Mapper/ThreedsInitializeMapper.php b/src/Iyzipay/Model/Mapper/ThreedsInitializeMapper.php index 23fc0459..3b4193c8 100644 --- a/src/Iyzipay/Model/Mapper/ThreedsInitializeMapper.php +++ b/src/Iyzipay/Model/Mapper/ThreedsInitializeMapper.php @@ -18,6 +18,12 @@ public function mapThreedsInitializeFrom(ThreedsInitialize $initialize, $jsonObj if (isset($jsonObject->threeDSHtmlContent)) { $initialize->setHtmlContent(base64_decode($jsonObject->threeDSHtmlContent)); } + if (isset($jsonObject->paymentId)) { + $initialize->setPaymentId($jsonObject->paymentId); + } + if (isset($jsonObject->signature)) { + $initialize->setSignature($jsonObject->signature); + } return $initialize; } diff --git a/src/Iyzipay/Model/Mapper/ThreedsInitializePreAuthMapper.php b/src/Iyzipay/Model/Mapper/ThreedsInitializePreAuthMapper.php index e979f287..5bc50a2b 100644 --- a/src/Iyzipay/Model/Mapper/ThreedsInitializePreAuthMapper.php +++ b/src/Iyzipay/Model/Mapper/ThreedsInitializePreAuthMapper.php @@ -18,6 +18,12 @@ public function mapThreedsInitializePreAuthFrom(ThreedsInitializePreAuth $initia if (isset($jsonObject->threeDSHtmlContent)) { $initializePreAuth->setHtmlContent(base64_decode($jsonObject->threeDSHtmlContent)); } + if (isset($jsonObject->paymentId)) { + $initializePreAuth->setPaymentId($jsonObject->paymentId); + } + if (isset($jsonObject->signature)) { + $initializePreAuth->setSignature($jsonObject->signature); + } return $initializePreAuth; } diff --git a/src/Iyzipay/Model/PayWithIyzico.php b/src/Iyzipay/Model/PayWithIyzico.php index 11e5785f..15506608 100755 --- a/src/Iyzipay/Model/PayWithIyzico.php +++ b/src/Iyzipay/Model/PayWithIyzico.php @@ -10,11 +10,13 @@ class PayWithIyzico extends PaymentResource { private $token; private $callbackUrl; + private $paymentStatus; + private $signature; public static function retrieve(RetrievePayWithIyzicoRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/checkoutform/auth/ecom/detail", parent::getHttpHeaders($request, $options), $request->toJsonString()); - + $uri = "/payment/iyzipos/checkoutform/auth/ecom/detail"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return PayWithIyzicoMapper::create($rawResult)->jsonDecode()->mapPayWithIyzico(new PayWithIyzico()); } @@ -37,4 +39,22 @@ public function setCallbackUrl($callbackUrl) { $this->callbackUrl = $callbackUrl; } + + public function getPaymentStatus() { + return $this->paymentStatus; + } + + public function setPaymentStatus($paymentStatus) { + $this->paymentStatus = $paymentStatus; + } + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + $this->signature = $signature; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/PayWithIyzicoInitialize.php b/src/Iyzipay/Model/PayWithIyzicoInitialize.php index bc4e1456..e4694901 100755 --- a/src/Iyzipay/Model/PayWithIyzicoInitialize.php +++ b/src/Iyzipay/Model/PayWithIyzicoInitialize.php @@ -10,8 +10,8 @@ class PayWithIyzicoInitialize extends PayWithIyzicoInitializeResource { public static function create(CreatePayWithIyzicoInitializeRequest $request, Options $options) { - - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/pay-with-iyzico/initialize", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/pay-with-iyzico/initialize"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return PayWithIyzicoInitializeMapper::create($rawResult)->jsonDecode()->mapPayWithIyzicoInitialize(new PayWithIyzicoInitialize()); } diff --git a/src/Iyzipay/Model/PayWithIyzicoInitializeResource.php b/src/Iyzipay/Model/PayWithIyzicoInitializeResource.php index e551e45f..fdcf25f2 100755 --- a/src/Iyzipay/Model/PayWithIyzicoInitializeResource.php +++ b/src/Iyzipay/Model/PayWithIyzicoInitializeResource.php @@ -10,6 +10,7 @@ class PayWithIyzicoInitializeResource extends IyzipayResource private $payWithIyzicoContent; private $tokenExpireTime; private $payWithIyzicoPageUrl; + private $signature; public function getToken() { @@ -50,4 +51,13 @@ public function setPaymentPageUrl($payWithIyzicoPageUrl) { $this->payWithIyzicoPageUrl = $payWithIyzicoPageUrl; } + + public function getSignature() { + return $this->signature; + } + + public function setSignature($signature) { + $this->signature = $signature; + } + } \ No newline at end of file diff --git a/src/Iyzipay/Model/Payment.php b/src/Iyzipay/Model/Payment.php index d2c855e8..3408f44b 100644 --- a/src/Iyzipay/Model/Payment.php +++ b/src/Iyzipay/Model/Payment.php @@ -9,15 +9,19 @@ class Payment extends PaymentResource { +// private $signature; + public static function create(CreatePaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/auth", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/auth"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return PaymentMapper::create($rawResult)->jsonDecode()->mapPayment(new Payment()); } public static function retrieve(RetrievePaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/detail", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/detail"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return PaymentMapper::create($rawResult)->jsonDecode()->mapPayment(new Payment()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/PaymentPostAuth.php b/src/Iyzipay/Model/PaymentPostAuth.php index 24b7f9a4..e2bd530c 100644 --- a/src/Iyzipay/Model/PaymentPostAuth.php +++ b/src/Iyzipay/Model/PaymentPostAuth.php @@ -8,9 +8,21 @@ class PaymentPostAuth extends PaymentResource { + private $signature; + public static function create(CreatePaymentPostAuthRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/postauth", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/postauth"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return PaymentPostAuthMapper::create($rawResult)->jsonDecode()->mapPaymentPostAuth(new PaymentPostAuth()); } + + public function getSignature() { + return $this->signature; + } + + public function setSignature($signature) { + $this->signature = $signature; + } + } \ No newline at end of file diff --git a/src/Iyzipay/Model/PaymentPreAuth.php b/src/Iyzipay/Model/PaymentPreAuth.php index a1639d13..24828f8c 100644 --- a/src/Iyzipay/Model/PaymentPreAuth.php +++ b/src/Iyzipay/Model/PaymentPreAuth.php @@ -11,13 +11,15 @@ class PaymentPreAuth extends PaymentResource { public static function create(CreatePaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/preauth", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/preauth"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return PaymentPreAuthMapper::create($rawResult)->jsonDecode()->mapPaymentPreAuth(new PaymentPreAuth()); } public static function retrieve(RetrievePaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/detail", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/detail"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return PaymentPreAuthMapper::create($rawResult)->jsonDecode()->mapPaymentPreAuth(new PaymentPreAuth()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/PaymentResource.php b/src/Iyzipay/Model/PaymentResource.php index b22b79b2..889a7bba 100644 --- a/src/Iyzipay/Model/PaymentResource.php +++ b/src/Iyzipay/Model/PaymentResource.php @@ -30,6 +30,7 @@ class PaymentResource extends IyzipayResource private $phase; private $lastFourDigits; private $posOrderId; + private $signature; public function getPrice() { @@ -270,4 +271,14 @@ public function setPosOrderId($posOrderId) { $this->posOrderId = $posOrderId; } + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + $this->signature = $signature; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/PayoutCompletedTransactionList.php b/src/Iyzipay/Model/PayoutCompletedTransactionList.php index ba6fb87b..5701a854 100644 --- a/src/Iyzipay/Model/PayoutCompletedTransactionList.php +++ b/src/Iyzipay/Model/PayoutCompletedTransactionList.php @@ -13,7 +13,8 @@ class PayoutCompletedTransactionList extends IyzipayResource public static function retrieve(RetrieveTransactionsRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/reporting/settlement/payoutcompleted", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/reporting/settlement/payoutcompleted"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return PayoutCompletedTransactionListMapper::create($rawResult)->jsonDecode()->mapPayoutCompletedTransactionList(new PayoutCompletedTransactionList()); } diff --git a/src/Iyzipay/Model/PlusInstallmentPayment.php b/src/Iyzipay/Model/PlusInstallmentPayment.php new file mode 100644 index 00000000..e5a6fb56 --- /dev/null +++ b/src/Iyzipay/Model/PlusInstallmentPayment.php @@ -0,0 +1,15 @@ +post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); + return PlusInstallmentPaymentMapper::create($rawResult)->jsonDecode()->mapPlusInstallmentPayment(new PlusInstallmentPayment()); + } +} diff --git a/src/Iyzipay/Model/PlusInstallmentPaymentResource.php b/src/Iyzipay/Model/PlusInstallmentPaymentResource.php new file mode 100644 index 00000000..2dbe2a60 --- /dev/null +++ b/src/Iyzipay/Model/PlusInstallmentPaymentResource.php @@ -0,0 +1,134 @@ +price; + } + + public function setPrice(float $price): void { + $this->price = $price; + } + + public function getPaidPrice(): float { + return $this->paidPrice; + } + + public function setPaidPrice(float $paidPrice): void { + $this->paidPrice = $paidPrice; + } + + public function getCurrency(): string { + return $this->currency; + } + + public function setCurrency(string $currency): void { + $this->currency = $currency; + } + + public function getInstallment(): int { + return $this->installment; + } + + public function setInstallment(int $installment): void { + $this->installment = $installment; + } + + public function getPaymentChannel(): string { + return $this->paymentChannel; + } + + public function setPaymentChannel(string $paymentChannel): void { + $this->paymentChannel = $paymentChannel; + } + + public function getBasketId(): string { + return $this->basketId; + } + + public function setBasketId(string $basketId): void { + $this->basketId = $basketId; + } + + public function getPaymentGroup(): string { + return $this->paymentGroup; + } + + public function setPaymentGroup(string $paymentGroup): void { + $this->paymentGroup = $paymentGroup; + } + + public function getConnectorName(): string { + return $this->connectorName; + } + + public function setConnectorName(string $connectorName): void { + $this->connectorName = $connectorName; + } + + public function getPlusInstallmentUsage(): int { + return $this->plusInstallmentUsage; + } + + public function setPlusInstallmentUsage(int $plusInstallmentUsage): void { + $this->plusInstallmentUsage = $plusInstallmentUsage; + } + + public function getPaymentCard(): PaymentCard { + return $this->paymentCard; + } + + public function setPaymentCard(PaymentCard $paymentCard): void { + $this->paymentCard = $paymentCard; + } + + public function getBuyer(): Buyer { + return $this->buyer; + } + + public function setBuyer(Buyer $buyer): void { + $this->buyer = $buyer; + } + + public function getShippingAddress(): Address { + return $this->shippingAddress; + } + + public function setShippingAddress(Address $shippingAddress): void { + $this->shippingAddress = $shippingAddress; + } + + public function getBillingAddress(): Address { + return $this->billingAddress; + } + + public function setBillingAddress(Address $billingAddress): void { + $this->billingAddress = $billingAddress; + } + + public function getBasketItems(): array { + return $this->basketItems; + } + + public function setBasketItems(array $basketItems): void { + $this->basketItems = $basketItems; + } +} diff --git a/src/Iyzipay/Model/ProtectedOverleyScript.php b/src/Iyzipay/Model/ProtectedOverleyScript.php index 8da8c52a..cee26dcd 100644 --- a/src/Iyzipay/Model/ProtectedOverleyScript.php +++ b/src/Iyzipay/Model/ProtectedOverleyScript.php @@ -14,7 +14,8 @@ class ProtectedOverleyScript extends IyzipayResource public static function retrieve(RetrieveProtectedOverleyScriptRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/v1/iyziup/protected/shop/detail/overlay-script", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/v1/iyziup/protected/shop/detail/overlay-script"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return ProtectedOverleyScriptMapper::create($rawResult)->jsonDecode()->mapProtectedOverleyScript(new ProtectedOverleyScript()); } diff --git a/src/Iyzipay/Model/Refund.php b/src/Iyzipay/Model/Refund.php index fb9a7be0..88948646 100644 --- a/src/Iyzipay/Model/Refund.php +++ b/src/Iyzipay/Model/Refund.php @@ -10,7 +10,8 @@ class Refund extends RefundResource { public static function create(CreateRefundRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/refund", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/refund"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return RefundMapper::create($rawResult)->jsonDecode()->mapRefund(new Refund()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/RefundChargedFromMerchant.php b/src/Iyzipay/Model/RefundChargedFromMerchant.php index 7713bb4c..916302a4 100644 --- a/src/Iyzipay/Model/RefundChargedFromMerchant.php +++ b/src/Iyzipay/Model/RefundChargedFromMerchant.php @@ -10,7 +10,8 @@ class RefundChargedFromMerchant extends RefundResource { public static function create(CreateRefundRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/iyzipos/refund/merchant/charge", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/iyzipos/refund/merchant/charge"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return RefundChargedFromMerchantMapper::create($rawResult)->jsonDecode()->mapRefundChargedFromMerchant(new RefundChargedFromMerchant()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/RefundToBalance.php b/src/Iyzipay/Model/RefundToBalance.php index cc48f9dd..484a9c2b 100644 --- a/src/Iyzipay/Model/RefundToBalance.php +++ b/src/Iyzipay/Model/RefundToBalance.php @@ -10,7 +10,8 @@ class RefundToBalance extends RefundToBalanceResource { public static function create(CreateRefundToBalanceRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/refund-to-balance/init", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/refund-to-balance/init"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return RefundToBalanceMapper::create($rawResult)->jsonDecode()->mapRefundToBalance(new RefundToBalance()); } diff --git a/src/Iyzipay/Model/ReportingPaymentDetail.php b/src/Iyzipay/Model/ReportingPaymentDetail.php index 23de8784..2fa2ca4a 100644 --- a/src/Iyzipay/Model/ReportingPaymentDetail.php +++ b/src/Iyzipay/Model/ReportingPaymentDetail.php @@ -12,8 +12,8 @@ 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::getHttpHeadersV2($uri, null, $options)); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options)); return ReportingPaymentDetailMapper::create($rawResult)->jsonDecode()->mapReportingPaymentDetail(new ReportingPaymentDetail()); - } + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/ReportingScrollTransaction.php b/src/Iyzipay/Model/ReportingScrollTransaction.php new file mode 100644 index 00000000..a6ffdd56 --- /dev/null +++ b/src/Iyzipay/Model/ReportingScrollTransaction.php @@ -0,0 +1,46 @@ +getBaseUrl() . '/v2/reporting/payment/scroll-transactions' . RequestStringBuilder::requestToStringQuery($request, 'reportingScrollTransaction'); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options)); + return ReportingScrollTransactionMapper::create($rawResult)->jsonDecode()->mapReportingScrollTransaction(new ReportingScrollTransaction()); + } + + public function getDocumentScrollVoSortingOrder(): string { + return $this->documentScrollVoSortingOrder; + } + + public function setDocumentScrollVoSortingOrder(string $documentScrollVoSortingOrder): void { + $this->documentScrollVoSortingOrder = $documentScrollVoSortingOrder; + } + + public function getTransactionDate(): string { + return $this->transactionDate; + } + + public function setTransactionDate(string $transactionDate): void { + $this->transactionDate = $transactionDate; + } + + public function getLastId(): string { + return $this->lastId; + } + + public function setLastId(string $lastId): void { + $this->lastId = $lastId; + } + +} diff --git a/src/Iyzipay/Model/SettlementToBalance.php b/src/Iyzipay/Model/SettlementToBalance.php index 582040aa..ab3c55bb 100644 --- a/src/Iyzipay/Model/SettlementToBalance.php +++ b/src/Iyzipay/Model/SettlementToBalance.php @@ -10,7 +10,8 @@ class SettlementToBalance extends SettlementToBalanceResource { public static function create(CreateSettlementToBalanceRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/settlement-to-balance/init", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/settlement-to-balance/init"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return SettlementToBalanceMapper::create($rawResult)->jsonDecode()->mapSettlementToBalance(new SettlementToBalance()); } diff --git a/src/Iyzipay/Model/Status.php b/src/Iyzipay/Model/Status.php index 0616a17e..9a05221f 100644 --- a/src/Iyzipay/Model/Status.php +++ b/src/Iyzipay/Model/Status.php @@ -2,8 +2,9 @@ namespace Iyzipay\Model; -class Status -{ +class Status { const SUCCESS = "success"; const FAILURE = "failure"; + const ACTIVE = "ACTIVE"; + const PASSIVE = "PASSIVE"; } \ No newline at end of file diff --git a/src/Iyzipay/Model/SubMerchant.php b/src/Iyzipay/Model/SubMerchant.php index 18d72133..2bc6794f 100644 --- a/src/Iyzipay/Model/SubMerchant.php +++ b/src/Iyzipay/Model/SubMerchant.php @@ -28,21 +28,24 @@ class SubMerchant extends IyzipayResource private $subMerchantType; private $subMerchantKey; + const URL = "/onboarding/submerchant"; + public static function create(CreateSubMerchantRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/onboarding/submerchant", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $rawResult = parent::httpClient()->post($options->getBaseUrl() . self::URL, parent::getHttpHeadersV2(self::URL, $request, $options), $request->toJsonString()); return SubMerchantMapper::create($rawResult)->jsonDecode()->mapSubMerchant(new SubMerchant()); } public static function update(UpdateSubMerchantRequest $request, Options $options) { - $rawResult = parent::httpClient()->put($options->getBaseUrl() . "/onboarding/submerchant", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $rawResult = parent::httpClient()->put($options->getBaseUrl() . self::URL, parent::getHttpHeadersV2(self::URL, $request, $options), $request->toJsonString()); return SubMerchantMapper::create($rawResult)->jsonDecode()->mapSubMerchant(new SubMerchant()); } public static function retrieve(RetrieveSubMerchantRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/onboarding/submerchant/detail", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = self::URL . "/detail"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return SubMerchantMapper::create($rawResult)->jsonDecode()->mapSubMerchant(new SubMerchant()); } diff --git a/src/Iyzipay/Model/SubMerchantPaymentItemUpdate.php b/src/Iyzipay/Model/SubMerchantPaymentItemUpdate.php index ceaf6363..7421c615 100644 --- a/src/Iyzipay/Model/SubMerchantPaymentItemUpdate.php +++ b/src/Iyzipay/Model/SubMerchantPaymentItemUpdate.php @@ -10,7 +10,8 @@ class SubMerchantPaymentItemUpdate extends SubMerchantPaymentItemResource { public static function create(SubMerchantPaymentItemUpdateRequest $request, Options $options) { - $rawResult = parent::httpClient()->put($options->getBaseUrl() . "/payment/item", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $url = "/payment/item"; + $rawResult = parent::httpClient()->put($options->getBaseUrl() . $url, parent::getHttpHeadersV2($url, $request, $options), $request->toJsonString()); return SubMerchantPaymentItemMapper::create($rawResult)->jsonDecode()->mapSubMerchantPaymentItem(new SubMerchantPaymentItemUpdate()); } } \ No newline at end of file diff --git a/src/Iyzipay/Model/Subscription/RetrieveList.php b/src/Iyzipay/Model/Subscription/RetrieveList.php index af9f871b..ce592874 100644 --- a/src/Iyzipay/Model/Subscription/RetrieveList.php +++ b/src/Iyzipay/Model/Subscription/RetrieveList.php @@ -22,30 +22,30 @@ 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::getHttpHeadersV2($uri, null, $options), $request->toJsonString()); + $uri = $options->getBaseUrl() . "/v2/subscription/products" . RequestStringBuilder::requestToStringQuery($request, 'subscriptionItems'); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString()); 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::getHttpHeadersV2($uri, null, $options), $request->toJsonString()); + $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()); 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::getHttpHeadersV2($uri, null, $options), $request->toJsonString()); + $uri = $options->getBaseUrl() . "/v2/subscription/customers" . RequestStringBuilder::requestToStringQuery($request, 'subscriptionItems'); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString()); return RetrieveListMapper::create($rawResult)->jsonDecode()->mapRetrieveList(new RetrieveList()); } public static function subscriptions(SubscriptionSearchRequest $request, Options $options) { - $uri = $options->getBaseUrl() . "/v2/subscription/subscriptions".RequestStringBuilder::requestToStringQuery($request, 'searchSubscription'); - $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options), $request->toJsonString()); + $uri = $options->getBaseUrl() . "/v2/subscription/subscriptions" . RequestStringBuilder::requestToStringQuery($request, 'searchSubscription'); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString()); return RetrieveListMapper::create($rawResult)->jsonDecode()->mapRetrieveList(new RetrieveList()); } diff --git a/src/Iyzipay/Model/Subscription/SubscriptionDeleteCustomer.php b/src/Iyzipay/Model/Subscription/SubscriptionDeleteCustomer.php new file mode 100644 index 00000000..9af701d0 --- /dev/null +++ b/src/Iyzipay/Model/Subscription/SubscriptionDeleteCustomer.php @@ -0,0 +1,27 @@ +getBaseUrl() . '/v2/subscription/customers/delete/' . $request->getCustomerReferenceCode() . RequestStringBuilder::requestToStringQuery($request);; + $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersV2($uri, null, $options), null); + return SubscriptionDeleteCustomerMapper::create($rawResult)->jsonDecode()->mapSubscriptionDeleteCustomer(new SubscriptionDeleteCustomer()); + } + + public function getCustomerReferenceCode(): string { + return $this->customerReferenceCode; + } + + public function setCustomerReferenceCode(string $customerReferenceCode): void { + $this->customerReferenceCode = $customerReferenceCode; + } +} diff --git a/src/Iyzipay/Model/Subscription/SubscriptionList.php b/src/Iyzipay/Model/Subscription/SubscriptionList.php new file mode 100644 index 00000000..a42b62c5 --- /dev/null +++ b/src/Iyzipay/Model/Subscription/SubscriptionList.php @@ -0,0 +1,101 @@ +getBaseUrl() . '/v2/subscription/subscriptions' . RequestStringBuilder::requestToStringQuery($request, 'searchSubscription'); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersV2($uri, null, $options)); + return SubscriptionListMapper::create($rawResult)->jsonDecode()->mapSubscriptionList(new SubscriptionList()); + } + + public function getSubscriptionReferenceCode(): string { + return $this->subscriptionReferenceCode; + } + + public function setSubscriptionReferenceCode(string $subscriptionReferenceCode): void { + $this->subscriptionReferenceCode = $subscriptionReferenceCode; + } + + public function getSubscriptionStatus(): string { + return $this->subscriptionStatus; + } + + public function setSubscriptionStatus(string $subscriptionStatus): void { + $this->subscriptionStatus = $subscriptionStatus; + } + + public function getPage(): int { + return $this->page; + } + + public function setPage(int $page): void { + $this->page = $page; + } + + public function getCount(): int { + return $this->count; + } + + public function setCount(int $count): void { + $this->count = $count; + } + +// + public function getCustomerReferenceCode(): string { + return $this->customerReferenceCode; + } + + public function setCustomerReferenceCode(string $customerReferenceCode): void { + $this->customerReferenceCode = $customerReferenceCode; + } + + public function getParentReferenceCode(): string { + return $this->parentReferenceCode; + } + + public function setParentReferenceCode(string $parentReferenceCode): void { + $this->parentReferenceCode = $parentReferenceCode; + } + + public function getStartDate(): string { + return $this->startDate; + } + + public function setStartDate(string $startDate): void { + $this->startDate = urlencode($startDate); + } + + public function getEndDate(): string { + return $this->endDate; + } + + public function setEndDate(string $endDate): void { + $this->endDate = urlencode($endDate); + } + + + public function getPricingPlanReferenceCode(): string { + return $this->pricingPlanReferenceCode; + } + + public function setPricingPlanReferenceCode(string $pricingPlanReferenceCode): void { + $this->pricingPlanReferenceCode = $pricingPlanReferenceCode; + } +} diff --git a/src/Iyzipay/Model/Subscription/SubscriptionProduct.php b/src/Iyzipay/Model/Subscription/SubscriptionProduct.php index 546b0b44..63fc2e6f 100644 --- a/src/Iyzipay/Model/Subscription/SubscriptionProduct.php +++ b/src/Iyzipay/Model/Subscription/SubscriptionProduct.php @@ -24,27 +24,27 @@ class SubscriptionProduct extends IyzipayResource public static function create(SubscriptionCreateProductRequest $request, Options $options) { $uri = $options->getBaseUrl() . "/v2/subscription/products"; - $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); + $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersIsV2($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::getHttpHeadersV2($uri, null, $options), $request->toJsonString()); + $uri = $options->getBaseUrl() . "/v2/subscription/products/" . $request->getProductReferenceCode() . RequestStringBuilder::requestToStringQuery($request, 'defaultParams'); + $rawResult = parent::httpClient()->getV2($uri, parent::getHttpHeadersIsV2($uri, null, $options), $request->toJsonString()); 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::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); + $uri = $options->getBaseUrl() . "/v2/subscription/products/" . $request->getProductReferenceCode(); + $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersIsV2($uri, $request, $options), $request->toJsonString()); return SubscriptionProductMapper::create($rawResult)->jsonDecode()->mapSubscriptionProduct(new SubscriptionProduct()); } public static function delete(SubscriptionDeleteProductRequest $request, $options) { - $uri = $options->getBaseUrl() . "/v2/subscription/products/".$request->getProductReferenceCode().RequestStringBuilder::requestToStringQuery($request, 'defaultParams'); + $uri = $options->getBaseUrl() . "/v2/subscription/products/" . $request->getProductReferenceCode() . RequestStringBuilder::requestToStringQuery($request, 'defaultParams'); $rawResult = parent::httpClient()->delete($uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return SubscriptionProductMapper::create($rawResult)->jsonDecode()->mapSubscriptionProduct(new SubscriptionProduct()); } diff --git a/src/Iyzipay/Model/ThreedsInitialize.php b/src/Iyzipay/Model/ThreedsInitialize.php index dca38531..a8aa0d08 100644 --- a/src/Iyzipay/Model/ThreedsInitialize.php +++ b/src/Iyzipay/Model/ThreedsInitialize.php @@ -10,10 +10,14 @@ class ThreedsInitialize extends IyzipayResource { private $htmlContent; + private $paymentId; + private $conversationId; + private $signature; public static function create(CreatePaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/3dsecure/initialize", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/3dsecure/initialize"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return ThreedsInitializeMapper::create($rawResult)->jsonDecode()->mapThreedsInitialize(new ThreedsInitialize()); } @@ -26,4 +30,34 @@ public function setHtmlContent($htmlContent) { $this->htmlContent = $htmlContent; } + + public function getConversationId() + { + return $this->conversationId; + } + + public function setConversationId($conversationId) + { + $this->conversationId = $conversationId; + } + + public function getPaymentId() + { + return $this->paymentId; + } + + public function setPaymentId($paymentId) + { + $this->paymentId = $paymentId; + } + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + $this->signature = $signature; + } } diff --git a/src/Iyzipay/Model/ThreedsInitializePreAuth.php b/src/Iyzipay/Model/ThreedsInitializePreAuth.php index c90321ba..a0ce3da6 100644 --- a/src/Iyzipay/Model/ThreedsInitializePreAuth.php +++ b/src/Iyzipay/Model/ThreedsInitializePreAuth.php @@ -10,10 +10,12 @@ class ThreedsInitializePreAuth extends IyzipayResource { private $htmlContent; + private $paymentId; public static function create(CreatePaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/3dsecure/initialize/preauth", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/3dsecure/initialize/preauth"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return ThreedsInitializePreAuthMapper::create($rawResult)->jsonDecode()->mapThreedsInitializePreAuth(new ThreedsInitializePreAuth()); } @@ -26,4 +28,25 @@ public function setHtmlContent($htmlContent) { $this->htmlContent = $htmlContent; } + + public function getPaymentId() + { + return $this->paymentId; + } + + public function setPaymentId($paymentId) + { + $this->paymentId = $paymentId; + } + private $signature; + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + $this->signature = $signature; + } } diff --git a/src/Iyzipay/Model/ThreedsPayment.php b/src/Iyzipay/Model/ThreedsPayment.php index 11260c71..b8ee028d 100644 --- a/src/Iyzipay/Model/ThreedsPayment.php +++ b/src/Iyzipay/Model/ThreedsPayment.php @@ -9,15 +9,29 @@ class ThreedsPayment extends PaymentResource { + private $signature; + public static function create(CreateThreedsPaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/3dsecure/auth", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/3dsecure/auth"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return ThreedsPaymentMapper::create($rawResult)->jsonDecode()->mapThreedsPayment(new ThreedsPayment()); } public static function retrieve(RetrievePaymentRequest $request, Options $options) { - $rawResult = parent::httpClient()->post($options->getBaseUrl() . "/payment/detail", parent::getHttpHeaders($request, $options), $request->toJsonString()); + $uri = "/payment/detail"; + $rawResult = parent::httpClient()->post($options->getBaseUrl() . $uri, parent::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); return ThreedsPaymentMapper::create($rawResult)->jsonDecode()->mapThreedsPayment(new ThreedsPayment()); } + + public function getSignature() + { + return $this->signature; + } + + public function setSignature($signature) + { + $this->signature = $signature; + } } \ No newline at end of file diff --git a/src/Iyzipay/Model/UCSInitialize.php b/src/Iyzipay/Model/UCSInitialize.php index 00c65f8c..12928f43 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::getHttpHeadersV2($uri, $request, $options), $request->toJsonString()); + $rawResult = parent::httpClient()->post($uri, parent::getHttpHeadersIsV2($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/AmountBaseRefundRequest.php b/src/Iyzipay/Request/AmountBaseRefundRequest.php new file mode 100644 index 00000000..9ed96818 --- /dev/null +++ b/src/Iyzipay/Request/AmountBaseRefundRequest.php @@ -0,0 +1,53 @@ +paymentId; + } + + public function setPaymentId(string $paymentId): void { + $this->paymentId = $paymentId; + } + + public function getPrice(): float { + return $this->price; + } + + public function setPrice(float $price): void { + $this->price = $price; + } + + public function getIp(): string { + return $this->ip; + } + + public function setIp(string $ip): void { + $this->ip = $ip; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('paymentId', $this->getPaymentId()) + ->addPrice('price', $this->getPrice()) + ->add('ip', $this->getIp()) + ->getObject(); + } + + public function toPKIRequestString(): string { + return RequestStringBuilder::create() + ->append('paymentId', $this->getPaymentId()) + ->appendPrice('price', $this->getPrice()) + ->append('ip', $this->getIp()) + ->getRequestString(); + } +} diff --git a/src/Iyzipay/Request/CreateBlackListedCardRequest.php b/src/Iyzipay/Request/CreateBlackListedCardRequest.php new file mode 100644 index 00000000..04d242eb --- /dev/null +++ b/src/Iyzipay/Request/CreateBlackListedCardRequest.php @@ -0,0 +1,43 @@ +cardUserKey; + } + + public function setCardUserKey($cardUserKey): void { + $this->cardUserKey = $cardUserKey; + } + + public function getCardToken(): string { + return $this->cardToken; + } + + public function setCardToken($cardToken): void { + $this->cardToken = $cardToken; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add("cardToken", $this->getCardToken()) + ->add("cardUserKey", $this->getCardUserKey()) + ->getObject(); + } + + public function toPKIRequestString(): string { + return RequestStringBuilder::create() + ->appendSuper(parent::toPKIRequestString()) + ->append("cardToken", $this->getCardToken()) + ->append("cardUserKey", $this->getCardUserKey()) + ->getRequestString(); + } +} diff --git a/src/Iyzipay/Request/CreateC2CSubMerchantRequest.php b/src/Iyzipay/Request/CreateC2CSubMerchantRequest.php new file mode 100644 index 00000000..c621d651 --- /dev/null +++ b/src/Iyzipay/Request/CreateC2CSubMerchantRequest.php @@ -0,0 +1,109 @@ +name; + } + + public function setName(string $name): void { + $this->name = $name; + } + + public function getSurname(): string { + return $this->surname; + } + + public function setSurname(string $surname): void { + $this->surname = $surname; + } + + public function getEmail(): string { + return $this->email; + } + + public function setEmail(string $email): void { + $this->email = $email; + } + + public function getGsmNumber(): string { + return $this->gsmNumber; + } + + public function setGsmNumber(string $gsmNumber): void { + $this->gsmNumber = $gsmNumber; + } + + public function getTckNo(): string { + return $this->tckNo; + } + + public function setTckNo(string $tckNo): void { + $this->tckNo = $tckNo; + } + + public function getBirthDate(): string { + return $this->birthDate; + } + + public function setBirthDate(string $birthDate): void { + $this->birthDate = $birthDate; + } + + public function getAddress(): string { + return $this->address; + } + + public function setAddress(string $address): void { + $this->address = $address; + } + + public function getExternalId(): string { + return $this->externalId; + } + + public function setExternalId(string $externalId): void { + $this->externalId = $externalId; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('name', $this->getName()) + ->add('surname', $this->getSurname()) + ->add('email', $this->getEmail()) + ->add('gsmNumber', $this->getGsmNumber()) + ->add('tckNo', $this->getTckNo()) + ->add('birthDate', $this->getBirthDate()) + ->add('address', $this->getAddress()) + ->add('externalId', $this->getExternalId()) + ->getObject(); + } + + public function toPKIRequestString(): string { + return RequestStringBuilder::create() + ->appendSuper(parent::toPKIRequestString()) + ->append('name', $this->getName()) + ->append('surname', $this->getSurname()) + ->append('email', $this->getEmail()) + ->append('gsmNumber', $this->getGsmNumber()) + ->append('tckNo', $this->getTckNo()) + ->append('birthDate', $this->getBirthDate()) + ->append('address', $this->getAddress()) + ->append('externalId', $this->getExternalId()) + ->getRequestString(); + } +} diff --git a/src/Iyzipay/Request/CreatePlusInstallmentPaymentRequest.php b/src/Iyzipay/Request/CreatePlusInstallmentPaymentRequest.php new file mode 100644 index 00000000..0873969a --- /dev/null +++ b/src/Iyzipay/Request/CreatePlusInstallmentPaymentRequest.php @@ -0,0 +1,180 @@ +price; + } + + public function setPrice(float $price): void { + $this->price = $price; + } + + public function getPaidPrice(): float { + return $this->paidPrice; + } + + public function setPaidPrice(float $paidPrice): void { + $this->paidPrice = $paidPrice; + } + + public function getCurrency(): string { + return $this->currency; + } + + public function setCurrency(string $currency): void { + $this->currency = $currency; + } + + public function getInstallment(): int { + return $this->installment; + } + + public function setInstallment(int $installment): void { + $this->installment = $installment; + } + + public function getPaymentChannel(): string { + return $this->paymentChannel; + } + + public function setPaymentChannel(string $paymentChannel): void { + $this->paymentChannel = $paymentChannel; + } + + public function getBasketId(): string { + return $this->basketId; + } + + public function setBasketId(string $basketId): void { + $this->basketId = $basketId; + } + + public function getPaymentGroup(): string { + return $this->paymentGroup; + } + + public function setPaymentGroup(string $paymentGroup): void { + $this->paymentGroup = $paymentGroup; + } + + public function getConnectorName(): string { + return $this->connectorName; + } + + public function setConnectorName(string $connectorName): void { + $this->connectorName = $connectorName; + } + + public function getPlusInstallmentUsage(): int { + return $this->plusInstallmentUsage; + } + + public function setPlusInstallmentUsage(int $plusInstallmentUsage): void { + $this->plusInstallmentUsage = $plusInstallmentUsage; + } + + public function getPaymentCard(): PaymentCard { + return $this->paymentCard; + } + + public function setPaymentCard(PaymentCard $paymentCard): void { + $this->paymentCard = $paymentCard; + } + + public function getBuyer(): Buyer { + return $this->buyer; + } + + public function setBuyer(Buyer $buyer): void { + $this->buyer = $buyer; + } + + public function getShippingAddress(): Address { + return $this->shippingAddress; + } + + public function setShippingAddress(Address $shippingAddress): void { + $this->shippingAddress = $shippingAddress; + } + + public function getBillingAddress(): Address { + return $this->billingAddress; + } + + public function setBillingAddress(Address $billingAddress): void { + $this->billingAddress = $billingAddress; + } + + public function getBasketItems(): array { + return $this->basketItems; + } + + public function setBasketItems(array $basketItems): void { + $this->basketItems = $basketItems; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->addPrice('price', $this->getPrice()) + ->addPrice('paidPrice', $this->getPaidPrice()) +// ->add('currency', $this->getCurrency()) + ->add('installment', $this->getInstallment()) + ->add('paymentChannel', $this->getPaymentChannel()) + ->add('basketId', $this->getBasketId()) + ->add('paymentGroup', $this->getPaymentGroup()) +// ->add('connectorName', $this->getConnectorName()) +// ->add('plusInstallmentUsage', $this->getPlusInstallmentUsage()) + ->add('paymentCard', $this->getPaymentCard()) + ->add('buyer', $this->getBuyer()) + ->add('shippingAddress', $this->getShippingAddress()) + ->add('billingAddress', $this->getBillingAddress()) + ->addArray('basketItems', $this->getBasketItems()) + ->add('currency', $this->getCurrency()) + ->getObject(); + } + + public function toPKIRequestString(): string { + return RequestStringBuilder::create() + ->appendSuper(parent::toPKIRequestString()) + ->appendPrice('price', $this->getPrice()) + ->appendPrice('paidPrice', $this->getPaidPrice()) +// ->append('currency', $this->getCurrency()) + ->append('installment', $this->getInstallment()) + ->append('paymentChannel', $this->getPaymentChannel()) + ->append('basketId', $this->getBasketId()) + ->append('paymentGroup', $this->getPaymentGroup()) +// ->append('connectorName', $this->getConnectorName()) +// ->append('plusInstallmentUsage', $this->getPlusInstallmentUsage()) + ->append('paymentCard', $this->getPaymentCard()) + ->append('buyer', $this->getBuyer()) + ->append('shippingAddress', $this->getShippingAddress()) + ->append('billingAddress', $this->getBillingAddress()) + ->appendArray('basketItems', $this->getBasketItems()) + ->append('currency', $this->getCurrency()) + ->getRequestString(); + } +} \ No newline at end of file diff --git a/src/Iyzipay/Request/Iyzilink/IyziLinkCreateFastLinkRequest.php b/src/Iyzipay/Request/Iyzilink/IyziLinkCreateFastLinkRequest.php new file mode 100644 index 00000000..084c2342 --- /dev/null +++ b/src/Iyzipay/Request/Iyzilink/IyziLinkCreateFastLinkRequest.php @@ -0,0 +1,54 @@ +description; + } + + public function setDescription(string $description): void { + $this->description = $description; + } + + public function getPrice() { + return $this->price; + } + + public function setPrice($price): void { + $this->price = $price; + } + + public function getCurrencyCode(): string { + return $this->currencyCode; + } + + public function setCurrencyCode(string $currencyCode): void { + $this->currencyCode = $currencyCode; + } + + public function getSourceType(): string { + return $this->sourceType; + } + + public function setSourceType(string $sourceType): void { + $this->sourceType = $sourceType; + } + + public function getJsonObject() { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('description', $this->getDescription()) + ->addPrice('price', $this->getPrice()) + ->add('currencyCode', $this->getCurrencyCode()) + ->add('sourceType', $this->getSourceType()) + ->getObject(); + } +} diff --git a/src/Iyzipay/Request/Iyzilink/IyziLinkSaveProductRequest.php b/src/Iyzipay/Request/Iyzilink/IyziLinkSaveProductRequest.php index 8c824ed7..e0d1b828 100644 --- a/src/Iyzipay/Request/Iyzilink/IyziLinkSaveProductRequest.php +++ b/src/Iyzipay/Request/Iyzilink/IyziLinkSaveProductRequest.php @@ -18,6 +18,9 @@ class IyziLinkSaveProductRequest extends Request private $token; private $url; private $imageUrl; + private $sourceType; + private $stockEnabled; + private $stockCount; public function getName() { @@ -129,6 +132,36 @@ public function setImageUrl($imageUrl) $this->imageUrl = $imageUrl; } + public function getSourceType() + { + return $this->sourceType; + } + + public function setSourceType($sourceType) + { + $this->sourceType = $sourceType; + } + + public function getStockEnabled() + { + return $this->stockEnabled; + } + + public function setStockEnabled($stockEnabled) + { + $this->stockEnabled = $stockEnabled; + } + + public function getStockCount() + { + return $this->stockCount; + } + + public function setStockCount($stockCount) + { + $this->stockCount = $stockCount; + } + public function getJsonObject() { return JsonBuilder::fromJsonObject(parent::getJsonObject()) @@ -143,6 +176,9 @@ public function getJsonObject() ->add("token", $this->getToken()) ->add("url", $this->getUrl()) ->add("imageUrl", $this->getImageUrl()) + ->add('sourceType', $this->getSourceType()) + ->add('stockEnabled', $this->getStockEnabled()) + ->add('stockCount', $this->getStockCount()) ->getObject(); } } \ No newline at end of file diff --git a/src/Iyzipay/Request/Iyzilink/IyziLinkSearchMerchantProductsRequest.php b/src/Iyzipay/Request/Iyzilink/IyziLinkSearchMerchantProductsRequest.php new file mode 100644 index 00000000..3d7ceb20 --- /dev/null +++ b/src/Iyzipay/Request/Iyzilink/IyziLinkSearchMerchantProductsRequest.php @@ -0,0 +1,43 @@ +page; + } + + public function setPage(int $page): void { + $this->page = $page; + } + + public function getCount(): int { + return $this->count; + } + + public function setCount(int $count): void { + $this->count = $count; + } + + public function getJsonObject() { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('page', $this->getPage()) + ->add('count', $this->getCount()) + ->getObject(); + } + + public function toPKIRequestString(): RequestStringBuilder { + return RequestStringBuilder::create() + ->appendSuper(parent::toPKIRequestString()) + ->append('page', $this->getPage()) + ->append('count', $this->getCount()) + ->getRequestString(); + } +} diff --git a/src/Iyzipay/Request/Iyzilink/IyziLinkUpdateProductStatusRequest.php b/src/Iyzipay/Request/Iyzilink/IyziLinkUpdateProductStatusRequest.php new file mode 100644 index 00000000..c97cebec --- /dev/null +++ b/src/Iyzipay/Request/Iyzilink/IyziLinkUpdateProductStatusRequest.php @@ -0,0 +1,34 @@ +token; + } + + public function setToken(string $token): void { + $this->token = $token; + } + + public function getProductStatus(): string { + return $this->productStatus; + } + + public function setProductStatus(string $productStatus): void { + $this->productStatus = $productStatus; + } + + public function getJsonObject() { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('token', $this->getToken()) + ->add('productStatus', $this->getProductStatus()) + ->getObject(); + } +} \ No newline at end of file diff --git a/src/Iyzipay/Request/ReportingPaymentDetailRequest.php b/src/Iyzipay/Request/ReportingPaymentDetailRequest.php index 2c238d02..957f3914 100644 --- a/src/Iyzipay/Request/ReportingPaymentDetailRequest.php +++ b/src/Iyzipay/Request/ReportingPaymentDetailRequest.php @@ -7,7 +7,8 @@ class ReportingPaymentDetailRequest extends Request { - private $paymentConversationId; + private $paymentConversationId = null; + private $paymentId = null; public function getPaymentConversationId() { @@ -19,10 +20,21 @@ public function setPaymentConversationId($paymentConversationId) $this->paymentConversationId = $paymentConversationId; } + public function getPaymentId() + { + return $this->paymentId; + } + + public function setPaymentId($paymentId) + { + $this->paymentId = $paymentId; + } + public function getJsonObject() { return JsonBuilder::fromJsonObject(parent::getJsonObject()) ->add("paymentConversationId", $this->getPaymentConversationId()) + ->add('paymentId', $this->getPaymentId()) ->getObject(); } } \ No newline at end of file diff --git a/src/Iyzipay/Request/ReportingScrollTransactionRequest.php b/src/Iyzipay/Request/ReportingScrollTransactionRequest.php new file mode 100644 index 00000000..e963cdc7 --- /dev/null +++ b/src/Iyzipay/Request/ReportingScrollTransactionRequest.php @@ -0,0 +1,44 @@ +documentScrollVoSortingOrder; + } + + public function setDocumentScrollVoSortingOrder(string $documentScrollVoSortingOrder): void { + $this->documentScrollVoSortingOrder = $documentScrollVoSortingOrder; + } + + public function getTransactionDate(): string { + return $this->transactionDate; + } + + public function setTransactionDate(string $transactionDate): void { + $this->transactionDate = $transactionDate; + } + + public function getLastId(): string { + return $this->lastId; + } + + public function setLastId(string $lastId): void { + $this->lastId = $lastId; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('documentScrollVoSortingOrder', $this->getDocumentScrollVoSortingOrder()) + ->add('transactionDate', $this->getTransactionDate()) + ->add('lastId', $this->getLastId()) + ->getObject(); + } +} diff --git a/src/Iyzipay/Request/RetrieveBlacklistedCardRequest.php b/src/Iyzipay/Request/RetrieveBlacklistedCardRequest.php new file mode 100644 index 00000000..efbebb70 --- /dev/null +++ b/src/Iyzipay/Request/RetrieveBlacklistedCardRequest.php @@ -0,0 +1,32 @@ +cardNumber; + } + + public function setCardNumber(string $cardNumber): void { + $this->cardNumber = $cardNumber; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add("cardNumber", $this->getCardNumber()) + ->getObject(); + } + + public function toPKIRequestString(): string { + return RequestStringBuilder::create() + ->appendSuper(parent::toPKIRequestString()) + ->append("cardNumber", $this->getCardNumber()) + ->getRequestString(); + } +} \ No newline at end of file diff --git a/src/Iyzipay/Request/Subscription/SubscriptionDeleteCustomerRequest.php b/src/Iyzipay/Request/Subscription/SubscriptionDeleteCustomerRequest.php new file mode 100644 index 00000000..78b01f07 --- /dev/null +++ b/src/Iyzipay/Request/Subscription/SubscriptionDeleteCustomerRequest.php @@ -0,0 +1,24 @@ +customerReferenceCode; + } + + public function setCustomerReferenceCode(string $customerReferenceCode): void { + $this->customerReferenceCode = $customerReferenceCode; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('customerReferenceCode', $this->getCustomerReferenceCode()) + ->getObject(); + } +} diff --git a/src/Iyzipay/Request/Subscription/SubscriptionListRequest.php b/src/Iyzipay/Request/Subscription/SubscriptionListRequest.php new file mode 100644 index 00000000..55faa3f3 --- /dev/null +++ b/src/Iyzipay/Request/Subscription/SubscriptionListRequest.php @@ -0,0 +1,104 @@ +subscriptionReferenceCode ?? null; + } + + public function setSubscriptionReferenceCode(string $subscriptionReferenceCode): void { + $this->subscriptionReferenceCode = $subscriptionReferenceCode; + } + + public function getSubscriptionStatus(): ?string { + return $this->subscriptionStatus ?? null; + } + + public function setSubscriptionStatus(string $subscriptionStatus): void { + $this->subscriptionStatus = $subscriptionStatus; + } + + public function getPage(): int { + return $this->page; + } + + public function setPage(int $page): void { + $this->page = $page; + } + + public function getCount(): int { + return $this->count; + } + + public function setCount(int $count): void { + $this->count = $count; + } + + public function getCustomerReferenceCode(): ?string { + return $this->customerReferenceCode ?? null; + } + + public function setCustomerReferenceCode(string $customerReferenceCode): void { + $this->customerReferenceCode = $customerReferenceCode; + } + + public function getParentReferenceCode(): ?string { + return $this->parentReferenceCode ?? null; + } + + public function setParentReferenceCode(string $parentReferenceCode): void { + $this->parentReferenceCode = $parentReferenceCode; + } + + public function getStartDate(): ?string { + return $this->startDate ?? null; + } + + public function setStartDate(string $startDate): void { + $this->startDate = urlencode($startDate); + } + + public function getEndDate(): ?string { + return $this->endDate ?? null; + } + + public function setEndDate(string $endDate): void { + $this->endDate = urlencode($endDate); + } + + public function getPricingPlanReferenceCode(): ?string { + return $this->pricingPlanReferenceCode ?? null; + } + + public function setPricingPlanReferenceCode(string $pricingPlanReferenceCode): void { + $this->pricingPlanReferenceCode = $pricingPlanReferenceCode; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('subscriptionReferenceCode', $this->getSubscriptionReferenceCode()) + ->add('subscriptionStatus', $this->getSubscriptionStatus()) + ->add('page', $this->getPage()) + ->add('count', $this->getCount()) + ->add('customerReferenceCode', $this->getCustomerReferenceCode()) + ->add('parentReferenceCode', $this->getParentReferenceCode()) + ->add('startDate', $this->getStartDate()) + ->add('endDate', $this->getEndDate()) + ->add('pricingPlanReferenceCode', $this->getPricingPlanReferenceCode()) + ->getObject(); + } +} diff --git a/src/Iyzipay/Request/UpdateBlackListedCardRequest.php b/src/Iyzipay/Request/UpdateBlackListedCardRequest.php new file mode 100644 index 00000000..45801c18 --- /dev/null +++ b/src/Iyzipay/Request/UpdateBlackListedCardRequest.php @@ -0,0 +1,43 @@ +cardUserKey; + } + + public function setCardUserKey($cardUserKey): void { + $this->cardUserKey = $cardUserKey; + } + + public function getCardToken(): string { + return $this->cardToken; + } + + public function setCardToken($cardToken): void { + $this->cardToken = $cardToken; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add("cardToken", $this->getCardToken()) + ->add("cardUserKey", $this->getCardUserKey()) + ->getObject(); + } + + public function toPKIRequestString(): string { + return RequestStringBuilder::create() + ->appendSuper(parent::toPKIRequestString()) + ->append("cardToken", $this->getCardToken()) + ->append("cardUserKey", $this->getCardUserKey()) + ->getRequestString(); + } +} diff --git a/src/Iyzipay/Request/VerifyC2CSubMerchantRequest.php b/src/Iyzipay/Request/VerifyC2CSubMerchantRequest.php new file mode 100644 index 00000000..62d18c64 --- /dev/null +++ b/src/Iyzipay/Request/VerifyC2CSubMerchantRequest.php @@ -0,0 +1,43 @@ +txId; + } + + public function setTxId(string $txId): void { + $this->txId = $txId; + } + + public function getSmsVerificationCode(): string { + return $this->smsVerificationCode; + } + + public function setSmsVerificationCode(string $smsVerificationCode): void { + $this->smsVerificationCode = $smsVerificationCode; + } + + public function getJsonObject(): array { + return JsonBuilder::fromJsonObject(parent::getJsonObject()) + ->add('txId', $this->getTxId()) + ->add('smsVerificationCode', $this->getSmsVerificationCode()) + ->getObject(); + } + + public function toPKIRequestString(): string { + return RequestStringBuilder::create() + ->appendSuper(parent::toPKIRequestString()) + ->append('txId', $this->getTxId()) + ->append('smsVerificationCode', $this->getSmsVerificationCode()) + ->getRequestString(); + } +} \ No newline at end of file diff --git a/src/Iyzipay/RequestStringBuilder.php b/src/Iyzipay/RequestStringBuilder.php index 13682a77..3849beb5 100644 --- a/src/Iyzipay/RequestStringBuilder.php +++ b/src/Iyzipay/RequestStringBuilder.php @@ -139,7 +139,6 @@ public function getRequestString() public static function requestToStringQuery(Request $request, $type = null) { - $stringQuery = false; if($request->getConversationId()) { @@ -150,6 +149,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(); @@ -175,6 +178,20 @@ public static function requestToStringQuery(Request $request, $type = null) } } + if($type == 'reportingScrollTransaction') { + if($request->getDocumentScrollVoSortingOrder()) { + $stringQuery = '?documentScrollVoSortingOrder=' . $request->getDocumentScrollVoSortingOrder(); + } + + if($request->getTransactionDate()) { + $stringQuery .= "&transactionDate=" . $request->getTransactionDate(); + } + + if($request->getLastId()) { + $stringQuery .= '&lastId=' . $request->getLastId(); + } + } + if($type == 'subscriptionItems' ) { if ($request->getPage()) { $stringQuery = "?page=" . $request->getPage(); diff --git a/tests/Iyzipay/Tests/ApiResourceTest.php b/tests/Iyzipay/Tests/ApiResourceTest.php index fceea8f4..7a406564 100644 --- a/tests/Iyzipay/Tests/ApiResourceTest.php +++ b/tests/Iyzipay/Tests/ApiResourceTest.php @@ -5,7 +5,7 @@ use Iyzipay\ApiResource; use Iyzipay\DefaultHttpClient; -class ApiResourceTest extends \PHPUnit_Framework_TestCase +class ApiResourceTest extends TestCase { public function test_should_create_default_http_client() { diff --git a/tests/Iyzipay/Tests/CurlTest.php b/tests/Iyzipay/Tests/CurlTest.php index c7a65869..ecddb88a 100644 --- a/tests/Iyzipay/Tests/CurlTest.php +++ b/tests/Iyzipay/Tests/CurlTest.php @@ -4,7 +4,7 @@ use Iyzipay\Curl; -class CurlTest extends \PHPUnit_Framework_TestCase +class CurlTest extends TestCase { public function test_should_exec_curl() { @@ -13,7 +13,8 @@ public function test_should_exec_curl() CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_RETURNTRANSFER => true, CURLOPT_VERBOSE => false, - CURLOPT_HEADER => false)); + CURLOPT_HEADER => false + )); $this->assertNotNull($ret); $this->assertFalse($ret); diff --git a/tests/Iyzipay/Tests/DefaultHttpClientTest.php b/tests/Iyzipay/Tests/DefaultHttpClientTest.php index 72ccde38..2a51bba1 100644 --- a/tests/Iyzipay/Tests/DefaultHttpClientTest.php +++ b/tests/Iyzipay/Tests/DefaultHttpClientTest.php @@ -4,11 +4,11 @@ use Iyzipay\DefaultHttpClient; -class DefaultHttpClientTest extends \PHPUnit_Framework_TestCase +class DefaultHttpClientTest extends TestCase { private $curl; - public function setUp() + public function setUp(): void { $this->curl = $this->getMockBuilder("Curl") ->setMethods(array("exec")) @@ -47,7 +47,7 @@ public function test_should_make_http_getV2() )) ->willReturn("result"); - $result = DefaultHttpClient::create($this->curl)->getV2("url","header"); + $result = DefaultHttpClient::create($this->curl)->getV2("url", "header"); $this->assertEquals("result", $result); } diff --git a/tests/Iyzipay/Tests/FileBase64Encoder.php b/tests/Iyzipay/Tests/FileBase64EncoderTest.php similarity index 68% rename from tests/Iyzipay/Tests/FileBase64Encoder.php rename to tests/Iyzipay/Tests/FileBase64EncoderTest.php index 340ff170..50e0d195 100644 --- a/tests/Iyzipay/Tests/FileBase64Encoder.php +++ b/tests/Iyzipay/Tests/FileBase64EncoderTest.php @@ -4,13 +4,13 @@ use Iyzipay\FileBase64Encoder; -class FileBase64EncoderTest extends \PHPUnit_Framework_TestCase +class FileBase64EncoderTest extends TestCase { public function test_should_base64file_helper() { $imagePath = __DIR__ . '/images/sample_image.jpg'; $base64FileHelper = new FileBase64Encoder(); - $encodedImage = $base64FileHelper->encode($imagePath); + $encodedImage = $base64FileHelper->encode($imagePath); $this->assertNotNull($encodedImage); diff --git a/tests/Iyzipay/Tests/IyzipayResourceTestCase.php b/tests/Iyzipay/Tests/IyzipayResourceTestCase.php index f3bca767..47cd246e 100644 --- a/tests/Iyzipay/Tests/IyzipayResourceTestCase.php +++ b/tests/Iyzipay/Tests/IyzipayResourceTestCase.php @@ -21,12 +21,12 @@ class IyzipayResourceTestCase extends TestCase "conversationId":"123456" }'; - public function setUp() + public function setUp(): void { parent::setUp(); $this->httpClient = $this->getMockBuilder("HttpClient") - ->setMethods(array("get", "getV2","post", "put", "delete", "exchange")) + ->setMethods(array("get", "getV2","post", "put", "patch", "delete", "exchange")) ->getMock(); ApiResource::setHttpClient($this->httpClient); @@ -60,6 +60,11 @@ protected function expectHttpPut() $this->expectHttpClient("put"); } + protected function expectHttpPatch() + { + $this->expectHttpClient("patch"); + } + protected function expectHttpDelete() { $this->expectHttpClient("delete"); @@ -67,20 +72,26 @@ protected function expectHttpDelete() protected function verifyResource(IyzipayResource $resource) { + $status = $resource->getStatus() ? $resource->getStatus() : 'success'; + $locale = $resource->getLocale() ? $resource->getLocale() : 'tr'; + $systemTime = $resource->getSystemTime() ? $resource->getSystemTime() : '1458545234852'; + $conversationId = $resource->getConversationId() ? $resource->getConversationId() : '123456'; + $rowResult = $resource->getRawResult() ? $resource->getRawResult() : ''; + $this->assertNotEmpty($resource); - $this->assertEquals(Status::SUCCESS, $resource->getStatus()); + $this->assertEquals(Status::SUCCESS, $status); $this->assertEmpty($resource->getErrorCode()); $this->assertEmpty($resource->getErrorMessage()); $this->assertEmpty($resource->getErrorGroup()); - $this->assertEquals(Locale::TR, $resource->getLocale()); - $this->assertEquals("1458545234852", $resource->getSystemTime()); - $this->assertEquals("123456", $resource->getConversationId()); - $this->assertJson($resource->getRawResult()); - $this->assertJsonStringEqualsJsonString($this->json, $resource->getRawResult()); + $this->assertEquals(Locale::TR, $locale); + $this->assertEquals("1458545234852", $systemTime); + $this->assertEquals("123456", $conversationId); + $rowResult && $this->assertJson($rowResult); + $rowResult && $this->assertJsonStringEqualsJsonString($this->json, $rowResult); } public function test_should_check_http_client_not_empty() { $this->assertNotEmpty($this->httpClient); } -} \ No newline at end of file +} diff --git a/tests/Iyzipay/Tests/Model/AmountBaseRefundTest.php b/tests/Iyzipay/Tests/Model/AmountBaseRefundTest.php new file mode 100644 index 00000000..1a662314 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/AmountBaseRefundTest.php @@ -0,0 +1,15 @@ +expectHttpPost(); + $amountBaseRefund = AmountBaseRefund::create(new AmountBaseRefundRequest(), $this->options); + $this->verifyResource($amountBaseRefund); + } +} diff --git a/tests/Iyzipay/Tests/Model/BlacklistedCardTest.php b/tests/Iyzipay/Tests/Model/BlacklistedCardTest.php new file mode 100644 index 00000000..9dcbd0c8 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/BlacklistedCardTest.php @@ -0,0 +1,29 @@ +expectHttpPost(); + $blacklistedCard = BlacklistedCard::create(new CreateBlackListedCardRequest(), $this->options); + $this->verifyResource($blacklistedCard); + } + + public function test_should_retrieve_blacklisted_card() { + $this->expectHttpPost(); + $blacklistedCard = BlacklistedCard::retrieve(new RetrieveBlacklistedCardRequest(), $this->options); + $this->verifyResource($blacklistedCard); + } + + public function test_should_update_blacklisted_card() { + $this->expectHttpPost(); + $blacklistedCard = BlacklistedCard::update(new UpdateBlackListedCardRequest(), $this->options); + $this->verifyResource($blacklistedCard); + } +} diff --git a/tests/Iyzipay/Tests/Model/C2CSubMerchantTest.php b/tests/Iyzipay/Tests/Model/C2CSubMerchantTest.php new file mode 100644 index 00000000..43fb5b65 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/C2CSubMerchantTest.php @@ -0,0 +1,47 @@ +expectHttpPost(); + $c2cSubMerchant = C2CSubMerchant::create($this->prepareCreateRequest(), $this->options); + $this->verifyResource($c2cSubMerchant); + } + + public function testShouldVerifyC2CSubMerchant(): void { + $this->expectHttpPost(); + $c2cSubMerchant = C2CSubMerchant::verify($this->prepareVerifyRequest(), $this->options); + $this->verifyResource($c2cSubMerchant); + } + + private function prepareCreateRequest(): CreateC2CSubMerchantRequest { + $request = new CreateC2CSubMerchantRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId('299487456'); + $request->setName('John'); + $request->setSurname('Doe'); + $request->setEmail('john@doe.com'); + $request->setGsmNumber('+905558001479'); + $request->setTckNo('55555555555'); + $request->setBirthDate('1996-10-07'); + $request->setAddress('Besiktas / Istanbul'); + $request->setExternalId('ccd74b86-e4a8-469e-b3d3-312f0544ea6e'); + return $request; + } + + private function prepareVerifyRequest(): VerifyC2CSubMerchantRequest { + $request = new VerifyC2CSubMerchantRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId('422117402'); + $request->setTxId('4973f734-e946-40dc-b3a9-34e0efb330d5'); + $request->setSmsVerificationCode('HZ87equxm70klGxX1nZX7A=='); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkCreateFastLinkTest.php b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkCreateFastLinkTest.php new file mode 100644 index 00000000..e2a476cd --- /dev/null +++ b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkCreateFastLinkTest.php @@ -0,0 +1,23 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId("123456789"); + $request->setDescription("ft-description-fast-link"); + $request->setPrice(10); + $request->setCurrencyCode("TRY"); + $request->setSourceType("WEB"); + + $this->expectHttpPost(); + $fastLink = IyziLinkFastLink::create($request, $this->options); + $this->verifyResource($fastLink); + } +} diff --git a/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkSearchMerchantProductsTest.php b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkSearchMerchantProductsTest.php new file mode 100644 index 00000000..4d5e0a55 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkSearchMerchantProductsTest.php @@ -0,0 +1,21 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId('123456'); + $request->setPage(1); + $request->setCount(10); + + $this->expectHttpGetV2(); + $iyziLinkSearchMerchantProducts = IyziLinkSearchMerchantProducts::create($request, $this->options); + $this->verifyResource($iyziLinkSearchMerchantProducts); + } +} diff --git a/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php new file mode 100644 index 00000000..57aa0f50 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/Iyzilink/IyziLinkUpdateProductStatusTest.php @@ -0,0 +1,21 @@ +setLocale(\Iyzipay\Model\Locale::TR); + $request->setToken('AAM'); + $request->setProductStatus(Status::PASSIVE); + + $this->expectHttpPatch(); + $iyziLinkUpdateProductStatus = IyziLinkUpdateProductStatus::create($request, $this->options); + $this->verifyResource($iyziLinkUpdateProductStatus); + } +} diff --git a/tests/Iyzipay/Tests/Model/Mapper/BlacklistedCardMapperTest.php b/tests/Iyzipay/Tests/Model/Mapper/BlacklistedCardMapperTest.php new file mode 100644 index 00000000..d67a95e8 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/Mapper/BlacklistedCardMapperTest.php @@ -0,0 +1,43 @@ +retrieveJsonFile('blacklisted-card.json'); + + $blacklistedCard = BlacklistedCardMapper::create($json)->jsonDecode()->mapBlacklistedCard(new BlacklistedCard()); + + $this->assertNotEmpty($blacklistedCard); + $this->assertEquals(Status::FAILURE, $blacklistedCard->getStatus()); + $this->assertEquals("123456", $blacklistedCard->getConversationId()); + $this->assertEquals("10000", $blacklistedCard->getErrorCode()); + $this->assertEquals("error message", $blacklistedCard->getErrorMessage()); + $this->assertEquals("ERROR_GROUP", $blacklistedCard->getErrorGroup()); + $this->assertEquals(Locale::TR, $blacklistedCard->getLocale()); + $this->assertEquals("1458545234852", $blacklistedCard->getSystemTime()); + $this->assertEquals("cardUserKey", $blacklistedCard->getCardUserKey()); + $this->assertEquals("cardToken", $blacklistedCard->getCardToken()); + } + + public function test_should_map_retrieve_blacklisted_card() { + $json = $this->retrieveJsonFile('retrieve-blacklisted-card.json'); + + $blacklistedCard = BlacklistedCardMapper::create($json)->jsonDecode()->mapRetrieveBlacklistedCard(new BlacklistedCard()); + + $this->assertEquals(Status::FAILURE, $blacklistedCard->getStatus()); + $this->assertEquals("123456", $blacklistedCard->getConversationId()); + $this->assertEquals("10000", $blacklistedCard->getErrorCode()); + $this->assertEquals("error message", $blacklistedCard->getErrorMessage()); + $this->assertEquals("ERROR_GROUP", $blacklistedCard->getErrorGroup()); + $this->assertEquals(Locale::TR, $blacklistedCard->getLocale()); + $this->assertEquals("1458545234852", $blacklistedCard->getSystemTime()); + $this->assertEquals("cardNumber", $blacklistedCard->getCardNumber()); + } +} diff --git a/tests/Iyzipay/Tests/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapperTest.php b/tests/Iyzipay/Tests/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapperTest.php new file mode 100644 index 00000000..28dea879 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/Mapper/Iyzilink/IyziLinkUpdateProductStatusMapperTest.php @@ -0,0 +1,21 @@ +retrieveJsonFile("iyzilink-update-product-status.json"); + $iyziLinkUpdateProductStatus = IyziLinkUpdateProductStatusMapper::create($json)->jsonDecode()->mapIyziLinkUpdateProductStatus(new IyziLinkUpdateProductStatus()); + + $this->assertNotEmpty($iyziLinkUpdateProductStatus); + $this->assertEquals(Status::SUCCESS, $iyziLinkUpdateProductStatus->getStatus()); + $this->assertEquals(Locale::TR, $iyziLinkUpdateProductStatus->getLocale()); + $this->assertEquals(1710349430773, $iyziLinkUpdateProductStatus->getSystemTime()); + } +} diff --git a/tests/Iyzipay/Tests/Model/PlusInstallmentPaymentTest.php b/tests/Iyzipay/Tests/Model/PlusInstallmentPaymentTest.php new file mode 100644 index 00000000..851ae5e7 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/PlusInstallmentPaymentTest.php @@ -0,0 +1,102 @@ +expectHttpPost(); + + $request = new CreatePlusInstallmentPaymentRequest(); + $request->setLocale(\Iyzipay\Model\Locale::TR); + $request->setConversationId("123456789"); + $request->setPrice(1); + $request->setPaidPrice(1.1); + $request->setCurrency('TRY'); + $request->setInstallment(1); + $request->setPaymentChannel(PaymentChannel::WEB); + $request->setBasketId('B67832'); + $request->setPaymentGroup(PaymentGroup::PRODUCT); + + $card = new PaymentCard(); + $card->setCardHolderName('John Doe'); + $card->setCardNumber('5528790000000008'); + $card->setExpireYear('2030'); + $card->setExpireMonth('12'); + $card->setCvc('123'); + $card->setRegisterCard(0); + $request->setPaymentCard($card); + + $buyer = new Buyer(); + $buyer->setId('BY789'); + $buyer->setName('John'); + $buyer->setSurname('Doe'); + $buyer->setIdentityNumber('74300864791'); + $buyer->setEmail('email@email.com'); + $buyer->setGsmNumber('+905350000000'); + $buyer->setRegistrationDate('2013-04-21 15:12:09'); + $buyer->setLastLoginDate('2015-10-05 12:43:35'); + $buyer->setRegistrationAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $buyer->setCity('Istanbul'); + $buyer->setCountry('Turkey'); + $buyer->setZipCode('34732'); + $buyer->setIp('85.34.78.112'); + $request->setBuyer($buyer); + + $shippingAddress = new Address(); + $shippingAddress->setAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $shippingAddress->setZipCode('34742'); + $shippingAddress->setContactName('Jane Doe'); + $shippingAddress->setCity('Istanbul'); + $shippingAddress->setCountry('Turkey'); + $request->setShippingAddress($shippingAddress); + + $billingAddress = new Address(); + $billingAddress->setAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $billingAddress->setZipCode('34742'); + $billingAddress->setContactName('Jane Doe'); + $billingAddress->setCity('Istanbul'); + $billingAddress->setCountry('Turkey'); + $request->setBillingAddress($billingAddress); + + $firstBasketItem = new BasketItem(); + $firstBasketItem->setId('BI101'); + $firstBasketItem->setPrice(0.3); + $firstBasketItem->setName('Binocular'); + $firstBasketItem->setCategory1('Collectibles'); + $firstBasketItem->setCategory2('Accessories'); + $firstBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); + + $secondBasketItem = new BasketItem(); + $secondBasketItem->setId('BI101'); + $secondBasketItem->setPrice(0.5); + $secondBasketItem->setName('Binocular'); + $secondBasketItem->setCategory1('Collectibles'); + $secondBasketItem->setCategory2('Accessories'); + $secondBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); + + $thirdBasketItem = new BasketItem(); + $thirdBasketItem->setId('BI101'); + $thirdBasketItem->setPrice(0.2); + $thirdBasketItem->setName('Binocular'); + $thirdBasketItem->setCategory1('Collectibles'); + $thirdBasketItem->setCategory2('Accessories'); + $thirdBasketItem->setItemType(\Iyzipay\Model\BasketItemType::PHYSICAL); + $request->setBasketItems([$firstBasketItem, $secondBasketItem, $thirdBasketItem]); + + $payment = PlusInstallmentPayment::create($request, $this->options); + $this->verifyResource($payment); + } +} diff --git a/tests/Iyzipay/Tests/Model/ReportingScrollTransactionTest.php b/tests/Iyzipay/Tests/Model/ReportingScrollTransactionTest.php new file mode 100644 index 00000000..e371cb37 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/ReportingScrollTransactionTest.php @@ -0,0 +1,22 @@ +setConversationId('1234567890'); + $request->setTransactionDate('2023-08-17'); + $request->setDocumentScrollVoSortingOrder('ASC'); + $request->setLastId('1689853839161'); + + $this->expectHttpGetV2(); + $transaction = ReportingScrollTransaction::create($request, $this->options); + $this->verifyResource($transaction); + } +} diff --git a/tests/Iyzipay/Tests/Model/Subscription/SubscriptionDeleteCustomerTest.php b/tests/Iyzipay/Tests/Model/Subscription/SubscriptionDeleteCustomerTest.php new file mode 100644 index 00000000..d2a4136d --- /dev/null +++ b/tests/Iyzipay/Tests/Model/Subscription/SubscriptionDeleteCustomerTest.php @@ -0,0 +1,18 @@ +setCustomerReferenceCode('566b2e1a-5046-4438-9b62-c8cf761f61d1'); + + $this->expectHttpPost(); + $customer = SubscriptionDeleteCustomer::delete($request, $this->options); + $this->verifyResource($customer); + } +} diff --git a/tests/Iyzipay/Tests/Model/Subscription/SubscriptionListTest.php b/tests/Iyzipay/Tests/Model/Subscription/SubscriptionListTest.php new file mode 100644 index 00000000..c51e33f7 --- /dev/null +++ b/tests/Iyzipay/Tests/Model/Subscription/SubscriptionListTest.php @@ -0,0 +1,26 @@ +setPage(1); + $request->setCount(10); + $request->setSubscriptionStatus(\Iyzipay\Model\Status::ACTIVE); + $request->setSubscriptionReferenceCode('c8ab43da-f4b3-40d2-b1ef-620da93ec3e9'); + $request->setCustomerReferenceCode('566b2e1a-5046-4438-9b62-c8cf761f61d1'); + $request->setPricingPlanReferenceCode('c1d489b6-9adc-42fa-88ae-47ea2e5dbe1e'); + $request->setParentReferenceCode('f219267d-ce05-4039-a773-225ea44aacd1'); + $request->setStartDate('2024-01-01'); + $request->setEndDate('2024-02-02'); + + $this->expectHttpGetV2(); + $list = SubscriptionList::create($request, $this->options); + $this->verifyResource($list); + } +} diff --git a/tests/Iyzipay/Tests/Request/AmountBaseRefundRequestTest.php b/tests/Iyzipay/Tests/Request/AmountBaseRefundRequestTest.php new file mode 100644 index 00000000..2163b18d --- /dev/null +++ b/tests/Iyzipay/Tests/Request/AmountBaseRefundRequestTest.php @@ -0,0 +1,73 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + +// $this->assertEquals(Locale::TR, $jsonObject['locale']); +// $this->assertEquals('123456789', $jsonObject['conversationId']); + $this->assertEquals('2921546163', $jsonObject['paymentId']); + $this->assertEquals('3.0', $jsonObject['price']); + $this->assertEquals('85.34.78.112', $jsonObject['ip']); + } + + public function testShouldConvertToPkiRequestString(): void { + $request = $this->prepareRequest(); + +// $str = '[' . +// 'locale=tr,' . +// 'conversationId=123456789,' . +// 'paymentId=2921546163,' . +// 'price-3,' . +// 'ip=85.34.78.112' . +// ']'; + + $str = '[' . + 'paymentId=2921546163,' . + 'price=3.0,' . + 'ip=85.34.78.112' . + ']'; + + $this->assertEquals($str, $request->toPKIRequestString()); + } + + public function testShouldGetJsonString(): void { + $request = $this->prepareRequest(); + +// $json = ' +// { +// "locale":"tr", +// "conversationId":"123456789", +// "paymentId":"2921546163", +// "price":3, +// "ip":"85.34.78.112" +// }'; + + $json = ' + { + "paymentId":"2921546163", + "price":"3.0", + "ip":"85.34.78.112" + }'; + + $this->assertJson($request->toJsonString()); + $this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); + } + + private function prepareRequest(): AmountBaseRefundRequest { + $request = new AmountBaseRefundRequest(); +// $request->setLocale(Locale::TR); +// $request->setConversationId('123456789'); + $request->setPaymentId('2921546163'); + $request->setPrice('3.0'); + $request->setIp('85.34.78.112'); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/CreateBasicBkmInitializeRequestTest.php b/tests/Iyzipay/Tests/Request/CreateBasicBkmInitializeRequestTest.php index 9c7e8a15..4b051967 100644 --- a/tests/Iyzipay/Tests/Request/CreateBasicBkmInitializeRequestTest.php +++ b/tests/Iyzipay/Tests/Request/CreateBasicBkmInitializeRequestTest.php @@ -17,7 +17,7 @@ public function test_should_get_json_object() $this->assertEquals(Locale::TR, $jsonObject["locale"]); $this->assertEquals("123456789", $jsonObject["conversationId"]); - $this->assertEquals("1", $jsonObject["price"]); + $this->assertEquals("1.0", $jsonObject["price"]); $this->assertEquals("https://www.merchant.com/callback", $jsonObject["callbackUrl"]); $this->assertEquals("100", $jsonObject["buyerId"]); $this->assertEquals("email@email.com", $jsonObject["buyerEmail"]); @@ -30,7 +30,7 @@ public function test_should_get_json_object() $this->assertNotEmpty($jsonObject["installmentDetails"][0]["installmentPrices"]); $this->assertEquals(5, count($jsonObject["installmentDetails"][0]["installmentPrices"])); $this->assertEquals("1", $jsonObject["installmentDetails"][0]["installmentPrices"][0]["installmentNumber"]); - $this->assertEquals("1", $jsonObject["installmentDetails"][0]["installmentPrices"][0]["totalPrice"]); + $this->assertEquals("1.0", $jsonObject["installmentDetails"][0]["installmentPrices"][0]["totalPrice"]); $this->assertEquals("2", $jsonObject["installmentDetails"][0]["installmentPrices"][1]["installmentNumber"]); $this->assertEquals("1.1", $jsonObject["installmentDetails"][0]["installmentPrices"][1]["totalPrice"]); $this->assertEquals("3", $jsonObject["installmentDetails"][0]["installmentPrices"][2]["installmentNumber"]); diff --git a/tests/Iyzipay/Tests/Request/CreateBasicPaymentRequestTest.php b/tests/Iyzipay/Tests/Request/CreateBasicPaymentRequestTest.php index 0304def4..4cd493aa 100644 --- a/tests/Iyzipay/Tests/Request/CreateBasicPaymentRequestTest.php +++ b/tests/Iyzipay/Tests/Request/CreateBasicPaymentRequestTest.php @@ -77,7 +77,7 @@ public function test_should_get_json_string() "conversationId":"123456789", "price":"1.0", "paidPrice":"1.0", - "installment":"1", + "installment":1, "buyerEmail":"email@email.com", "buyerId":"B2323", "buyerIp":"85.34.78.112", diff --git a/tests/Iyzipay/Tests/Request/CreateBlacklistedCardRequestTest.php b/tests/Iyzipay/Tests/Request/CreateBlacklistedCardRequestTest.php new file mode 100644 index 00000000..1a8629f2 --- /dev/null +++ b/tests/Iyzipay/Tests/Request/CreateBlacklistedCardRequestTest.php @@ -0,0 +1,55 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals("123456789", $jsonObject["conversationId"]); + $this->assertEquals("card user key", $jsonObject["cardUserKey"]); + $this->assertEquals("card token", $jsonObject["cardToken"]); + } + + public function test_should_convert_to_pki_request_string(): void { + $request = $this->prepareRequest(); + + $str = "[locale=tr," . + "conversationId=123456789," . + "cardToken=card token," . + "cardUserKey=card user key]"; +// "cardToken=card token]"; + + $this->assertEquals($str, $request->toPKIRequestString()); + } + + public function test_should_get_json_string(): void { + $request = $this->prepareRequest(); + + $json = ' + { + "locale":"tr", + "conversationId":"123456789", + "cardToken":"card token", + "cardUserKey":"card user key" + }'; + + $this->assertJson($request->toJsonString()); + $this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); + } + + private function prepareRequest(): CreateBlackListedCardRequest { + $request = new CreateBlackListedCardRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId("123456789"); + $request->setCardUserKey("card user key"); + $request->setCardToken("card token"); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/CreateC2CSubMerchantRequestTest.php b/tests/Iyzipay/Tests/Request/CreateC2CSubMerchantRequestTest.php new file mode 100644 index 00000000..3b4d279f --- /dev/null +++ b/tests/Iyzipay/Tests/Request/CreateC2CSubMerchantRequestTest.php @@ -0,0 +1,79 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals("299487456", $jsonObject["conversationId"]); + $this->assertEquals("John", $jsonObject["name"]); + $this->assertEquals("Doe", $jsonObject["surname"]); + $this->assertEquals("john@doe.com", $jsonObject["email"]); + $this->assertEquals("+905558001479", $jsonObject["gsmNumber"]); + $this->assertEquals("55555555555", $jsonObject["tckNo"]); + $this->assertEquals("1996-10-07", $jsonObject["birthDate"]); + $this->assertEquals("Besiktas / Istanbul", $jsonObject["address"]); + $this->assertEquals("ccd74b86-e4a8-469e-b3d3-312f0544ea6e", $jsonObject["externalId"]); + } + + public function testShouldConvertToPkiRequestString(): void { + $request = $this->prepareRequest(); + + $str = + "[locale=tr," . + "conversationId=299487456," . + "name=John," . + "surname=Doe," . + "email=john@doe.com," . + "gsmNumber=+905558001479," . + "tckNo=55555555555," . + "birthDate=1996-10-07," . + "address=Besiktas / Istanbul," . + "externalId=ccd74b86-e4a8-469e-b3d3-312f0544ea6e]"; + + $this->assertEquals($str, $request->toPKIRequestString()); + } + + public function testShouldGetJsonString(): void { + $request = $this->prepareRequest(); + + $json = ' + { + "locale":"tr", + "conversationId":"299487456", + "name":"John", + "surname":"Doe", + "email":"john@doe.com", + "gsmNumber":"+905558001479", + "tckNo":"55555555555", + "birthDate":"1996-10-07", + "address":"Besiktas / Istanbul", + "externalId":"ccd74b86-e4a8-469e-b3d3-312f0544ea6e" + }'; + + $this->assertJson($request->toJsonString()); + $this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); + } + + private function prepareRequest(): CreateC2CSubMerchantRequest { + $request = new CreateC2CSubMerchantRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId('299487456'); + $request->setName('John'); + $request->setSurname('Doe'); + $request->setEmail('john@doe.com'); + $request->setGsmNumber('+905558001479'); + $request->setTckNo('55555555555'); + $request->setBirthDate('1996-10-07'); + $request->setAddress('Besiktas / Istanbul'); + $request->setExternalId('ccd74b86-e4a8-469e-b3d3-312f0544ea6e'); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/CreateCheckoutFormInitializeRequestTest.php b/tests/Iyzipay/Tests/Request/CreateCheckoutFormInitializeRequestTest.php index 93300161..f82b2e75 100644 --- a/tests/Iyzipay/Tests/Request/CreateCheckoutFormInitializeRequestTest.php +++ b/tests/Iyzipay/Tests/Request/CreateCheckoutFormInitializeRequestTest.php @@ -129,7 +129,7 @@ public function test_should_get_json_string() "paymentGroup":"PRODUCT", "paymentSource":"source", "posOrderId":"order", - "forceThreeDS":"1", + "forceThreeDS":1, "cardUserKey":"user key", "buyer": { diff --git a/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestTest.php b/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestTest.php index 497fb641..1c6569cb 100644 --- a/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestTest.php +++ b/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestTest.php @@ -82,7 +82,7 @@ public function test_should_get_json_string() "merchantOrderId":"B67832", "paymentGroup":"PRODUCT", "paymentSource":"source", - "forceThreeDS":"1", + "forceThreeDS":1, "enabledInstallments":[1,2,3,6,9], "enabledCardFamily":"Bonus", "currency":"TRY", diff --git a/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestWithInitialConsumerTest.php b/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestWithInitialConsumerTest.php index 5e9d08e1..647b1254 100644 --- a/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestWithInitialConsumerTest.php +++ b/tests/Iyzipay/Tests/Request/CreateIyziupFormInitializeRequestWithInitialConsumerTest.php @@ -123,7 +123,7 @@ public function test_should_get_json_string() "merchantOrderId":"B67832", "paymentGroup":"PRODUCT", "paymentSource":"source", - "forceThreeDS":"1", + "forceThreeDS":1, "enabledInstallments":[1,2,3,6,9], "enabledCardFamily":"Bonus", "currency":"TRY", diff --git a/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkCreateFastLinkRequestTest.php b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkCreateFastLinkRequestTest.php new file mode 100644 index 00000000..4f8d134b --- /dev/null +++ b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkCreateFastLinkRequestTest.php @@ -0,0 +1,35 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals("123456789", $jsonObject["conversationId"]); + $this->assertEquals("ft-description-fast-link", $jsonObject["description"]); + $this->assertEquals(10, $jsonObject["price"]); + $this->assertEquals(Currency::TL, $jsonObject["currencyCode"]); + $this->assertEquals("WEB", $jsonObject["sourceType"]); + } + + public function prepareRequest(): IyziLinkCreateFastLinkRequest { + $request = new IyziLinkCreateFastLinkRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId("123456789"); + $request->setDescription("ft-description-fast-link"); + $request->setPrice(10); + $request->setCurrencyCode("TRY"); + $request->setSourceType("WEB"); + + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSaveRequestProductTest.php b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSaveRequestProductTest.php index 367ce4e9..0942b41d 100644 --- a/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSaveRequestProductTest.php +++ b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSaveRequestProductTest.php @@ -2,7 +2,7 @@ namespace Iyzipay\Tests\Request\Iyzilink; use Iyzipay\Tests\TestCase; -use IyziPay\Request\Iyzilink\IyziLinkSaveProductRequest; +use Iyzipay\Request\Iyzilink\IyziLinkSaveProductRequest; use Iyzipay\Model\Locale; use Iyzipay\Model\Currency; use Iyzipay\FileBase64Encoder; @@ -28,6 +28,9 @@ public function test_should_save_request_object() $this->assertEquals("test", $jsonObject["token"]); $this->assertEquals("test", $jsonObject["url"]); $this->assertEquals("test", $jsonObject["imageUrl"]); + $this->assertEquals("API", $jsonObject['sourceType']); + $this->assertTrue($jsonObject['stockEnabled']); + $this->assertEquals(1, $jsonObject['stockCount']); } @@ -48,6 +51,9 @@ private function prepareRequest() $request->setToken('test'); $request->setUrl('test'); $request->setImageUrl('test'); + $request->setSourceType('API'); + $request->setStockEnabled(true); + $request->setStockCount(1); return $request; } diff --git a/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSearchMerchantProductsRequestTest.php b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSearchMerchantProductsRequestTest.php new file mode 100644 index 00000000..15bea67e --- /dev/null +++ b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkSearchMerchantProductsRequestTest.php @@ -0,0 +1,29 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals(1, $jsonObject['page']); + $this->assertEquals(10, $jsonObject['count']); + } + + public function prepareRequest(): IyziLinkSearchMerchantProductsRequest { + $request = new IyziLinkSearchMerchantProductsRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId('123456'); + $request->setPage(1); + $request->setCount(10); + + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkUpdateProductStatusRequestTest.php b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkUpdateProductStatusRequestTest.php new file mode 100644 index 00000000..2bdf273e --- /dev/null +++ b/tests/Iyzipay/Tests/Request/Iyzilink/IyziLinkUpdateProductStatusRequestTest.php @@ -0,0 +1,28 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals("AAM", $jsonObject["token"]); + $this->assertEquals(Status::PASSIVE, $jsonObject['productStatus']); + } + + public function prepareRequest(): IyziLinkUpdateProductStatusRequest { + $request = new IyziLinkUpdateProductStatusRequest(); + $request->setLocale(Locale::TR); + $request->setToken('AAM'); + $request->setProductStatus(Status::PASSIVE); + + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/PlusInstallmentCreatePaymentRequestTest.php b/tests/Iyzipay/Tests/Request/PlusInstallmentCreatePaymentRequestTest.php new file mode 100644 index 00000000..78f640fd --- /dev/null +++ b/tests/Iyzipay/Tests/Request/PlusInstallmentCreatePaymentRequestTest.php @@ -0,0 +1,253 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject['locale']); + $this->assertEquals('123456789', $jsonObject['conversationId']); + $this->assertEquals('1.0', $jsonObject['price']); + $this->assertEquals('1.1', $jsonObject['paidPrice']); + $this->assertEquals(Currency::TL, $jsonObject['currency']); + $this->assertEquals('1', $jsonObject['installment']); + $this->assertEquals(PaymentChannel::WEB, $jsonObject['paymentChannel']); + $this->assertEquals(PaymentGroup::PRODUCT, $jsonObject['paymentGroup']); + $this->assertEquals('John Doe', $jsonObject['paymentCard']['cardHolderName']); + $this->assertEquals('5528790000000008', $jsonObject['paymentCard']['cardNumber']); + $this->assertEquals('12', $jsonObject['paymentCard']['expireMonth']); + $this->assertEquals('2030', $jsonObject['paymentCard']['expireYear']); + $this->assertEquals('123', $jsonObject['paymentCard']['cvc']); + $this->assertEquals('0', $jsonObject['paymentCard']['registerCard']); + $this->assertEquals('BY789', $jsonObject['buyer']['id']); + $this->assertEquals('John', $jsonObject['buyer']['name']); + $this->assertEquals('Doe', $jsonObject['buyer']['surname']); + $this->assertEquals('+905350000000', $jsonObject['buyer']['gsmNumber']); + $this->assertEquals('email@email.com', $jsonObject['buyer']['email']); + $this->assertEquals('74300864791', $jsonObject['buyer']['identityNumber']); + $this->assertEquals('2015-10-05 12:43:35', $jsonObject['buyer']['lastLoginDate']); + $this->assertEquals('2013-04-21 15:12:09', $jsonObject['buyer']['registrationDate']); + $this->assertEquals('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1', $jsonObject['buyer']['registrationAddress']); + $this->assertEquals('85.34.78.112', $jsonObject['buyer']['ip']); + $this->assertEquals('Istanbul', $jsonObject['buyer']['city']); + $this->assertEquals('Turkey', $jsonObject['buyer']['country']); + $this->assertEquals('34732', $jsonObject['buyer']['zipCode']); + $this->assertEquals('Jane Doe', $jsonObject['shippingAddress']['contactName']); + $this->assertEquals('Istanbul', $jsonObject['shippingAddress']['city']); + $this->assertEquals('Turkey', $jsonObject['shippingAddress']['country']); + $this->assertEquals('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1', $jsonObject['shippingAddress']['address']); + $this->assertEquals('34742', $jsonObject['shippingAddress']['zipCode']); + $this->assertEquals('Jane Doe', $jsonObject['billingAddress']['contactName']); + $this->assertEquals('Istanbul', $jsonObject['billingAddress']['city']); + $this->assertEquals('Turkey', $jsonObject['billingAddress']['country']); + $this->assertEquals('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1', $jsonObject['billingAddress']['address']); + $this->assertEquals('34742', $jsonObject['billingAddress']['zipCode']); + $this->assertEquals('BI101', $jsonObject['basketItems'][0]['id']); + $this->assertEquals('Binocular', $jsonObject['basketItems'][0]['name']); + $this->assertEquals('Collectibles', $jsonObject['basketItems'][0]['category1']); + $this->assertEquals('Accessories', $jsonObject['basketItems'][0]['category2']); + $this->assertEquals(BasketItemType::PHYSICAL, $jsonObject['basketItems'][0]['itemType']); + $this->assertEquals('0.3', $jsonObject['basketItems'][0]['price']); + } + + public function testShouldConvertToPkiString(): void { + $request = $this->prepareRequest(); + + $str = "[locale=tr," . + "conversationId=123456789," . + "price=1.0," . + "paidPrice=1.1," . + "installment=1," . + "paymentChannel=WEB," . + "basketId=B67832," . + "paymentGroup=PRODUCT," . + "paymentCard=[cardHolderName=John Doe," . + "cardNumber=5528790000000008," . + "expireYear=2030," . + "expireMonth=12," . + "cvc=123," . + "registerCard=0]," . + "buyer=[id=BY789," . + "name=John," . + "surname=Doe," . + "identityNumber=74300864791," . + "email=email@email.com," . + "gsmNumber=+905350000000," . + "registrationDate=2013-04-21 15:12:09," . + "lastLoginDate=2015-10-05 12:43:35," . + "registrationAddress=Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1," . + "city=Istanbul," . + "country=Turkey," . + "zipCode=34732," . + "ip=85.34.78.112]," . + "shippingAddress=[address=Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1," . + "zipCode=34742," . + "contactName=Jane Doe," . + "city=Istanbul," . + "country=Turkey]," . + "billingAddress=[address=Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1," . + "zipCode=34742," . + "contactName=Jane Doe," . + "city=Istanbul," . + "country=Turkey]," . + "basketItems=[[id=BI101," . + "price=0.3," . + "name=Binocular," . + "category1=Collectibles," . + "category2=Accessories," . + "itemType=PHYSICAL]]," . + "currency=TRY]"; + + $this->assertEquals($str, $request->toPKIRequestString()); + } + + public function testShouldGetJsonString(): void { + $request = $this->prepareRequest(); + + $json = ' + { + "locale":"tr", + "conversationId":"123456789", + "price":"1.0", + "paidPrice":"1.1", + "installment":1, + "paymentChannel":"WEB", + "basketId":"B67832", + "paymentGroup":"PRODUCT", + "paymentCard": + { + "cardHolderName":"John Doe", + "cardNumber":"5528790000000008", + "expireYear":"2030", + "expireMonth":"12", + "cvc":"123", + "registerCard":0 + }, + "buyer": + { + "id":"BY789", + "name":"John", + "surname":"Doe", + "identityNumber":"74300864791", + "email":"email@email.com", + "gsmNumber":"+905350000000", + "registrationDate":"2013-04-21 15:12:09", + "lastLoginDate":"2015-10-05 12:43:35", + "registrationAddress":"Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1", + "city":"Istanbul", + "country":"Turkey", + "zipCode":"34732", + "ip":"85.34.78.112" + }, + "shippingAddress": + { + "address":"Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1", + "zipCode":"34742", + "contactName":"Jane Doe", + "city":"Istanbul", + "country":"Turkey" + }, + "billingAddress": + { + "address":"Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1", + "zipCode":"34742", + "contactName":"Jane Doe", + "city":"Istanbul", + "country":"Turkey" + }, + "basketItems": + [ + { + "id":"BI101", + "price":"0.3", + "name":"Binocular", + "category1":"Collectibles", + "category2":"Accessories", + "itemType":"PHYSICAL" + } + ], + "currency":"TRY" + }'; + + $this->assertJson($request->toJsonString()); + $this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); + } + + private function prepareRequest(): CreatePlusInstallmentPaymentRequest { + $request = new CreatePlusInstallmentPaymentRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId('123456789'); + $request->setPrice(1); + $request->setPaidPrice(1.1); + $request->setCurrency('TRY'); + $request->setInstallment(1); + $request->setPaymentChannel('WEB'); + $request->setBasketId('B67832'); + $request->setPaymentGroup(PaymentGroup::PRODUCT); + + $card = new PaymentCard(); + $card->setCardHolderName('John Doe'); + $card->setCardNumber('5528790000000008'); + $card->setExpireYear('2030'); + $card->setExpireMonth('12'); + $card->setCvc('123'); + $card->setRegisterCard(0); + $request->setPaymentCard($card); + + $buyer = new Buyer(); + $buyer->setId('BY789'); + $buyer->setName('John'); + $buyer->setSurname('Doe'); + $buyer->setIdentityNumber('74300864791'); + $buyer->setEmail('email@email.com'); + $buyer->setGsmNumber('+905350000000'); + $buyer->setRegistrationDate('2013-04-21 15:12:09'); + $buyer->setLastLoginDate('2015-10-05 12:43:35'); + $buyer->setRegistrationAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $buyer->setCity('Istanbul'); + $buyer->setCountry('Turkey'); + $buyer->setZipCode('34732'); + $buyer->setIp('85.34.78.112'); + $request->setBuyer($buyer); + + $shippingAddress = new Address(); + $shippingAddress->setAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $shippingAddress->setZipCode('34742'); + $shippingAddress->setContactName('Jane Doe'); + $shippingAddress->setCity('Istanbul'); + $shippingAddress->setCountry('Turkey'); + $request->setShippingAddress($shippingAddress); + + $billingAddress = new Address(); + $billingAddress->setAddress('Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'); + $billingAddress->setZipCode('34742'); + $billingAddress->setContactName('Jane Doe'); + $billingAddress->setCity('Istanbul'); + $billingAddress->setCountry('Turkey'); + $request->setBillingAddress($billingAddress); + + $firstBasketItem = new BasketItem(); + $firstBasketItem->setId('BI101'); + $firstBasketItem->setPrice(0.3); + $firstBasketItem->setName('Binocular'); + $firstBasketItem->setCategory1('Collectibles'); + $firstBasketItem->setCategory2('Accessories'); + $firstBasketItem->setItemType(BasketItemType::PHYSICAL); + $request->setBasketItems([$firstBasketItem]); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/ReportingScrollTransactionRequestTest.php b/tests/Iyzipay/Tests/Request/ReportingScrollTransactionRequestTest.php new file mode 100644 index 00000000..b5041040 --- /dev/null +++ b/tests/Iyzipay/Tests/Request/ReportingScrollTransactionRequestTest.php @@ -0,0 +1,27 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals('123456789', $jsonObject['conversationId']); + $this->assertEquals('2023-08-17', $jsonObject['transactionDate']); + $this->assertEquals('ASC', $jsonObject['documentScrollVoSortingOrder']); + $this->assertEquals('1689853839161', $jsonObject['lastId']); + } + + private function prepareRequest(): ReportingScrollTransactionRequest { + $request = new ReportingScrollTransactionRequest(); + $request->setConversationId('123456789'); + $request->setTransactionDate('2023-08-17'); + $request->setDocumentScrollVoSortingOrder('ASC'); + $request->setLastId('1689853839161'); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/RetrieveBlacklistedCardRequestTest.php b/tests/Iyzipay/Tests/Request/RetrieveBlacklistedCardRequestTest.php new file mode 100644 index 00000000..91c11b7e --- /dev/null +++ b/tests/Iyzipay/Tests/Request/RetrieveBlacklistedCardRequestTest.php @@ -0,0 +1,50 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals("123456789", $jsonObject["conversationId"]); + $this->assertEquals("card number", $jsonObject["cardNumber"]); + } + + public function test_should_convert_to_pki_request_string() { + $request = $this->prepareRequest(); + + $str = "[locale=tr," . + "conversationId=123456789," . + "cardNumber=card number]"; + + $this->assertEquals($str, $request->toPKIRequestString()); + } + + public function test_should_get_json_string() { + $request = $this->prepareRequest(); + + $json = ' + { + "locale":"tr", + "conversationId":"123456789", + "cardNumber":"card number" + }'; + + $this->assertJson($request->toJsonString()); + $this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); + } + + private function prepareRequest(): RetrieveBlacklistedCardRequest { + $request = new RetrieveBlacklistedCardRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId("123456789"); + $request->setCardNumber("card number"); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/Subscription/SubscriptionDeleteCustomerRequestTest.php b/tests/Iyzipay/Tests/Request/Subscription/SubscriptionDeleteCustomerRequestTest.php new file mode 100644 index 00000000..35efb63c --- /dev/null +++ b/tests/Iyzipay/Tests/Request/Subscription/SubscriptionDeleteCustomerRequestTest.php @@ -0,0 +1,21 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals('566b2e1a-5046-4438-9b62-c8cf761f61d1', $jsonObject['customerReferenceCode']); + } + + private function prepareRequest() { + $request = new SubscriptionDeleteCustomerRequest(); + $request->setCustomerReferenceCode('566b2e1a-5046-4438-9b62-c8cf761f61d1'); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/Subscription/SubscriptionListRequestTest.php b/tests/Iyzipay/Tests/Request/Subscription/SubscriptionListRequestTest.php new file mode 100644 index 00000000..08350ac5 --- /dev/null +++ b/tests/Iyzipay/Tests/Request/Subscription/SubscriptionListRequestTest.php @@ -0,0 +1,37 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(1, $jsonObject['page']); + $this->assertEquals(10, $jsonObject['count']); + $this->assertEquals(\Iyzipay\Model\Status::ACTIVE, $jsonObject['subscriptionStatus']); + $this->assertEquals('c8ab43da-f4b3-40d2-b1ef-620da93ec3e9', $jsonObject['subscriptionReferenceCode']); + $this->assertEquals('566b2e1a-5046-4438-9b62-c8cf761f61d1', $jsonObject['customerReferenceCode']); + $this->assertEquals('c1d489b6-9adc-42fa-88ae-47ea2e5dbe1e', $jsonObject['pricingPlanReferenceCode']); + $this->assertEquals('f219267d-ce05-4039-a773-225ea44aacd1', $jsonObject['parentReferenceCode']); + $this->assertEquals('2024-01-01', $jsonObject['startDate']); + $this->assertEquals('2024-02-02', $jsonObject['endDate']); + } + + private function prepareRequest(): SubscriptionListRequest { + $request = new SubscriptionListRequest(); + $request->setPage(1); + $request->setCount(10); + $request->setSubscriptionStatus(\Iyzipay\Model\Status::ACTIVE); + $request->setSubscriptionReferenceCode('c8ab43da-f4b3-40d2-b1ef-620da93ec3e9'); + $request->setCustomerReferenceCode('566b2e1a-5046-4438-9b62-c8cf761f61d1'); + $request->setPricingPlanReferenceCode('c1d489b6-9adc-42fa-88ae-47ea2e5dbe1e'); + $request->setParentReferenceCode('f219267d-ce05-4039-a773-225ea44aacd1'); + $request->setStartDate('2024-01-01'); + $request->setEndDate('2024-02-02'); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/Subscription/SubscriptionUpgradeRequestTest.php b/tests/Iyzipay/Tests/Request/Subscription/SubscriptionUpgradeRequestTest.php index 03f19b9b..028ac471 100644 --- a/tests/Iyzipay/Tests/Request/Subscription/SubscriptionUpgradeRequestTest.php +++ b/tests/Iyzipay/Tests/Request/Subscription/SubscriptionUpgradeRequestTest.php @@ -17,8 +17,8 @@ public function test_should_get_json_object() $this->assertEquals("5308630d-fb0a-453f-b30a-5afa719d5191", $jsonObject["newPricingPlanReferenceCode"]); $this->assertEquals("85eaa655-c3fd-4053-9e9b-dacc9e201c5f", $jsonObject["subscriptionReferenceCode"]); $this->assertEquals("NOW", $jsonObject["upgradePeriod"]); - $this->assertEquals(true, $jsonObject["useTrial"]); - $this->assertEquals(true, $jsonObject["resetRecurrenceCount"]); + $this->assertEquals(1, $jsonObject["useTrial"]); + $this->assertEquals(1, $jsonObject["resetRecurrenceCount"]); } @@ -47,8 +47,8 @@ private function prepareRequest() $request->setSubscriptionReferenceCode("85eaa655-c3fd-4053-9e9b-dacc9e201c5f"); $request->setNewPricingPlanReferenceCode("5308630d-fb0a-453f-b30a-5afa719d5191"); $request->setUpgradePeriod("NOW"); - $request->setUseTrial(true); - $request->setResetRecurrenceCount(true); + $request->setUseTrial(1); + $request->setResetRecurrenceCount(1); return $request; } } diff --git a/tests/Iyzipay/Tests/Request/UpdateBlacklistedCardRequestTest.php b/tests/Iyzipay/Tests/Request/UpdateBlacklistedCardRequestTest.php new file mode 100644 index 00000000..fddf38ea --- /dev/null +++ b/tests/Iyzipay/Tests/Request/UpdateBlacklistedCardRequestTest.php @@ -0,0 +1,55 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals("123456789", $jsonObject["conversationId"]); + $this->assertEquals("card token", $jsonObject["cardToken"]); + $this->assertEquals("card user key", $jsonObject["cardUserKey"]); + } + + public function test_should_convert_to_pki_request_string(): void { + $request = $this->prepareRequest(); + + $str = "[locale=tr," . + "conversationId=123456789," . + "cardToken=card token," . + "cardUserKey=card user key]"; +// "cardToken=card token]"; + + $this->assertEquals($str, $request->toPKIRequestString()); + } + + public function test_should_get_json_string(): void { + $request = $this->prepareRequest(); + + $json = ' + { + "locale":"tr", + "conversationId":"123456789", + "cardToken":"card token", + "cardUserKey":"card user key" + }'; + + $this->assertJson($request->toJsonString()); + $this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); + } + + private function prepareRequest(): UpdateBlackListedCardRequest { + $request = new UpdateBlackListedCardRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId("123456789"); + $request->setCardToken("card token"); + $request->setCardUserKey("card user key"); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/Request/VerifyC2CSubMerchantRequestTest.php b/tests/Iyzipay/Tests/Request/VerifyC2CSubMerchantRequestTest.php new file mode 100644 index 00000000..7fa212b5 --- /dev/null +++ b/tests/Iyzipay/Tests/Request/VerifyC2CSubMerchantRequestTest.php @@ -0,0 +1,56 @@ +prepareRequest(); + $jsonObject = $request->getJsonObject(); + + $this->assertEquals(Locale::TR, $jsonObject["locale"]); + $this->assertEquals("422117402", $jsonObject["conversationId"]); + $this->assertEquals("4973f734-e946-40dc-b3a9-34e0efb330d5", $jsonObject["txId"]); + $this->assertEquals("HZ87equxm70klGxX1nZX7A==", $jsonObject["smsVerificationCode"]); + } + + public function testShouldConvertToPkiRequestString(): void { + $request = $this->prepareRequest(); + + $str = + "[locale=tr," . + "conversationId=422117402," . + "txId=4973f734-e946-40dc-b3a9-34e0efb330d5," . + "smsVerificationCode=HZ87equxm70klGxX1nZX7A==]"; + + $this->assertEquals($str, $request->toPKIRequestString()); + } + + public function testShouldGetJsonString(): void { + $request = $this->prepareRequest(); + + $json = ' + { + "locale":"tr", + "conversationId":"422117402", + "txId":"4973f734-e946-40dc-b3a9-34e0efb330d5", + "smsVerificationCode":"HZ87equxm70klGxX1nZX7A==" + }'; + + $this->assertJson($request->toJsonString()); + $this->assertJsonStringEqualsJsonString($json, $request->toJsonString()); + } + + private function prepareRequest(): VerifyC2CSubMerchantRequest { + $request = new VerifyC2CSubMerchantRequest(); + $request->setLocale(Locale::TR); + $request->setConversationId('422117402'); + $request->setTxId('4973f734-e946-40dc-b3a9-34e0efb330d5'); + $request->setSmsVerificationCode('HZ87equxm70klGxX1nZX7A=='); + return $request; + } +} diff --git a/tests/Iyzipay/Tests/TestCase.php b/tests/Iyzipay/Tests/TestCase.php index d094c4de..e6a658e5 100644 --- a/tests/Iyzipay/Tests/TestCase.php +++ b/tests/Iyzipay/Tests/TestCase.php @@ -2,13 +2,14 @@ namespace Iyzipay\Tests; +use PHPUnit\Framework\TestCase as BaseTestCase; use Iyzipay\Options; -class TestCase extends \PHPUnit_Framework_TestCase +class TestCase extends BaseTestCase { protected $options; - protected function setUp() + protected function setUp(): void { $this->options = new Options(); $this->options->setApiKey("apiKey"); @@ -26,6 +27,7 @@ protected function callMethod($obj, $name, array $args) public function test_should_check_if_options_not_empty() { + $this->options = new Options(); $this->assertNotEmpty($this->options); } @@ -33,4 +35,4 @@ public function retrieveJsonFile($file) { return file_get_contents(__DIR__ . '/mock/' . $file, true); } -} \ No newline at end of file +} diff --git a/tests/Iyzipay/Tests/mock/blacklisted-card.json b/tests/Iyzipay/Tests/mock/blacklisted-card.json new file mode 100644 index 00000000..8261b86a --- /dev/null +++ b/tests/Iyzipay/Tests/mock/blacklisted-card.json @@ -0,0 +1,12 @@ +{ + "status": "failure", + "errorCode": 10000, + "errorMessage": "error message", + "errorGroup": "ERROR_GROUP", + "locale": "tr", + "systemTime": "1458545234852", + "conversationId": "123456", + "cardUserKey": "cardUserKey", + "cardToken": "cardToken", + "cardNumber": "cardNumber" +} \ No newline at end of file diff --git a/tests/Iyzipay/Tests/mock/iyzilink-update-product-status.json b/tests/Iyzipay/Tests/mock/iyzilink-update-product-status.json new file mode 100644 index 00000000..6bf40b51 --- /dev/null +++ b/tests/Iyzipay/Tests/mock/iyzilink-update-product-status.json @@ -0,0 +1,5 @@ +{ + "status": "success", + "locale": "tr", + "systemTime": "1710349430773" +} \ No newline at end of file diff --git a/tests/Iyzipay/Tests/mock/retrieve-blacklisted-card.json b/tests/Iyzipay/Tests/mock/retrieve-blacklisted-card.json new file mode 100644 index 00000000..95bf5f09 --- /dev/null +++ b/tests/Iyzipay/Tests/mock/retrieve-blacklisted-card.json @@ -0,0 +1,10 @@ +{ + "status": "failure", + "errorCode": 10000, + "errorMessage": "error message", + "errorGroup": "ERROR_GROUP", + "locale": "tr", + "systemTime": "1458545234852", + "conversationId": "123456", + "cardNumber": "cardNumber" +}