This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from heidelpay/develop
php api
- Loading branch information
Showing
12 changed files
with
414 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
namespace Heidelpay\Gateway\PaymentMethodes ; | ||
/** | ||
* Heidelpay credit card payment method | ||
* | ||
* This is the payment class for heidelpay credit card | ||
* | ||
* | ||
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
* @copyright Copyright © 2016-present Heidelberger Payment GmbH. All rights reserved. | ||
* @link https://dev.heidelpay.de/magento | ||
* @author Jens Richter | ||
* | ||
* @package Heidelpay | ||
* @subpackage Magento2 | ||
* @category Magento2 | ||
*/ | ||
use \Heidelpay\PhpApi\PaymentMethodes\CreditCardPaymentMethod as HeidelpayPhpApiCreditCard; | ||
use \Heidelpay\Gateway\PaymentMethodes\HeidelpayAbstractPaymentMethod; | ||
|
||
class HeidelpayCreditCardPaymentMethod extends HeidelpayAbstractPaymentMethod | ||
{ | ||
/** | ||
* Payment Code | ||
* @var string PayentCode | ||
*/ | ||
const CODE = 'hgwcc'; | ||
/** | ||
* Payment Code | ||
* @var string PayentCode | ||
*/ | ||
protected $_code = 'hgwcc'; | ||
/** | ||
* isGateway | ||
* @var boolean | ||
*/ | ||
protected $_isGateway = true; | ||
/** | ||
* canAuthorize | ||
* @var boolean | ||
*/ | ||
protected $_canAuthorize = true; | ||
|
||
/** | ||
* Active redirect | ||
* | ||
* This function will return false, if the used payment method needs additional | ||
* customer payment data to pursue. | ||
* @return boolean | ||
*/ | ||
|
||
public function activeRedirct() { | ||
return false ; | ||
} | ||
|
||
/** | ||
* Initial Request to heidelpay payment server to get the form / iframe url | ||
* {@inheritDoc} | ||
* @see \Heidelpay\Gateway\PaymentMethodes\HeidelpayAbstractPaymentMethod::getHeidelpayUrl() | ||
*/ | ||
|
||
public function getHeidelpayUrl($quote) { | ||
|
||
$this->_heidelpayPaymentMethod = new HeidelpayPhpApiCreditCard(); | ||
|
||
parent::getHeidelpayUrl($quote); | ||
|
||
/** Force PhpApi to just generate the request instead of sending it directly */ | ||
$this->_heidelpayPaymentMethod->_dryRun = TRUE; | ||
|
||
|
||
$url = explode( '/', $this->urlBuilder->getUrl('/', array('_secure' => true))); | ||
$PaymentFrameOrigin = $url[0].'//'.$url[2]; | ||
$PreventAsyncRedirect = 'FALSE'; | ||
$CssPath = $this->_scopeConfig->getValue ("payment/hgwmain/default_css", \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStore() ); | ||
|
||
|
||
/** Set payment type to debit */ | ||
$this->_heidelpayPaymentMethod->debit($PaymentFrameOrigin, $PreventAsyncRedirect, $CssPath); | ||
|
||
/** Prepare and send request to heidelpay */ | ||
$request = $this->_heidelpayPaymentMethod->getRequest()->prepareRequest(); | ||
$response = $this->_heidelpayPaymentMethod->getRequest()->send($this->_heidelpayPaymentMethod->getPaymentUrl(), $request); | ||
|
||
return $response[0]; | ||
|
||
|
||
|
||
} | ||
|
||
} |
Oops, something went wrong.