Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x #26

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

4.x #26

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added iyzico.ocmod.zip
Binary file not shown.
Binary file added iyzico/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/controller/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/controller/payment/.DS_Store
Binary file not shown.
416 changes: 416 additions & 0 deletions iyzico/admin/controller/payment/iyzico.php

Large diffs are not rendered by default.

Binary file added iyzico/admin/language/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/language/en-gb/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/language/en-gb/payment/.DS_Store
Binary file not shown.
75 changes: 75 additions & 0 deletions iyzico/admin/language/en-gb/payment/iyzico.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

// Heading
$_['heading_title'] = 'iyzico Checkout Form';
$_['text_iyzico'] = '<a href="http://www.iyzico.com/" target="_blank">iyzico</a>';
$_['general_select'] = 'Select';
$_['live'] = 'Live';
$_['sandbox'] = 'Sandbox / Test';
$_['api_field'] = 'API Type';
$_['api_field_tooltip'] = 'API Type Live or Sandbox';
$_['api_key'] = 'API Key';
$_['secret_key'] = 'Secret Key';
$_['apikey_field_tooltip'] = 'Your API key with including 32 digit letter and number.';
$_['secretkey_field_tooltip'] = 'Your Secret Key with including 32 digit letter and number.';
$_['view_select'] = 'Design';
$_['payment_iyzico_language_name'] = 'Checkout language';
$_['order_status'] = 'Order Status';
$_['cancel_order_status'] = 'Cancel Order Status';
$_['order_status_tooltip'] = 'New ordering status info';
$_['cancel_order_status_tooltip'] = 'Cancel ordering status info';
$_['extension_status'] = 'Extension Status';
$_['sort_order'] = 'Order';
$_['error_api_channel'] = 'Api Channel Required!';
$_['error_api_key'] = 'Api Key Required!';
$_['error_secret_key'] = 'Secret Key Required!';
$_['text_success'] = 'Iyzico Payment Extension: Updated Success!';
$_['valid_live'] = 'Sandbox API key information is unusable for Live API';
$_['valid_sandbox'] = 'Live API key information is unusable for Sandbox API';
$_['install'] = 'Install';
$_['help'] = 'Help';
$_['settings'] = 'Settings';
$_['settings_content'] = 'I Hope everything is okay';
$_['install_title'] = 'Install Title';
$_['install_hello'] = 'Hello';
$_['support'] = 'Support';
$_['install_content'] = 'Welcome to iyzico Opencart install screen. <br> Live: &nbsp; &nbsp; &nbsp; &nbsp; <strong><a href="https://merchant.iyzipay.com">https://merchant.iyzipay.com</a></strong><br>
Sandbox: &nbsp; <strong><a href="https://sandbox-merchant.iyzipay.com">https://sandbox-merchant.iyzipay.com</a></strong><br><br>
Help detail <strong>Help</strong> is click.';
$_['payment_title'] = 'Payment Value';
$_['api_connection'] = 'Api Connection:';
$_['api_connection_success'] = 'Success';
$_['api_connection_failed'] = 'Failed';
$_['api_connection_failed_content'] = 'Opss.. Help detail <strong>Help</strong> is click.';
$_['buyer_protection'] = 'Buyer Protection';
$_['overlay_design'] = 'Design:';
$_['overlay_bottom_left'] = 'Bottom Left';
$_['overlay_bottom_left_val'] = 'bottomLeft';
$_['overlay_bottom_right'] = 'Bottom Right';
$_['overlay_bottom_right_val'] = 'bottomRight';
$_['overlay_closed'] = 'Hidden';
$_['overlay_closed_val'] = 'hidden';
$_['iyzico_update_screen'] = 'IYZICO UPDATE SCREEN';
$_['current_version_name'] = 'Old Version:';
$_['new_version_name'] = 'New Version:';
$_['description_name'] = 'Description:';
$_['iyzico_webhook'] = 'Webhook Integration';
$_['webhook_url_description'] = "Don't forget to do webhook Integration.";
$_['iyzico_webhook_url_key_error'] = "Webhook URL Error! Please, try these steps respectively. 1- Refresh web page 1-2 times. 2- If webhook url doesn't create , Please, after delete the iyzico plugin, re-install the iyzico plugin and save module settings. 3- Send an email to [email protected]";

$_['pwi_status_error'] = "Pay with iyzico module is not enable!";
$_['pwi_status_error_detail'] = "You can not access Settings of iyzico Checkout Form Module without installing the pay with iyzico module.";
$_['dev_iyzipay_opencart_link'] = "https://dev.iyzipay.com/tr/acik-kaynak/opencart";
$_['dev_iyzipay_detail'] = "Complete the installation of the Opencart 4.x - Pay with iyzico module via dev.iyzipay:";

$_['checkout_language_automatic'] = 'Automatic';
$_['checkout_language_turkish'] = 'Turkish';
$_['checkout_language_english'] = 'English';

$_['admin_active_button'] = 'Active';
$_['text_extension'] = 'Extensions';
$_['breadcrumb_heading_title'] = 'iyzico Module Settings';
$_['copy_clipboard_text'] = 'Copy to Clipboard: ';
$_['error_design'] = 'Design Required!';

$_['text_info_label'] = ' &nbsp;If you have problems, please contact. <a href="mailto:[email protected]"> &nbsp;[email protected]</a>';
Binary file added iyzico/admin/language/tr-tr/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/language/tr-tr/payment/.DS_Store
Binary file not shown.
26 changes: 23 additions & 3 deletions ...nguage/tr-tr/extension/payment/iyzico.php → ...o/admin/language/tr-tr/payment/iyzico.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

// Heading
$_['heading_title'] = 'iyzico';
$_['text_iyzico'] = '<a href="http://www.iyzico.com/" target="_blank"><img src="view/image/payment/iyzico_logo.png" alt="iyzico" title="iyzico" /></a>';
$_['heading_title'] = 'iyzico Ödeme Formu';
$_['text_iyzico'] = '<a href="http://www.iyzico.com/" target="_blank">iyzico</a>';
$_['general_select'] = 'Seçiniz';
$_['live'] = 'Live';
$_['sandbox'] = 'Sandbox / Test';
Expand All @@ -13,6 +13,7 @@
$_['apikey_field_tooltip'] = 'iyzico panelinizin ayarlar bölümünden erişebileceğiniz api anahtarı';
$_['secretkey_field_tooltip'] = 'iyzico panelinizin ayarlar bölümünden erişebileceğiniz güvenlik api anahtarı';
$_['view_select'] = 'Görünüm';
$_['payment_iyzico_language_name'] = 'Ödeme Formu Dili';
$_['design_field_tooltip'] = 'Ödeme formunuzun görünümü';
$_['order_status'] = 'Sipariş Durumu';
$_['order_status_tooltip'] = 'Sipariş alındığında müşteriye gösterilecek durum bilgisi';
Expand Down Expand Up @@ -53,4 +54,23 @@
$_['iyzico_update_screen'] = 'İYZİCO GÜNCELLEME EKRANI';
$_['current_version_name'] = 'Mevcur Sürümünüz:';
$_['new_version_name'] = 'Yeni Sürümünüz:';
$_['description_name'] = 'Açıklama:';
$_['description_name'] = 'Açıklama:';
$_['iyzico_webhook'] = 'Webhook Entegrasyonu';
$_['webhook_url_description'] = "Webhook entegrasyonunu yapmayı unutmayınız.";
$_['iyzico_webhook_url_key_error'] = "Webhook URL üretilemedi. Lütfen sırasıyla bu adımları deneyin. 1- Web sayfasını 1-2 defa yenileyin. 2- Webhook URL üretilmediyse lütfen plugini kaldırıp, yeniden kurun ve ayarları kaydedin. 3- Sorun devam ederse [email protected]'a mail atınız.";

$_['pwi_status_error'] = "iyzico İle Öde modülü aktif değil!";
$_['pwi_status_error_detail'] = "iyzico ile Öde modülünü kurmadan iyzico Ödeme Formu ayarlarına erişemezsiniz.";
$_['dev_iyzipay_opencart_link'] = "https://dev.iyzipay.com/tr/acik-kaynak/opencart";
$_['dev_iyzipay_detail'] = "Opencart 4.x - iyzico ile Öde modülünün kurulumunu tamamlayınız: ";
$_['checkout_language_automatic'] = 'Otomatik';
$_['checkout_language_turkish'] = 'Türkçe';
$_['checkout_language_english'] = 'İngilizce';

$_['admin_active_button'] = 'Aktifleştir';
$_['text_extension'] = 'Eklentiler';
$_['breadcrumb_heading_title'] = 'iyzico Modül Ayarları';
$_['copy_clipboard_text'] = 'Panoya Kopyalandı: ';
$_['error_design'] = 'Görünüm Gerekli!';

$_['text_info_label'] = ' &nbsp;Problem yaşıyorsanız iletişime geçiniz.<a href="mailto:[email protected]"> &nbsp;[email protected]</a>';
Binary file added iyzico/admin/model/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/model/payment/.DS_Store
Binary file not shown.
183 changes: 183 additions & 0 deletions iyzico/admin/model/payment/iyzico.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<?php
namespace Opencart\Admin\Model\Extension\iyzico\Payment;

use Opencart\System\Engine\Model;
class iyzico extends Model
{

public function install()
{
$this->db->query("
CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "iyzico_order` (
`iyzico_order_id` INT(11) NOT NULL AUTO_INCREMENT,
`payment_id` INT(11) NOT NULL,
`order_id` INT(11) NOT NULL,
`total_amount` DECIMAL( 10, 2 ) NOT NULL,
`status` VARCHAR(20) NOT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`iyzico_order_id`)
) ENGINE=MyISAM DEFAULT COLLATE=utf8_general_ci;");

$this->db->query("
CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "iyzico_card` (
`iyzico_card_id` INT(11) NOT NULL AUTO_INCREMENT,
`customer_id` INT(11) NOT NULL,
`card_user_key` VARCHAR(50),
`api_key` VARCHAR(50),
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`iyzico_card_id`)
) ENGINE=MyISAM DEFAULT COLLATE=utf8_general_ci;");
}

public function uninstall()
{
$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "iyzico_order`;");
$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "iyzico_card`;");
}

public function pkiStringGenerate($objectData)
{
$pki_value = "[";
foreach ($objectData as $key => $data) {
if (is_object($data)) {
$name = var_export($key, true);
$name = str_replace("'", "", $name);
$pki_value .= $name . "=[";
$end_key = count(get_object_vars($data));
$count = 0;
foreach ($data as $key => $value) {
$count++;
$name = var_export($key, true);
$name = str_replace("'", "", $name);
$pki_value .= $name . "=" . "" . $value;
if ($end_key != $count)
$pki_value .= ",";
}
$pki_value .= "]";
} else if (is_array($data)) {
$name = var_export($key, true);
$name = str_replace("'", "", $name);
$pki_value .= $name . "=[";
$end_key = count($data);
$count = 0;
foreach ($data as $key => $result) {
$count++;
$pki_value .= "[";

foreach ($result as $key => $item) {
$name = var_export($key, true);
$name = str_replace("'", "", $name);

$pki_value .= $name . "=" . "" . $item;
$reResult = (array) $result;
$newResult = $reResult[array_key_last($reResult)];

if ($newResult != $item) {
$pki_value .= ",";
}

if ($newResult == $item) {

if ($end_key != $count) {
$pki_value .= "], ";
} else {
$pki_value .= "]";
}
}
}
}

$reData = (array) $data;
$newData = $reData[array_key_last($reData)];
if ($newData == $result)
$pki_value .= "]";
} else {
$name = var_export($key, true);
$name = str_replace("'", "", $name);

$pki_value .= $name . "=" . "" . $data . "";
}

$reObjectData = (array) $objectData;
$newobjectData = $reObjectData[array_key_last($reObjectData)];

if ($newobjectData != $data)
$pki_value .= ",";
}
$pki_value .= "]";
return $pki_value;
}

public function authorizationGenerate($api_key, $secret_key, $pki)
{

$rand_value = rand(100000, 99999999);
$hash_value = $api_key . $rand_value . $secret_key . $pki;
$hash = base64_encode(sha1($hash_value, true));

$authorization = 'IYZWS ' . $api_key . ':' . $hash;

$authorization_data = array(
'authorization' => $authorization,
'rand_value' => $rand_value
);

return $authorization_data;
}

public function apiConnection($authorization_data, $api_connection_object)
{

$url = $this->config->get('payment_iyzico_api_url');
$url = $url . '/payment/bin/check';

$api_connection_object = json_encode($api_connection_object);

return $this->curlPost($api_connection_object, $authorization_data, $url);

}

public function iyzicoPostWebhookUrlKey($authorization_data, $webhook_active_post)
{

$url = $this->config->get('payment_iyzico_api_url');
$url = $url . '/payment/notification/update';

$webhook_active_post = json_encode($webhook_active_post);

return $this->curlPost($webhook_active_post, $authorization_data, $url);

}

public function curlPost($json, $authorizationData, $url)
{

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
if ($json) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);

curl_setopt(
$curl,
CURLOPT_HTTPHEADER,
array(
"Authorization: " . $authorizationData['authorization'],
"x-iyzi-rnd:" . $authorizationData['rand_value'],
"Content-Type: application/json",
)
);

$result = json_decode(curl_exec($curl));
curl_close($curl);


return $result;
}

}
Binary file added iyzico/admin/view/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/view/image/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/view/image/payment/iyzico_cards.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added iyzico/admin/view/image/payment/iyzico_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added iyzico/admin/view/javascript/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/view/javascript/iyzico/.DS_Store
Binary file not shown.
File renamed without changes.
1 change: 1 addition & 0 deletions iyzico/admin/view/javascript/iyzico/validation_iyzico.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added iyzico/admin/view/stylesheet/.DS_Store
Binary file not shown.
File renamed without changes.
Binary file added iyzico/admin/view/template/.DS_Store
Binary file not shown.
Binary file added iyzico/admin/view/template/payment/.DS_Store
Binary file not shown.
Loading