Skip to content

Commit

Permalink
Merge pull request #8 from iyzico/3.x
Browse files Browse the repository at this point in the history
Plug-in Update
  • Loading branch information
mehmetselim authored Aug 6, 2018
2 parents 4d0ef3d + 51dc62e commit d1357ed
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 75 deletions.
42 changes: 21 additions & 21 deletions upload/admin/controller/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
class ControllerExtensionPaymentIyzico extends Controller {
private $module_version = '1.0';
private $module_version = '1.1';
private $module_product_name = 'eleven';

private $error = array();
Expand Down Expand Up @@ -237,6 +237,26 @@ public function uninstall() {
$this->model_setting_event->deleteEventByCode('module_notification');
}

protected function validate() {

if (!$this->user->hasPermission('modify', 'extension/payment/iyzico')) {
$this->error['warning'] = $this->language->get('error_permission');
}

foreach ($this->fields as $key => $field) {

if($field['validateField'] != 'blank') {

if (!$this->request->post[$field['name']]){
$this->error[$field['validateField']] = $this->language->get($field['validateField']);
}
}

}

return !$this->error;
}

public function requestIyzico($request,$method_type,$extra_request = false) {

$request_modify = array();
Expand Down Expand Up @@ -292,25 +312,5 @@ public function requestIyzico($request,$method_type,$extra_request = false) {
}


protected function validate() {

if (!$this->user->hasPermission('modify', 'extension/payment/worldpay')) {
$this->error['warning'] = $this->language->get('error_permission');
}

foreach ($this->fields as $key => $field) {

if($field['validateField'] != 'blank') {

if (!$this->request->post[$field['name']]){
$this->error[$field['validateField']] = $this->language->get($field['validateField']);
}
}

}

return !$this->error;
}


}
32 changes: 6 additions & 26 deletions upload/admin/model/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
class ModelExtensionPaymentIyzico extends Model {
private $module_version = '1.0';
private $module_version = '1.1';
private $module_product_name = 'eleven';


Expand Down Expand Up @@ -33,85 +33,65 @@ public function uninstall() {
}

public function pkiStringGenerate($object_data) {

$pki_value = "[";
foreach ($object_data 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;

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

if(end($result) == $item) {
if(end($data) != $result) {

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

} else {

$pki_value .= "]";
}
}
}
}

if(end($data) == $result)
$pki_value .= "]";

} else {

$name = var_export($key, true);
$name = str_replace("'", "", $name);


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

if(end($object_data) != $data)
$pki_value .= ",";
}

$pki_value .= "]";

return $pki_value;
}

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/view/template/extension/payment/iyzico.twig
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
<ul>
<li><strong>TLS versiyonunuzu kontrol ettiniz mi ?</strong></li>
</ul>
<p>Sunucu sağlayıcınızla görüşerek OpenSSL versiyonunu minimum 1.0.1’e, curl versiyonunu 7.3.4 yukseltebilirsiniz.</p>
<p>Sunucu sağlayıcınızla görüşerek OpenSSL versiyonunu minimum 1.0.1’e, curl versiyonunu 7.30.4 yukseltebilirsiniz.</p>
<ul>
<li><strong>Sorununuz hala devam ediyor mu ?</strong></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/controller/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class ControllerExtensionPaymentIyzico extends Controller {

private $module_version = VERSION;
private $module_product_name = 'eleven-1.0';
private $module_product_name = 'eleven-1.1';

public function index() {

Expand Down
31 changes: 5 additions & 26 deletions upload/catalog/model/extension/payment/iyzico.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,90 +119,69 @@ public function createFormInitializObjectSort($object_data) {
}

public function pkiStringGenerate($object_data) {

$pki_value = "[";
foreach ($object_data 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;

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

if(end($result) == $item) {
if(end($data) != $result) {

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

} else {

$pki_value .= "]";
}
}
}
}

if(end($data) == $result)
$pki_value .= "]";

} else {

$name = var_export($key, true);
$name = str_replace("'", "", $name);


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

if(end($object_data) != $data)
$pki_value .= ",";
}

$pki_value .= "]";

return $pki_value;
}



public function hashGenerate($pki,$api_key,$secret_key,$random_value) {

$hash = $api_key . $random_value . $secret_key . $pki;
Expand Down

0 comments on commit d1357ed

Please sign in to comment.