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 #58 from heidelpay/develop
Merge for new release
- Loading branch information
Showing
55 changed files
with
2,536 additions
and
257 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
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,122 @@ | ||
<?php | ||
/** | ||
* Payment config representation handling the parameters every payment method has. | ||
* | ||
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
* @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. | ||
* | ||
* @link http://dev.heidelpay.com/ | ||
* | ||
* @author Simon Gabriel <[email protected]> | ||
* | ||
* @package heidelpay/magento2 | ||
*/ | ||
namespace Heidelpay\Gateway\Gateway\Config; | ||
|
||
use Heidelpay\Gateway\Traits\DumpGetterReturnsTrait; | ||
use \Magento\Payment\Gateway\Config\Config as BaseConfig; | ||
|
||
class HgwBasePaymentConfig extends BaseConfig implements HgwBasePaymentConfigInterface | ||
{ | ||
use DumpGetterReturnsTrait; | ||
|
||
const KEY_ACTIVE = 'active'; | ||
const KEY_CHANNEL = 'channel'; | ||
const KEY_ALLOW_SPECIFIC = 'allowspecific'; | ||
const KEY_SPECIFIC = 'specificcountry'; | ||
const KEY_RECOGNITION = 'recognition'; | ||
const KEY_MIN_ORDER_TOTAL = 'min_order_total'; | ||
const KEY_MAX_ORDER_TOTAL = 'max_order_total'; | ||
const KEY_NEEDS_EXTERNAL_INFO_IN_CHECKOUT = 'needs_external_info_in_checkout'; | ||
const KEY_BOOKING_MODE = 'bookingmode'; | ||
|
||
const VALUE_ALL_COUNTRIES = 0; | ||
const VALUE_SPECIFIC_COUNTRIES = 1; | ||
|
||
/** | ||
* Get payment configuration status | ||
* | ||
* @return bool | ||
*/ | ||
public function isActive() | ||
{ | ||
return (bool) $this->getValue(self::KEY_ACTIVE); | ||
} | ||
|
||
/** | ||
* Get payment channel id. | ||
* | ||
* @return string | ||
*/ | ||
public function getChannel() | ||
{ | ||
return $this->getValue(self::KEY_CHANNEL); | ||
} | ||
|
||
/** | ||
* Get allow specific flag | ||
* | ||
* @return int | ||
*/ | ||
public function getAllowSpecific() | ||
{ | ||
return (int) $this->getValue(self::KEY_ALLOW_SPECIFIC); | ||
} | ||
|
||
/** | ||
* Get allowed countries | ||
* | ||
* @return array | ||
*/ | ||
public function getSpecificCountries() | ||
{ | ||
if ($this->getAllowSpecific() === self::VALUE_ALL_COUNTRIES) { | ||
return []; | ||
} | ||
|
||
return explode(',', $this->getValue(self::KEY_SPECIFIC)); | ||
} | ||
|
||
/** todo-simon: is this int or float? */ | ||
/** | ||
* Get the minimum amount the total has to be in order to make this payment method available. | ||
* | ||
* @return int | ||
*/ | ||
public function getMinOrderTotal() | ||
{ | ||
return (int) $this->getValue(self::KEY_MIN_ORDER_TOTAL); | ||
} | ||
|
||
/* todo-simon: is this int or float? */ | ||
/** | ||
* Get the maximum amount the total has to be in order to make this payment method available. | ||
* | ||
* @return int | ||
*/ | ||
public function getMaxOrderTotal() | ||
{ | ||
return (int) $this->getValue(self::KEY_MAX_ORDER_TOTAL); | ||
} | ||
|
||
/** | ||
* Returns true if the payment method needs to be initialized to be rendered due to additional text | ||
* to be output in the payment form. | ||
* | ||
* @return bool | ||
*/ | ||
public function getNeedsExternalInfoInCheckout() | ||
{ | ||
return (bool) $this->getValue(self::KEY_NEEDS_EXTERNAL_INFO_IN_CHECKOUT); | ||
} | ||
|
||
/** | ||
* Get the configured booking mode e.g. authorize, debit,... | ||
* | ||
* @return int | ||
*/ | ||
public function getBookingMode() | ||
{ | ||
return $this->getValue(self::KEY_BOOKING_MODE); | ||
} | ||
} |
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,74 @@ | ||
<?php | ||
/** | ||
* Interface for the payment config representation handling the parameters every payment method has. | ||
* | ||
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
* @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. | ||
* | ||
* @link http://dev.heidelpay.com/ | ||
* | ||
* @author Simon Gabriel <[email protected]> | ||
* | ||
* @package heidelpay/magento2 | ||
*/ | ||
namespace Heidelpay\Gateway\Gateway\Config; | ||
|
||
interface HgwBasePaymentConfigInterface | ||
{ | ||
/** | ||
* Get payment configuration status | ||
* | ||
* @return bool | ||
*/ | ||
public function isActive(); | ||
|
||
/** | ||
* Get payment channel id. | ||
* | ||
* @return string | ||
*/ | ||
public function getChannel(); | ||
|
||
/** | ||
* Get allow specific flag | ||
* | ||
* @return int | ||
*/ | ||
public function getAllowSpecific(); | ||
|
||
/** | ||
* Get allowed countries | ||
* | ||
* @return array | ||
*/ | ||
public function getSpecificCountries(); | ||
|
||
/** | ||
* Get the minimum amount the total has to be in order to make this payment method available. | ||
* | ||
* @return int | ||
*/ | ||
public function getMinOrderTotal(); | ||
|
||
/** | ||
* Get the maximum amount the total has to be in order to make this payment method available. | ||
* | ||
* @return int | ||
*/ | ||
public function getMaxOrderTotal(); | ||
|
||
/** | ||
* Returns true if the payment method needs to be initialized to be rendered due to additional text | ||
* to be output in the payment form. | ||
* | ||
* @return bool | ||
*/ | ||
public function getNeedsExternalInfoInCheckout(); | ||
|
||
/** | ||
* Get the configured booking mode e.g. authorize, debit,... | ||
* | ||
* @return int | ||
*/ | ||
public function getBookingMode(); | ||
} |
Oops, something went wrong.