Skip to content

Commit

Permalink
+Update version
Browse files Browse the repository at this point in the history
  • Loading branch information
feyzullahdemir committed Feb 1, 2023
1 parent 57d1721 commit bb470a0
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions Controller/IyzicoBase/IyzicoFormObjectGenerator.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function generateOption($checkoutSession,$locale,$currency,$cardId,$callB
$iyzico->basketId = $cardId;
$iyzico->paymentGroup = 'PRODUCT';
$iyzico->callbackUrl = $callBack."Iyzico_PayWithIyzico/response/paywithiyzico";
$iyzico->cancelUrl = $callBack;
$iyzico->cancelUrl = $callBack;
$iyzico->paymentSource = "MAGENTO2|".$magentoVersion."|SPACE-1.0|PWI";

return $iyzico;
Expand Down Expand Up @@ -151,7 +151,7 @@ public function generateBasketItems($checkoutSession) {
$basketItems[$keyNumber]->id = $item->getProductId();
$basketItems[$keyNumber]->price = $this->helper->priceParser(round($item->getPrice(),2));
$basketItems[$keyNumber]->name = $this->helper->dataCheck($item->getName());
$basketItems[$keyNumber]->category1 = "MAGENTO-ECOMMERCE";
$basketItems[$keyNumber]->category1 = $this->helper->dataCheck($item->getName());
$basketItems[$keyNumber]->itemType = "PHYSICAL";

$keyNumber++;
Expand Down
25 changes: 24 additions & 1 deletion Controller/Response/PayWithIyzico.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,34 @@ public function execute()
$requestResponse->paidPrice = isset($requestResponse->paidPrice) ? (float) $requestResponse->paidPrice : '';
$requestResponse->basketId = isset($requestResponse->basketId) ? (int) $requestResponse->basketId : '';


if($requestResponse->paymentStatus == 'PENDING_CREDIT' && $requestResponse->status == 'success'){

$status = 'PENDING_CREDIT';
}
else {
$status = $requestResponse->status;
}

/* Insert Order Log */
$iyziOrderModel = $this->_iyziOrderFactory->create();
$iyziOrderModel->setData('payment_id',$requestResponse->paymentId);
$iyziOrderModel->setData('total_amount',$requestResponse->paidPrice);
$iyziOrderModel->setData('order_id',$requestResponse->basketId);
$iyziOrderModel->setData('status',$requestResponse->status);
$iyziOrderModel->setData('status',$status);
$iyziOrderModel->save($iyziOrderModel);



if($requestResponse->paymentStatus == 'PENDING_CREDIT' && $requestResponse->status == 'success'){
$this->_quote->setCheckoutMethod($this->_cartManagement::METHOD_GUEST);
$this->_quote->setIyzicoPaymentId($requestResponse->paymentId);
$this->_quote->setPayWithIyzicoPaymentStatus('PENDING_CREDIT');
$this->_cartManagement->placeOrder($this->_quote->getId());
$resultRedirect->setPath('checkout/onepage/success', ['_secure' => true]);
return $resultRedirect;
}

/* Error Redirect Start */
if(($requestResponse->paymentStatus != 'SUCCESS' && $requestResponse->paymentStatus != 'INIT_BANK_TRANSFER') || $requestResponse->status != 'success') {

Expand Down Expand Up @@ -270,6 +290,9 @@ public function execute()

}

if($requestResponse->paymentStatus == 'PENDING_CREDIT' && $requestResponse->status == 'success'){
$this->_quote->setIyzicoPaymentId($requestResponse->paymentId);
}
/* Set Payment Id */
$this->_quote->setIyzicoPaymentId($requestResponse->paymentId);

Expand Down
2 changes: 1 addition & 1 deletion Model/Payment/PayWithIyzico.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class PayWithIyzico extends \Magento\Payment\Model\Method\AbstractMethod
{
const PLUGIN_VERSION = '1.0.1';
const PLUGIN_VERSION = '1.1.0';
protected $_code = "paywithiyzico";
protected $_isOffline = true;

Expand Down
12 changes: 12 additions & 0 deletions Observer/PayWithIyzicoDataAssignObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ public function execute(Observer $observer)

$order = $observer->getEvent()->getOrder();

if($PayWithIyzicoPaymentStatus == 'PENDING_CREDIT')
{
$order->setState('pending');
$order->setStatus('pending');

$historyComment = __('Payment Success').$paymentId;
$order->addStatusHistoryComment($historyComment);

$historyComment = 'Alışveriş kredisi işlemi başlatıldı.';
$order->addStatusHistoryComment($historyComment);
}

if($PayWithIyzicoPaymentStatus == 'pending') {
$order->setState('pending');
$order->setStatus('pending');
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "iyzico/paywithiyzico",
"description": "pay with iyzico Payment Gateway For Magento 2",
"type": "magento2-module",
"version": "1.0.1",
"version": "1.1.0",
"license": "GPL-3.0",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Iyzico_PayWithIyzico" setup_version="1.0.1"/>
<module name="Iyzico_PayWithIyzico" setup_version="1.1.0"/>
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Checkout"/>
Expand Down

0 comments on commit bb470a0

Please sign in to comment.