Skip to content

Commit

Permalink
fixed - marketplace-eqp
Browse files Browse the repository at this point in the history
  • Loading branch information
duongdiep212 committed Dec 20, 2018
1 parent 15f4903 commit 22df7cb
Show file tree
Hide file tree
Showing 26 changed files with 362 additions and 248 deletions.
1 change: 0 additions & 1 deletion Api/Data/InvoiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,4 @@ public function getQrCode();
* @return $this
*/
public function setQrCode($qrCode);

}
1 change: 0 additions & 1 deletion Api/Data/ItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,4 @@ public function getTaxPercent();
* @return $this
*/
public function setTaxPercent($taxPercent);

}
1 change: 0 additions & 1 deletion Api/Data/TotalInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ public function getAmount();
* @return $this
*/
public function setAmount($amount);

}
1 change: 0 additions & 1 deletion Api/Data/TransactionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,4 @@ public function setBankId($bankId);
* @return string|null
*/
public function getBankId();

}
18 changes: 8 additions & 10 deletions Api/PaynlInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ public function createAddress($line1, $line2, $city, $state, $postalCode, $count
public function createBillingInfo($email, $firstname, $lastname, $businessName, $phone, $addtionalInfo = '', $invoiceAddress);

/**
* @param string $line1
* @param string $line2
* @param string $city
* @param string $state
* @param string $postalCode
* @param string $countryCode
* @return \PayPal\Api\InvoiceAddress
*/
* @param string $line1
* @param string $line2
* @param string $city
* @param string $state
* @param string $postalCode
* @param string $countryCode
* @return \PayPal\Api\InvoiceAddress
*/
public function createInvoiceAddress($line1, $line2, $city, $state, $postalCode, $countryCode);

/**
Expand Down Expand Up @@ -262,6 +262,4 @@ public function recordPaymentForInvoice($invoice, $paymentDetail);
* @throws \Exception
*/
public function getAccessToken();


}
3 changes: 1 addition & 2 deletions Block/Adminhtml/Config/Instruction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Magestore\WebposPaynl\Block\Adminhtml\Config;


class Instruction extends \Magento\Config\Block\System\Config\Form\Fieldset
{
/**
Expand All @@ -29,4 +28,4 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
{
return $this->getChildHtml('paynl_setup_guide');
}
}
}
7 changes: 3 additions & 4 deletions Block/Adminhtml/Config/Setupguide.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Magestore\WebposPaynl\Block\Adminhtml\Config;


class Setupguide extends \Magento\Backend\Block\Template
{
/**
Expand All @@ -19,8 +18,8 @@ class Setupguide extends \Magento\Backend\Block\Template
* Get api test url
* @return string
*/
public function getTestApiUrl(){
public function getTestApiUrl()
{
return $this->getUrl('webpospaynl/api/test');
}

}
}
7 changes: 4 additions & 3 deletions Block/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ public function __construct(
/**
* @return string
*/
public function isEnableSendInvoice(){
public function isEnableSendInvoice()
{
return ($this->helper->isAllowCustomerPayWithEmail())?'true':'false';
}

/**
* @return bool
*/
public function isEnablePaynl(){
public function isEnablePaynl()
{
return $this->helper->isEnablePaynl();
}

}
8 changes: 5 additions & 3 deletions Controller/AbstractAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magestore\WebposPaynl\Api\PaynlServiceInterface $paypalService,
\Magestore\WebposPaynl\Helper\Data $helper
){
) {
parent::__construct($context);
$this->paypalService = $paypalService;
$this->helper = $helper;
Expand All @@ -48,15 +48,17 @@ public function __construct(
* @param $data
* @return mixed
*/
public function createJsonResult($data){
public function createJsonResult($data)
{
$resultJson = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_JSON);
return $resultJson->setData($data);
}

/**
* @return mixed
*/
public function createPageResult(){
public function createPageResult()
{
$resultPage = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_PAGE);
return $resultPage;
}
Expand Down
7 changes: 4 additions & 3 deletions Controller/Adminhtml/AbstractAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magestore\WebposPaynl\Api\PaynlServiceInterface $paypalService,
\Magestore\WebposPaynl\Helper\Data $helper
){
) {
parent::__construct($context);
$this->paypalService = $paypalService;
$this->helper = $helper;
Expand All @@ -47,8 +47,9 @@ public function __construct(
* @param $data
* @return mixed
*/
public function createJsonResult($data){
public function createJsonResult($data)
{
$resultJson = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_JSON);
return $resultJson->setData($data);
}
}
}
10 changes: 5 additions & 5 deletions Controller/Config/Paypalsignin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class Paynlsignin extends \Magento\Framework\App\Action\Action
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\App\Config\ConfigResource\ConfigInterface $resourceConfig,
\Magento\Framework\App\Config\ConfigResource\ConfigInterface $resourceConfig,
\Magestore\WebposPaynl\Model\Paynl $paynl,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory
){
) {
parent::__construct($context);
$this->resourceConfig = $resourceConfig;
$this->paynl = $paynl;
Expand All @@ -62,7 +62,7 @@ public function execute()
$authCode = $this->getRequest()->getParam('code');
$tokenInfo = '';
$result = '';
if($authCode) {
if ($authCode) {
try {
$tokenInfo = $this->paypal->getTokenInfo($authCode);
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
Expand All @@ -78,7 +78,7 @@ public function execute()
$response->setHeader('Content-type', 'text/plain');
$response->setContents($ex->getMessage());
}
if($tokenInfo) {
if ($tokenInfo) {
$accessToken = $tokenInfo->access_token;
$refreshToken = $tokenInfo->refresh_token;
if ($accessToken) {
Expand Down Expand Up @@ -136,4 +136,4 @@ public function getClosePopup()
</script>";
return $html;
}
}
}
7 changes: 4 additions & 3 deletions Controller/Payment/Success.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
namespace Magestore\WebposPaynl\Controller\Payment;

use Magestore\Webpos\Model\Exception;

/**
Expand All @@ -24,13 +25,13 @@ public function execute()
$paymentId = $this->getRequest()->getParam('paymentId');
$payerId = $this->getRequest()->getParam('PayerID');
$isApp = $this->getRequest()->getParam('isApp');
if($isApp) {
if ($isApp) {
if ($paymentId) {
$transactionId = $this->paypalService->finishAppPayment($paymentId, $payerId);
$response['transactionId'] = $transactionId;
$response['message'] = __('Payment has been completed');
}
if($response['transactionId']) {
if ($response['transactionId']) {
return $transactionId;
// exit();
} else {
Expand All @@ -43,7 +44,7 @@ public function execute()
$transactionId = $this->paypalService->finishPayment($paymentId, $payerId);
$response['transactionId'] = $transactionId;
$response['message'] = __('Payment has been completed');
} else{
} else {
$response['message'] = __('An error occur during the payment processing');
$response['success'] = false;
}
Expand Down
Loading

0 comments on commit 22df7cb

Please sign in to comment.