PK [lZR app/PK [lZR app/code/PK
nzR app/code/community/PK nzR app/code/community/Imoje/PK xT app/code/community/Imoje/Block/PK xT $ app/code/community/Imoje/Block/Form/PK
xTuR^ ^ 0 app/code/community/Imoje/Block/Form/Abstract.phpgetLayout()->getBlock('head')) {
$head->addCss('css/imoje/imoje.css');
}
return parent::_prepareLayout();
}
/**
* @param String $file
*
* @return string
*/
public function getImageSrc($file)
{
return $this->getSkinUrl('images/imoje/' . $file);
}
}
PK
xT
- app/code/community/Imoje/Block/Form/Imoje.phpsetTemplate('imoje/form.phtml');
}
}
PK
xTq( 0 app/code/community/Imoje/Block/Form/Paylater.phpsetTemplate('imoje/paylater_form.phtml');
}
}
PK
xTܱe e + app/code/community/Imoje/Block/Redirect.phpgetModuleDir('helper', 'Imoje') . '/Helper/Payment-core/src/Util.php');
include_once(Mage::getConfig()->getModuleDir('helper', 'Imoje') . '/Helper/Payment-core/src/Paywall.php');
/**
* Class Imoje_Block_Redirect
*/
class Imoje_Block_Redirect extends Mage_Core_Block_Template
{
/**
* @var Imoje_Model_Imoje | null
*/
private $methodInstance = null;
/**
* @return array
* @throws Mage_Core_Exception
*/
public function createForm()
{
return $this->getOrderData();
}
/**
* @return array
* @throws Mage_Core_Exception
*/
public function getOrderData()
{
return $this->getMethodInstance()->getRedirectionForm();
}
/**
* @return Imoje_Model_Imoje|Mage_Payment_Model_Method_Abstract|null
* @throws Mage_Core_Exception
*/
public function getMethodInstance()
{
if($this->methodInstance === null) {
$this->methodInstance = $this->_getOrder()->getPayment()->getMethodInstance();
}
return $this->methodInstance;
}
/**
* @return Mage_Sales_Model_Order | null
*/
protected function _getOrder()
{
$getOrder = $this->getOrder();
if($getOrder) {
return $getOrder;
}
if($orderIncrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
return Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
}
return null;
}
/**
* @return string
* @throws Mage_Core_Exception
*/
public function getOrderId()
{
return $this->getMethodInstance()->getOrderId();
}
}
PK
nzR` ` ) app/code/community/Imoje/Block/UrlIpn.phpgetModuleDir('model', 'Imoje') . '/Helper/Payment-core/vendor/autoload.php');
include_once(Mage::getConfig()->getModuleDir('model', 'Imoje') . '/Helper/Payment-core/src/Util.php');
include_once(Mage::getConfig()->getModuleDir('model', 'Imoje') . '/Helper/Payment-core/src/Configuration.php');
/**
* Class Imoje_NotificationController
*/
class Imoje_NotificationController extends Mage_Core_Controller_Front_Action
{
/**
* Verify notification and change status
*/
public function processAction()
{
$notification = new Notification(
Mage::getStoreConfig('payment/imoje/service_id'),
Mage::getStoreConfig('payment/imoje/service_key')
);
$result_check_request_notification = $notification->checkRequest();
$debug_mode = Mage::getStoreConfig('payment/imoje/debug_mode');
if(is_int($result_check_request_notification)) {
echo Notification::formatResponse(Notification::NS_ERROR, $result_check_request_notification, $debug_mode);
exit();
}
$order = Mage::getModel("sales/order")->loadByIncrementId($result_check_request_notification['transaction']['orderId']);
if(!$order) {
echo Notification::formatResponse(Notification::NS_ERROR, Notification::NC_ORDER_NOT_FOUND, $debug_mode);
exit();
}
if($order->getState() === Mage_Sales_Model_Order::STATE_PROCESSING) {
echo Notification::formatResponse(Notification::NS_OK, Notification::NC_ORDER_STATUS_NOT_CHANGED, $debug_mode);
exit();
}
$payment = $order->getPayment();
$transactionReference = $result_check_request_notification['transaction']['id'];
// Handle transaction states
switch($result_check_request_notification['transaction']['status']) {
case 'settled':
$payment->setTransactionId($transactionReference)
->setPreparedMessage(Mage::helper('core')->__('The transaction completed successfully'))
->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode())
->setIsTransactionApproved(true)
->setIsTransactionClosed(true)
->registerCaptureNotification($order->getTotalDue(), true)
->save();
$order->save();
if($invoice = $payment->getCreatedInvoice()) {
$comment = Mage::helper('imoje')->__('Notified customer about invoice #%s.', $invoice->getIncrementId());
$order->queueNewOrderEmail()
->addStatusHistoryComment($comment)
->setIsCustomerNotified(true)
->save();
}
echo Notification::formatResponse(Notification::NS_OK, Notification::NC_OK, $debug_mode);
die();
case 'rejected':
$comment = Mage::helper('imoje')->__('The payment has been rejected.');
$payment->setTransactionId($transactionReference)
->setPreparedMessage($comment)
->save();
$order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true, $comment)
->save();
echo Notification::formatResponse(Notification::NS_OK, Notification::NC_OK, $debug_mode);
die();
default:
echo Notification::formatResponse(Notification::NS_OK, Notification::NC_ORDER_STATUS_NOT_CHANGED, $debug_mode);
die();
}
}
}
PK
xT1Q;1
= app/code/community/Imoje/controllers/ProcessingController.phpgetOrderId();
$bodyCommentSentOrder = $this->getTextComment();
if(empty($orderId)
|| !$this->validateComment($bodyCommentSentOrder)) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getBaseUrl());
return;
};
$checkout = $this->_getCheckout();
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
if(!$order->getEmailSent()) {
$order->sendNewOrderEmail();
$order->setEmailSent(true);
}
$order->addStatusHistoryComment($bodyCommentSentOrder);
$order->save();
$html = $this->getLayout()->createBlock('imoje/redirect')
->setTemplate('imoje/redirect.phtml')->renderView();
$this->getResponse()->setBody($html);
Mage::getSingleton('checkout/cart')->truncate();
Mage::getSingleton('checkout/cart')->save();
$checkout->setPaymentpageQuoteId($checkout->getQuoteId());
$checkout->unsQuoteId();
$checkout->unsRedirectUrl();
}
/**
* @return string
*/
private function getTextComment()
{
return Mage::helper('imoje')->__('Order was sent to imoje paywall.');
}
/**
* @param string $comment
*
* @return bool
* @throws Mage_Core_Exception
*/
private function validateComment($comment)
{
$imojeBlockRedirect = new Imoje_Block_Redirect();
$orderId = $imojeBlockRedirect->getOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
return $order->getStatusHistoryCollection()->getFirstItem()->getComment() !== $comment;
}
/**
* @return Mage_Core_Model_Abstract|null
*/
private function _getCheckout()
{
return Mage::getSingleton('checkout/session');
}
/**
* Success action
*/
public function successAction()
{
$checkout = $this->_getCheckout();
$checkout->setQuoteId($checkout->getPaymentpageQuoteId(true));
$checkout->getQuote()->setIsActive(false)->save();
$this->_redirect('checkout/onepage/success');
}
/**
* Failure action
*/
public function failureAction()
{
$checkout = $this->_getCheckout();
$checkout->setQuoteId($checkout->getPaymentpageQuoteId(true));
$checkout->getQuote()->setIsActive(false)->save();
$this->_redirect('checkout/onepage/failure');
}
/**
* Cancel action
*/
public function cancelAction()
{
$checkout = $this->_getCheckout();
$checkout->setQuoteId($checkout->getPaymentpageQuoteId(true));
$checkout->addError(Mage::helper('imoje')->__('The order has been canceled.'));
$this->_redirect('checkout/cart');
}
}
PK xT app/code/community/Imoje/etc/PK
xT ' app/code/community/Imoje/etc/config.xml
2.0.1Imoje_BlockImoje_ModelImoje_HelperImojeImojeImojeimojeImoje.csvImoje.csvimoje.xml10imoje/ImojependingFast online transfers, BLIK and cards.PLNimoje00imoje/PaylaterpendingTwisto - imoje pay laterimoje
PK
xT
&% &% ' app/code/community/Imoje/etc/system.xml
670111
The module requires a configuration in the imoje administration panel. Go to imoje.ingbank.pl and log in to the administration panel. Go to stores tab and enter the notification address in the appropriate field and copy the configuration keys. Copy the keys into the fields described below.
adminhtml/system_config_form_field_heading1100selectadminhtml/system_config_source_yesno2111selectadminhtml/system_config_source_yesno3111selectadminhtml/system_config_source_yesno5111text6111text7111text8111text9111text10Default value: Fast online transfers, BLIK and cards.required-entry111text11Insert one or more currency as a ISO 4217 code separating by comma without space,
for example: PLN,EUR,USD
111adminhtml/system_config_form_field_heading12100multilineimoje/urlIpn13100670111adminhtml/system_config_form_field_heading1100selectadminhtml/system_config_source_yesno2111text4Default value: Twisto - imoje pay laterrequired-entry111
PK syT app/code/community/Imoje/Helper/PK
syT[| | ( app/code/community/Imoje/Helper/Data.php=5.4.0",
"ext-zlib": "*"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Imoje\\Payment\\": "src"
}
}
}
PK
nzR|R% 6 app/code/community/Imoje/Helper/Payment-core/README.md# Payment Core Library
It is a simple PHP library that allow implement payment gateway methods out of the box.
## Requirements
* [PHP](http://php.net/) needs to be a minimum version of 5.4.0
* [cURL](http://php.net/manual/en/book.curl.php) needs to be enabled
### Installation
1. `git clone`
2. `composer install`
## How to use:
Library provides few already created methods like generate form order or just generate form fields.
If you want to generate full form:
1. First you need to initialize Payment instance and provide environment, service key and service id. The last parameter `language` is optional, if if won't be provided the default value will be used (which is 'en')
2. Then simply run `$payment->buildOrderForm($orderData)` to build full form or `$payment->buildFormFields($orderData)` to build form fields.
## Examples:
##### Build full form:
Order data must have fields:
`amount, currency, orderId, customerFirstName, customerLastName`
Optional data:
`customerEmail, urlSuccess, urlFailure, urlReturn, urlNotification, cartData, version`
Example `$orderData`:
```php
$orderData = [
'amount' => (int) (1.33 * 100), //INT, price should be multipled by 100 so for example 1.33 will be 133
'currency' => 'PLN', // see suported currences in 'Supported variables' sectiom
'orderId' => '123456790',
'customerFirstName' => 'John',
'customerLastName' => 'Doe',
'customerEmail' => 'john@doe.com',
'urlSuccess' => 'https://example.com/success.php',
'urlFailure' => 'https://example.com/failure.php',
'urlReturn' => 'https://example.com/return.php',
];
```
```php
use Imoje\Payment\Paywall;
public function yourFunction()
{
// ...
$payment = new Paywall(\Imoje\Payment\Util::ENVIRONMENT_PRODUCTION, 'b1c8bd6c7411455aab3295c48fcf26a7', 'e692d208484b4d5887755362d0587a00', 'pl');
$form = $payment->buildOrderForm($orderData); // You can also pass second parameter `language` to generate form that will redirect to this language
}
```
The `$form` must contain $orderData and additional keys (signature must have which one hash method was use (for example sha256)), like:
`serviceId, merchantId, signature`
```php
```
and then you can wrap it to your own `form` HTML tag
```php