diff --git a/Frontend/WirecardCheckoutPage/Bootstrap.php b/Frontend/WirecardCheckoutPage/Bootstrap.php index badb6e4..33493f0 100755 --- a/Frontend/WirecardCheckoutPage/Bootstrap.php +++ b/Frontend/WirecardCheckoutPage/Bootstrap.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ require_once __DIR__ . '/Components/CSRFWhitelistAware.php'; @@ -65,7 +71,7 @@ public function getCapabilities() */ public function getVersion() { - return '1.2.13'; + return '1.3.0'; } /** diff --git a/Frontend/WirecardCheckoutPage/Components/CSRFWhitelistAware.php b/Frontend/WirecardCheckoutPage/Components/CSRFWhitelistAware.php index 83b57ed..e27eb91 100644 --- a/Frontend/WirecardCheckoutPage/Components/CSRFWhitelistAware.php +++ b/Frontend/WirecardCheckoutPage/Components/CSRFWhitelistAware.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ namespace Shopware\Components; diff --git a/Frontend/WirecardCheckoutPage/Components/Loader.php b/Frontend/WirecardCheckoutPage/Components/Loader.php index 38296ed..3201788 100644 --- a/Frontend/WirecardCheckoutPage/Components/Loader.php +++ b/Frontend/WirecardCheckoutPage/Components/Loader.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ /** diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/client.config.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/client.config.php index 374a5ca..9e734a0 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/client.config.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/client.config.php @@ -1,24 +1,46 @@ 'https://checkout.wirecard.com/page/init-server.php', - 'TOOLKIT_URL' => 'https://checkout.wirecard.com/page/toolkit.php', - 'MODULE_NAME' => 'WirecardCEE_QPay', - 'MODULE_VERSION' => '3.1.0', - 'DEPENDENCIES' => Array( - 'FRAMEWORK_NAME' => 'Zend_Framework', - 'FRAMEWORK_VERSION' => Array( - 'MINIMUM' => '1.11.10', - 'CURRENT' => Zend_Version::VERSION - ), + 'FRONTEND_URL' => 'https://checkout.wirecard.com/page/init-server.php', + 'TOOLKIT_URL' => 'https://checkout.wirecard.com/page/toolkit.php', + 'MODULE_NAME' => 'WirecardCEE_QPay', + 'MODULE_VERSION' => '3.0.3', + 'DEPENDENCIES' => Array( + 'FRAMEWORK_NAME' => 'Zend_Framework', + 'FRAMEWORK_VERSION' => Array( + 'MINIMUM' => '1.11.10', + 'CURRENT' => Zend_Version::VERSION ), - 'USE_DEBUG' => FALSE + ), + 'USE_DEBUG' => false ); \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/user.config.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/user.config.php index c0847fb..80c1af2 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/user.config.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Config/user.config.php @@ -1,13 +1,35 @@ Array( - 'CUSTOMER_ID' => 'D200001', - 'SHOP_ID' => '', - 'SECRET' => 'B8AKTPWBRMNBV455FG6M2DANE99WU2', - 'LANGUAGE' => 'en', - 'TOOLKIT_PASSWORD' => 'jcv45z' - ) + 'WirecardCEEQPayConfig' => Array( + 'CUSTOMER_ID' => 'D200001', + 'SHOP_ID' => '', + 'SECRET' => 'B8AKTPWBRMNBV455FG6M2DANE99WU2', + 'LANGUAGE' => 'en', + 'TOOLKIT_PASSWORD' => 'jcv45z' + ) ); \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Error.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Error.php index 3edb4ed..8ee20fe 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Error.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Error.php @@ -1,27 +1,51 @@ setMessage($message); } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Exception/BadMethodCallException.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Exception/BadMethodCallException.php index bdbe7a5..85cd533 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Exception/BadMethodCallException.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Exception/BadMethodCallException.php @@ -1,18 +1,42 @@ _fingerprintOrder = new WirecardCEE_Stdlib_FingerprintOrder(); //if no config was sent fallback to default config file - if(is_null($aConfig)) { + if (is_null($aConfig)) { $aConfig = WirecardCEE_QPay_Module::getConfig(); } @@ -219,26 +282,29 @@ public function __construct(Array $aConfig = null) { self::$FRAMEWORK_NAME = $this->getClientConfig()->DEPENDENCIES->FRAMEWORK_NAME; //now let's check if the CUSTOMER_ID, SHOP_ID, LANGUAGE and SECRET exist in $this->oUserConfig object that we created from config array - $sCustomerId = isset($this->oUserConfig->CUSTOMER_ID) ? trim($this->oUserConfig->CUSTOMER_ID) : null; - $sShopId = isset($this->oUserConfig->SHOP_ID) ? trim($this->oUserConfig->SHOP_ID) : null; - $sLanguage = isset($this->oUserConfig->LANGUAGE) ? trim($this->oUserConfig->LANGUAGE) : null; - $sSecret = isset($this->oUserConfig->SECRET) ? trim($this->oUserConfig->SECRET) : null; + $sCustomerId = isset($this->oUserConfig->CUSTOMER_ID) ? trim($this->oUserConfig->CUSTOMER_ID) : null; + $sShopId = isset($this->oUserConfig->SHOP_ID) ? trim($this->oUserConfig->SHOP_ID) : null; + $sLanguage = isset($this->oUserConfig->LANGUAGE) ? trim($this->oUserConfig->LANGUAGE) : null; + $sSecret = isset($this->oUserConfig->SECRET) ? trim($this->oUserConfig->SECRET) : null; //If not throw the InvalidArgumentException exception! if (empty($sCustomerId) || is_null($sCustomerId)) { - throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('CUSTOMER_ID passed to %s is invalid.', __METHOD__)); + throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('CUSTOMER_ID passed to %s is invalid.', + __METHOD__)); } if (empty($sLanguage) || is_null($sLanguage)) { - throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('LANGUAGE passed to %s is invalid.', __METHOD__)); + throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('LANGUAGE passed to %s is invalid.', + __METHOD__)); } if (empty($sSecret) || is_null($sSecret)) { - throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('SECRET passed to %s is invalid.', __METHOD__)); + throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('SECRET passed to %s is invalid.', + __METHOD__)); } // we're using md5 for hash-ing - WirecardCEE_Stdlib_Fingerprint::setHashAlgorithm(WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_MD5); + WirecardCEE_Stdlib_Fingerprint::setHashAlgorithm(WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_HMAC_SHA512); //everything ok! let's set the fields $this->_setField(self::CUSTOMER_ID, $sCustomerId); @@ -255,27 +321,48 @@ public function __construct(Array $aConfig = null) { * @throws WirecardCEE_QPay_Exception_InvalidArgumentException * @return WirecardCEE_QPay_Response_Initiation */ - public function initiate() { + public function initiate() + { //First let's check if all mandatory fields are set! If not add them to $aMissingFields Array Object $aMissingFields = new ArrayObject(); - if(!$this->_isFieldSet(self::AMOUNT)) $aMissingFields->append(self::AMOUNT); - if(!$this->_isFieldSet(self::PAYMENT_TYPE)) $aMissingFields->append(self::PAYMENT_TYPE); - if(!$this->_isFieldSet(self::ORDER_DESCRIPTION)) $aMissingFields->append(self::ORDER_DESCRIPTION); - if(!$this->_isFieldSet(self::SUCCESS_URL)) $aMissingFields->append(self::SUCCESS_URL); - if(!$this->_isFieldSet(self::CANCEL_URL)) $aMissingFields->append(self::CANCEL_URL); - if(!$this->_isFieldSet(self::FAILURE_URL)) $aMissingFields->append(self::FAILURE_URL); - if(!$this->_isFieldSet(self::SERVICE_URL)) $aMissingFields->append(self::SERVICE_URL); - if(!$this->_isFieldSet(self::CURRENCY)) $aMissingFields->append(self::CURRENCY); - if(!$this->_isFieldSet(self::LANGUAGE)) $aMissingFields->append(self::LANGUAGE); - if(!$this->_isConsumerDataValid()) $aMissingFields->append('Consumer IP Address, Consumer User Agent'); + if (!$this->_isFieldSet(self::AMOUNT)) { + $aMissingFields->append(self::AMOUNT); + } + if (!$this->_isFieldSet(self::PAYMENT_TYPE)) { + $aMissingFields->append(self::PAYMENT_TYPE); + } + if (!$this->_isFieldSet(self::ORDER_DESCRIPTION)) { + $aMissingFields->append(self::ORDER_DESCRIPTION); + } + if (!$this->_isFieldSet(self::SUCCESS_URL)) { + $aMissingFields->append(self::SUCCESS_URL); + } + if (!$this->_isFieldSet(self::CANCEL_URL)) { + $aMissingFields->append(self::CANCEL_URL); + } + if (!$this->_isFieldSet(self::FAILURE_URL)) { + $aMissingFields->append(self::FAILURE_URL); + } + if (!$this->_isFieldSet(self::SERVICE_URL)) { + $aMissingFields->append(self::SERVICE_URL); + } + if (!$this->_isFieldSet(self::CURRENCY)) { + $aMissingFields->append(self::CURRENCY); + } + if (!$this->_isFieldSet(self::LANGUAGE)) { + $aMissingFields->append(self::LANGUAGE); + } + if (!$this->_isConsumerDataValid()) { + $aMissingFields->append('Consumer IP Address, Consumer User Agent'); + } //Are there any errors in the $aMissingFields object? //If so throw the InvalidArgumentException and print all the fields that are missing! - if($aMissingFields->count()) { + if ($aMissingFields->count()) { throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf( - "Could not initiate QPay! Missing mandatory field(s): %s; thrown in %s; Please use the appropriate setter functions to set missing fields.", - implode(", ", (array) $aMissingFields), __METHOD__)); + "Could not initiate QPay! Missing mandatory field(s): %s; thrown in %s; Please use the appropriate setter functions to set missing fields.", + implode(", ", (array)$aMissingFields), __METHOD__)); } //this is where the magic happens! We send our data to response object and hopefully get back the response object with 'redirectUrl'. @@ -293,7 +380,8 @@ public function initiate() { * @return WirecardCEE_QPay_FrontendClient * @formatter:on */ - public function setAmount($amount) { + public function setAmount($amount) + { $this->_setField(self::AMOUNT, $amount); return $this; } @@ -304,7 +392,8 @@ public function setAmount($amount) { * @param string $sCurrency * @return WirecardCEE_QPay_FrontendClient */ - public function setCurrency($sCurrency) { + public function setCurrency($sCurrency) + { $this->_setField(self::CURRENCY, $sCurrency); return $this; } @@ -315,7 +404,8 @@ public function setCurrency($sCurrency) { * @param string $sPaymentType * @return WirecardCEE_QPay_FrontendClient */ - public function setPaymentType($sPaymentType) { + public function setPaymentType($sPaymentType) + { $this->_setField(self::PAYMENT_TYPE, $sPaymentType); return $this; } @@ -326,7 +416,8 @@ public function setPaymentType($sPaymentType) { * @param string $sDesc * @return WirecardCEE_QPay_FrontendClient */ - public function setOrderDescription($sDesc) { + public function setOrderDescription($sDesc) + { $this->_setField(self::ORDER_DESCRIPTION, $sDesc); return $this; } @@ -337,7 +428,8 @@ public function setOrderDescription($sDesc) { * @param string $sUrl * @return WirecardCEE_QPay_FrontendClient */ - public function setSuccessUrl($sUrl) { + public function setSuccessUrl($sUrl) + { $this->_setField(self::SUCCESS_URL, $sUrl); return $this; } @@ -348,7 +440,8 @@ public function setSuccessUrl($sUrl) { * @param string $sUrl * @return WirecardCEE_QPay_FrontendClient */ - public function setCancelUrl($sUrl) { + public function setCancelUrl($sUrl) + { $this->_setField(self::CANCEL_URL, $sUrl); return $this; } @@ -359,7 +452,8 @@ public function setCancelUrl($sUrl) { * @param string $sUrl * @return WirecardCEE_QPay_FrontendClient */ - public function setFailureUrl($sUrl) { + public function setFailureUrl($sUrl) + { $this->_setField(self::FAILURE_URL, $sUrl); return $this; } @@ -370,7 +464,8 @@ public function setFailureUrl($sUrl) { * @param string $sUrl * @return WirecardCEE_QPay_FrontendClient */ - public function setServiceUrl($sUrl) { + public function setServiceUrl($sUrl) + { $this->_setField(self::SERVICE_URL, $sUrl); return $this; } @@ -381,7 +476,8 @@ public function setServiceUrl($sUrl) { * @param string $pendingUrl * @return WirecardCEE_QPay_FrontendClient */ - public function setPendingUrl($pendingUrl) { + public function setPendingUrl($pendingUrl) + { $this->_setField(self::PENDING_URL, $pendingUrl); return $this; } @@ -393,7 +489,8 @@ public function setPendingUrl($pendingUrl) { * @param string $financialInstitution * @return WirecardCEE_QPay_FrontendClient */ - public function setFinancialInstitution($financialInstitution) { + public function setFinancialInstitution($financialInstitution) + { $this->_setField(self::FINANCIAL_INSTITUTION, $financialInstitution); return $this; } @@ -404,7 +501,8 @@ public function setFinancialInstitution($financialInstitution) { * @param string $displayText * @return WirecardCEE_QPay_FrontendClient */ - public function setDisplayText($displayText) { + public function setDisplayText($displayText) + { $this->_setField(self::DISPLAY_TEXT, $displayText); return $this; } @@ -415,7 +513,8 @@ public function setDisplayText($displayText) { * @param string $confirmUrl * @return WirecardCEE_QPay_FrontendClient */ - public function setConfirmUrl($confirmUrl) { + public function setConfirmUrl($confirmUrl) + { $this->_setField(self::CONFIRM_URL, $confirmUrl); return $this; } @@ -426,7 +525,8 @@ public function setConfirmUrl($confirmUrl) { * @param string $imageUrl * @return WirecardCEE_QPay_FrontendClient */ - public function setImageUrl($imageUrl) { + public function setImageUrl($imageUrl) + { $this->_setField(self::IMAGE_URL, $imageUrl); return $this; } @@ -437,7 +537,8 @@ public function setImageUrl($imageUrl) { * @param string $windowName * @return WirecardCEE_QPay_FrontendClient */ - public function setWindowName($windowName) { + public function setWindowName($windowName) + { $this->_requestData[self::WINDOW_NAME] = $windowName; return $this; } @@ -448,7 +549,8 @@ public function setWindowName($windowName) { * @param bool $duplicateRequestCheck * @return WirecardCEE_QPay_FrontendClient */ - public function setDuplicateRequestCheck($duplicateRequestCheck) { + public function setDuplicateRequestCheck($duplicateRequestCheck) + { if ($duplicateRequestCheck) { $this->_setField(self::DUPLICATE_REQUEST_CHECK, self::$BOOL_TRUE); } @@ -468,6 +570,35 @@ public function setCustomerStatement($customerStatement) return $this; } + /** + * Setter for TransactionIdentifier + * + * @param string $sTxIdent + * + * @return WirecardCEE_QPay_FrontendClient + */ + public function setTransactionIdentifier($sTxIdent) + { + $this->_setField(self::TX_IDENT, $sTxIdent); + + return $this; + } + + /** + * setter for Paymenttype sort oder + * + * @param array $paymentTypes + * + * @return WirecardCEE_QPay_FrontendClient + */ + public function setPaymenttypeSortOrder($paymentTypes) + { + $this->_setField(self::PAYMENTTYPE_SORTORDER, implode(',', $paymentTypes)); + + return $this; + } + + /** * @param string|null $prefix Prefix, e.g. Shopname * @param string|null $uniqString Uniqid @@ -477,8 +608,9 @@ public function setCustomerStatement($customerStatement) */ public function generateCustomerStatement($prefix = null, $uniqString = null) { - if (!$this->_isFieldSet(self::PAYMENT_TYPE)) + if (!$this->_isFieldSet(self::PAYMENT_TYPE)) { throw new Exception('Paymenttype field is not set.'); + } $this->_setField( self::CUSTOMER_STATEMENT, @@ -494,8 +626,9 @@ public function generateCustomerStatement($prefix = null, $uniqString = null) */ public function getCustomerStatement() { - if (!$this->_isFieldSet(self::CUSTOMER_STATEMENT)) + if (!$this->_isFieldSet(self::CUSTOMER_STATEMENT)) { return null; + } return $this->_requestData[self::CUSTOMER_STATEMENT]; } @@ -506,7 +639,8 @@ public function getCustomerStatement() * @param string $orderReference * @return WirecardCEE_QPay_FrontendClient */ - public function setOrderReference($orderReference) { + public function setOrderReference($orderReference) + { $this->_setField(self::ORDER_REFERENCE, $orderReference); return $this; } @@ -517,7 +651,8 @@ public function setOrderReference($orderReference) { * @param string $autoDeposit * @return WirecardCEE_QPay_FrontendClient */ - public function setAutoDeposit($bBool) { + public function setAutoDeposit($bBool) + { $this->_setField(self::AUTO_DEPOSIT, ($bBool) ? self::$BOOL_TRUE : self::$BOOL_FALSE); return $this; } @@ -528,7 +663,8 @@ public function setAutoDeposit($bBool) { * @param string $maxRetries * @return WirecardCEE_QPay_FrontendClient */ - public function setMaxRetries($maxRetries) { + public function setMaxRetries($maxRetries) + { $maxRetries = intval($maxRetries); if ($maxRetries >= 0) { $this->_setField(self::MAX_RETRIES, $maxRetries); @@ -536,13 +672,38 @@ public function setMaxRetries($maxRetries) { return $this; } + /** + * setter for the customer merchant crm id + * @param $userEmail + * + * @return $this + */ + public function createConsumerMerchantCrmId($userEmail) + { + $this->_setField(self::CONSUMER_MERCHANT_CRM_ID, md5($userEmail)); + return $this; + } + + /** + * setter for the consumer shipping profile + * + * @param string $shippingProfile + * @return $this + */ + public function setShippingProfile($shippingProfile) + { + $this->_setField(self::SHIPPING_PROFILE, $shippingProfile); + return $this; + } + /** * setter for the qpay parameter orderNumber * * @param int $orderNumber * @return WirecardCEE_QPay_FrontendClient */ - public function setOrderNumber($orderNumber) { + public function setOrderNumber($orderNumber) + { $this->_setField(self::ORDER_NUMBER, $orderNumber); return $this; } @@ -553,20 +714,62 @@ public function setOrderNumber($orderNumber) { * @param string $confirmMail * @return WirecardCEE_QPay_FrontendClient */ - public function setConfirmMail($confirmMail) { + public function setConfirmMail($confirmMail) + { $this->_setField(self::CONFIRM_MAIL, $confirmMail); return $this; } + /** + * setter for the qpay parameter backgroundColor + * + * @param string $backgroundColor + * + * @return WirecardCEE_QPay_FrontendClient + */ + public function setBackgroundColor($backgroundColor) + { + $this->_setField(self::BACKGROUND_COLOR, $backgroundColor); + + return $this; + } + + /** + * setter for the qpay parameter backgroundColor + * + * @param string $layout + * + * @return WirecardCEE_QPay_FrontendClient + */ + public function setLayout($layout) + { + $this->_setField(self::LAYOUT, $layout); + + return $this; + } + /** * adds given consumerData to qpay request * * @param WirecardCEE_QPay_Request_Initiation_ConsumerData $consumerData * @return WirecardCEE_QPay_FrontendClient */ - public function setConsumerData(WirecardCEE_Stdlib_ConsumerData $consumerData) { + public function setConsumerData(WirecardCEE_Stdlib_ConsumerData $consumerData) + { $this->oConsumerData = $consumerData; - foreach($consumerData->getData() as $key => $value) { + foreach ($consumerData->getData() as $key => $value) { + $this->_setField($key, $value); + } + return $this; + } + + /** + * @param WirecardCEE_Stdlib_Basket $basket + * @return $this + */ + public function setBasket(WirecardCEE_Stdlib_Basket $basket) { + $this->oBasket = $basket; + foreach($basket->getData() AS $key => $value) { $this->_setField($key, $value); } return $this; @@ -577,7 +780,8 @@ public function setConsumerData(WirecardCEE_Stdlib_ConsumerData $consumerData) { * @param string $plVersion * @return WirecardCEE_QPay_FrontendClient */ - public function setPluginVersion($sPluginVersion) { + public function setPluginVersion($sPluginVersion) + { $this->_setField(self::PLUGIN_VERSION, $sPluginVersion); return $this; } @@ -587,7 +791,8 @@ public function setPluginVersion($sPluginVersion) { * * @return WirecardCEE_QPay_Response_Initiation */ - public function getResponse() { + public function getResponse() + { if (!$this->oResponse instanceof WirecardCEE_QPay_Response_Initiation) { throw new Exception(sprintf("%s should be called after the initiate() function!", __METHOD__)); } @@ -602,7 +807,8 @@ public function getResponse() { * @param type $name * @param type $value */ - public function __set($name, $value) { + public function __set($name, $value) + { $this->_setField($name, $value); } @@ -618,11 +824,17 @@ public function __set($name, $value) { * @param array|null $libraries * @return string base64 encoded pluginVersion */ - public static function generatePluginVersion($shopName, $shopVersion, $pluginName, $pluginVersion, $libraries = null) { + public static function generatePluginVersion( + $shopName, + $shopVersion, + $pluginName, + $pluginVersion, + $libraries = null + ) { $libraryString = self::_getQPayClientVersionString(); $libraryString .= ', ' . self::_getZendFrameworkVersionString(); if (is_array($libraries)) { - foreach($libraries as $libName => $libVersion) { + foreach ($libraries as $libName => $libVersion) { $libraryString .= ", {$libName} {$libVersion}"; } } @@ -642,11 +854,13 @@ public static function generatePluginVersion($shopName, $shopVersion, $pluginNam * * @return boolean */ - protected function _isConsumerDataValid() { + protected function _isConsumerDataValid() + { // if consumer data is not an instance of WirecardCEE_Stdlib_ConsumerData // or if it's empty don't even bother with any checkings... - if (empty($this->oConsumerData) || !$this->oConsumerData instanceof WirecardCEE_Stdlib_ConsumerData) + if (empty($this->oConsumerData) || !$this->oConsumerData instanceof WirecardCEE_Stdlib_ConsumerData) { return false; + } // @see WirecardCEE_QPay_Request_Initiation_ConsumerData $sConsumerIpAddressField = WirecardCEE_Stdlib_ConsumerData::getConsumerIpAddressFieldName(); @@ -659,7 +873,7 @@ protected function _isConsumerDataValid() { // check return (isset($aConsumerData[$sConsumerIpAddressField]) && !empty($aConsumerData[$sConsumerIpAddressField])) && - (isset($aConsumerData[$sConsumerUserAgentField]) && !empty($aConsumerData[$sConsumerUserAgentField])); + (isset($aConsumerData[$sConsumerUserAgentField]) && !empty($aConsumerData[$sConsumerUserAgentField])); } /** @@ -668,7 +882,8 @@ protected function _isConsumerDataValid() { * @see WirecardCEE_Stdlib_Client_ClientAbstract::_getRequestUrl() * @return string */ - protected function _getRequestUrl() { + protected function _getRequestUrl() + { return $this->oClientConfig->FRONTEND_URL . '/init'; } @@ -678,7 +893,8 @@ protected function _getRequestUrl() { * @access private * @return String */ - protected static function _getQPayClientVersionString() { + protected static function _getQPayClientVersionString() + { return self::$LIBRARY_NAME . ' ' . self::$LIBRARY_VERSION; } @@ -688,9 +904,10 @@ protected static function _getQPayClientVersionString() { * @access private * @return string */ - protected static function _getZendFrameworkVersionString() { + protected static function _getZendFrameworkVersionString() + { if (!class_exists('Zend_Version', false)) { - require_once ('Zend/Version.php'); + require_once('Zend/Version.php'); } return self::$FRAMEWORK_NAME . ' ' . Zend_Version::VERSION; @@ -700,7 +917,8 @@ protected static function _getZendFrameworkVersionString() { * Returns the user agent string * @return string */ - protected function _getUserAgent() { + protected function _getUserAgent() + { return "{$this->oClientConfig->MODULE_NAME};{$this->oClientConfig->MODULE_VERSION}"; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Module.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Module.php index 2afcc69..1d69e7d 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Module.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Module.php @@ -1,21 +1,43 @@ _getField(self::REDIRECT_URL)) ? self::STATE_SUCCESS : self::STATE_FAILURE; + public function getStatus() + { + return ( $this->_getField(self::REDIRECT_URL) ) ? self::STATE_SUCCESS : self::STATE_FAILURE; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/ResponseAbstract.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/ResponseAbstract.php index 250ab82..667db54 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/ResponseAbstract.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/ResponseAbstract.php @@ -1,22 +1,45 @@ _response[self::$ERROR_MESSAGE])) { + if (isset( $this->_response[self::$ERROR_MESSAGE] )) { $oError = new WirecardCEE_QPay_Error($this->_response[self::$ERROR_MESSAGE]); - if(isset($this->_response[self::$ERROR_CONSUMER_MESSAGE])) + if (isset( $this->_response[self::$ERROR_CONSUMER_MESSAGE] )) { $oError->setConsumerMessage($this->_response[self::$ERROR_CONSUMER_MESSAGE]); + } } return $oError; diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/ApproveReversal.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/ApproveReversal.php index c66dc5d..28bc78f 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/ApproveReversal.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/ApproveReversal.php @@ -1,19 +1,42 @@ _getField(self::$PAYMENT_NUMBER); - } + /** + * getter for the returned paymentNumber + * + * @return string + */ + public function getPaymentNumber() + { + return $this->_getField(self::$PAYMENT_NUMBER); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/DepositReversal.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/DepositReversal.php index 4b02f77..daa9919 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/DepositReversal.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/DepositReversal.php @@ -1,19 +1,42 @@ - */ - protected function _getField($name) { - return (array_key_exists($name, $this->_data)) ? $this->_data[$name] : false; - } + /** + * getter for given field + * + * @param string $name + * + * @return mixed + */ + protected function _getField($name) + { + return ( array_key_exists($name, $this->_data) ) ? $this->_data[$name] : false; + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/GetOrderDetails.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/GetOrderDetails.php index 6d5c8b8..73e086b 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/GetOrderDetails.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/GetOrderDetails.php @@ -1,72 +1,101 @@ _getField(self::$ORDER); - $payments = $this->_getField(self::$PAYMENT); - $credits = $this->_getField(self::$CREDIT); + $orders = $this->_getField(self::$ORDER); + $payments = $this->_getField(self::$PAYMENT); + $credits = $this->_getField(self::$CREDIT); - $order = $orders[0]; - $order['paymentData'] = is_array($payments[0]) ? $payments[0] : Array(); - $order['creditData'] = is_array($credits[0]) ? $credits[0] : Array(); + $order = $orders[0]; + $order['paymentData'] = is_array($payments[0]) ? $payments[0] : Array(); + $order['creditData'] = is_array($credits[0]) ? $credits[0] : Array(); - $this->_order = new WirecardCEE_QPay_Response_Toolkit_Order($order); + $this->_order = new WirecardCEE_QPay_Response_Toolkit_Order($order); - } + } - /** - * getter for the returned order object - * - * @return WirecardCEE_QPay_Response_Toolkit_Order - */ - public function getOrder() { - return $this->_order; - } + /** + * getter for the returned order object + * + * @return WirecardCEE_QPay_Response_Toolkit_Order + */ + public function getOrder() + { + return $this->_order; + } } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order.php index 6ec5e61..d02099f 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order.php @@ -1,406 +1,473 @@ _setPayments($orderData['paymentData']); - $this->_setCredits($orderData['creditData']); - - unset($orderData['paymentData']); - unset($orderData['creditData']); - - $this->_data = $orderData; - } - - /** - * setter for payment object iterator - * - * @access private - * @param string[] $payments - */ - private function _setPayments($paymentEntries) { - $payments = Array(); - foreach($paymentEntries as $paymentEntry) { - switch($paymentEntry['paymentType']) { - case self::$PAYMENTTYPE_PAYPAL: - $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Paypal($paymentEntry); - break; - case self::$PAYMENTTYPE_SOFORTUEBERWEISUNG: - $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Sofortueberweisung($paymentEntry); - break; - case self::$PAYMENTTYPE_IDEAL: - $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Ideal($paymentEntry); - break; - default: - $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment($paymentEntry); - break; - } - } - $this->_payments = new WirecardCEE_QPay_Response_Toolkit_Order_PaymentIterator($payments); - } - - /** - * setter for credit object iterator - * - * @access private - * @param string[] $credits - */ - private function _setCredits($creditEntries) { - $credits = Array(); - foreach($creditEntries as $creditEntry) { - $credits[] = new WirecardCEE_QPay_Response_Toolkit_Order_Credit($creditEntry); - } - $this->_credits = new WirecardCEE_QPay_Response_Toolkit_Order_CreditIterator($credits); - } - - /** - * getter for order merchant number - * - * @return string - */ - public function getMerchantNumber() { - return $this->_getField(self::$MERCHANT_NUMBER); - } - - /** - * getter for order number - * - * @return string - */ - public function getOrderNumber() { - return $this->_getField(self::$ORDER_NUMBER); - } - - /** - * getter for used payment type - * - * @return string - */ - public function getPaymentType() { - return $this->_getField(self::$PAYMENT_TYPE); - } - - /** - * getter for orders amount - * - * @return string - */ - public function getAmount() { - return $this->_getField(self::$AMOUNT); - } - - /** - * getter for orders brand - * - * @return string - */ - public function getBrand() { - return $this->_getField(self::$BRAND); - } - - /** - * getter for orders currency - * - * @return type - */ - public function getCurrency() { - return $this->_getField(self::$CURRENCY); - } - - /** - * getter for the order description - * - * @return string - */ - public function getOrderDescription() { - return $this->_getField(self::$ORDER_DESCRIPTION); - } - - /** - * getter for the acquirer name - * - * @return string - */ - public function getAcquirer() { - return $this->_getField(self::$ACQUIRER); - } - - /** - * getter for the contract number - * - * @return string - */ - public function getContractNumber() { - return $this->_getField(self::$CONTRACT_NUMBER); - } - - /** - * getter for allowed follow-up operations - * - * @return string[] - */ - public function getOperationsAllowed() { - if ($this->_getField(self::$OPERATIONS_ALLOWED) == '') { - return Array(); - } - else { - return explode(',', $this->_getField(self::$OPERATIONS_ALLOWED)); - } - } - - /** - * getter for order reference - * - * @return string - */ - public function getOrderReference() { - return $this->_getField(self::$ORDER_REFERENCE); - } - - /** - * getter for customer statement text - * - * @return string - */ - public function getCustomerStatement() { - return $this->_getField(self::$CUSTOMER_STATEMENT); - } - - /** - * getter for the order text - * - * @return string - */ - public function getOrderText() { - return $this->_getField(self::$ORDER_TEXT); - } - - /** - * getter for the time this order has been created - * - * @return DateTime - */ - public function getTimeCreated() { - return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_CREATED)); - } - - /** - * getter for the last time this order has been modified - * - * @return DateTime - */ - public function getTimeModified() { - return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_MODIFIED)); - } - - /** - * getter for the current order state - * - * @return string - */ - public function getState() { - return $this->_getField(self::$STATE); - } - - /** - * getter for the source order number - * - * @return string - */ - public function getSourceOrderNumber() { - return $this->_getField(self::$SOURCE_ORDER_NUMBER); - } - - /** - * getter for corresponding payment objects - * - * @return WirecardCEE_QPay_Response_Toolkit_Order_PaymentIterator - */ - public function getPayments() { - return $this->_payments; - } - - /** - * getter for corresponding credit objects - * - * @return WirecardCEE_QPay_Response_Toolkit_Order_CreditIterator - */ - public function getCredits() { - return $this->_credits; - } +class WirecardCEE_QPay_Response_Toolkit_Order extends WirecardCEE_QPay_Response_Toolkit_FinancialObject +{ + /** + * CreditIterator object holder + * + * @var WirecardCEE_QPay_Response_Toolkit_Order_CreditIterator + * @internal + */ + private $_credits; + + /** + * PaymentIterator object holder + * + * @var WirecardCEE_QPay_Response_Toolkit_Order_PaymentIterator + * @internal + */ + private $_payments; + + /** + * Merchant number + * + * @staticvar string + * @internal + */ + private static $MERCHANT_NUMBER = 'merchantNumber'; + + /** + * Order number + * + * @staticvar string + * @internal + */ + private static $ORDER_NUMBER = 'orderNumber'; + + /** + * Payment type + * + * @staticvar string + * @internal + */ + private static $PAYMENT_TYPE = 'paymentType'; + + /** + * Amount + * + * @staticvar string + * @internal + */ + private static $AMOUNT = 'amount'; + + /** + * Brand + * + * @staticvar string + * @internal + */ + private static $BRAND = 'brand'; + + /** + * Currency + * + * @staticvar string + * @internal + */ + private static $CURRENCY = 'currency'; + + /** + * Order description + * + * @staticvar string + * @internal + */ + private static $ORDER_DESCRIPTION = 'orderDescription'; + + /** + * Acquirer + * + * @staticvar string + * @internal + */ + private static $ACQUIRER = 'acquirer'; + + /** + * Contract number + * + * @staticvar string + * @internal + */ + private static $CONTRACT_NUMBER = 'contractNumber'; + + /** + * Operations allowes + * + * @staticvar string + * @internal + */ + private static $OPERATIONS_ALLOWED = 'operationsAllowed'; + + /** + * Order reference + * + * @staticvar string + * @internal + */ + private static $ORDER_REFERENCE = 'orderReference'; + + /** + * Customer statement + * + * @staticvar string + * @internal + */ + private static $CUSTOMER_STATEMENT = 'customerStatement'; + + /** + * Order text + * + * @staticvar string + * @internal + */ + private static $ORDER_TEXT = 'orderText'; + + /** + * Time created + * + * @staticvar string + * @internal + */ + private static $TIME_CREATED = 'timeCreated'; + + /** + * Time modified + * + * @staticvar string + * @internal + */ + private static $TIME_MODIFIED = 'timeModified'; + + /** + * State + * + * @staticvar string + * @internal + */ + private static $STATE = 'state'; + + /** + * Source number + * + * @staticvar string + * @internal + */ + private static $SOURCE_ORDER_NUMBER = 'sourceOrderNumber'; + + /** + * Merchant number + * + * @staticvar string + * @internal + */ + private static $PAYMENTTYPE_PAYPAL = 'PPL'; + + /** + * Merchant number + * + * @staticvar string + * @internal + */ + private static $PAYMENTTYPE_SOFORTUEBERWEISUNG = 'SUE'; + + /** + * Merchant number + * + * @staticvar string + * @internal + */ + private static $PAYMENTTYPE_IDEAL = 'IDL'; + + /** + * creates an instance of the {@link + * WirecardCEE_QPay_Response_Toolkit_Order} object + * + * @param string[] $orderData + */ + public function __construct($orderData) + { + $this->_setPayments($orderData['paymentData']); + $this->_setCredits($orderData['creditData']); + + unset( $orderData['paymentData'] ); + unset( $orderData['creditData'] ); + + $this->_data = $orderData; + } + + /** + * setter for payment object iterator + * + * @access private + * + * @param string[] $payments + */ + private function _setPayments($paymentEntries) + { + $payments = Array(); + foreach ($paymentEntries as $paymentEntry) { + switch ($paymentEntry['paymentType']) { + case self::$PAYMENTTYPE_PAYPAL: + $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Paypal($paymentEntry); + break; + case self::$PAYMENTTYPE_SOFORTUEBERWEISUNG: + $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Sofortueberweisung($paymentEntry); + break; + case self::$PAYMENTTYPE_IDEAL: + $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Ideal($paymentEntry); + break; + default: + $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment($paymentEntry); + break; + } + } + $this->_payments = new WirecardCEE_QPay_Response_Toolkit_Order_PaymentIterator($payments); + } + + /** + * setter for credit object iterator + * + * @access private + * + * @param string[] $credits + */ + private function _setCredits($creditEntries) + { + $credits = Array(); + foreach ($creditEntries as $creditEntry) { + $credits[] = new WirecardCEE_QPay_Response_Toolkit_Order_Credit($creditEntry); + } + $this->_credits = new WirecardCEE_QPay_Response_Toolkit_Order_CreditIterator($credits); + } + + /** + * getter for order merchant number + * + * @return string + */ + public function getMerchantNumber() + { + return $this->_getField(self::$MERCHANT_NUMBER); + } + + /** + * getter for order number + * + * @return string + */ + public function getOrderNumber() + { + return $this->_getField(self::$ORDER_NUMBER); + } + + /** + * getter for used payment type + * + * @return string + */ + public function getPaymentType() + { + return $this->_getField(self::$PAYMENT_TYPE); + } + + /** + * getter for orders amount + * + * @return string + */ + public function getAmount() + { + return $this->_getField(self::$AMOUNT); + } + + /** + * getter for orders brand + * + * @return string + */ + public function getBrand() + { + return $this->_getField(self::$BRAND); + } + + /** + * getter for orders currency + * + * @return type + */ + public function getCurrency() + { + return $this->_getField(self::$CURRENCY); + } + + /** + * getter for the order description + * + * @return string + */ + public function getOrderDescription() + { + return $this->_getField(self::$ORDER_DESCRIPTION); + } + + /** + * getter for the acquirer name + * + * @return string + */ + public function getAcquirer() + { + return $this->_getField(self::$ACQUIRER); + } + + /** + * getter for the contract number + * + * @return string + */ + public function getContractNumber() + { + return $this->_getField(self::$CONTRACT_NUMBER); + } + + /** + * getter for allowed follow-up operations + * + * @return string[] + */ + public function getOperationsAllowed() + { + if ($this->_getField(self::$OPERATIONS_ALLOWED) == '') { + return Array(); + } else { + return explode(',', $this->_getField(self::$OPERATIONS_ALLOWED)); + } + } + + /** + * getter for order reference + * + * @return string + */ + public function getOrderReference() + { + return $this->_getField(self::$ORDER_REFERENCE); + } + + /** + * getter for customer statement text + * + * @return string + */ + public function getCustomerStatement() + { + return $this->_getField(self::$CUSTOMER_STATEMENT); + } + + /** + * getter for the order text + * + * @return string + */ + public function getOrderText() + { + return $this->_getField(self::$ORDER_TEXT); + } + + /** + * getter for the time this order has been created + * + * @return DateTime + */ + public function getTimeCreated() + { + return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_CREATED)); + } + + /** + * getter for the last time this order has been modified + * + * @return DateTime + */ + public function getTimeModified() + { + return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_MODIFIED)); + } + + /** + * getter for the current order state + * + * @return string + */ + public function getState() + { + return $this->_getField(self::$STATE); + } + + /** + * getter for the source order number + * + * @return string + */ + public function getSourceOrderNumber() + { + return $this->_getField(self::$SOURCE_ORDER_NUMBER); + } + + /** + * getter for corresponding payment objects + * + * @return WirecardCEE_QPay_Response_Toolkit_Order_PaymentIterator + */ + public function getPayments() + { + return $this->_payments; + } + + /** + * getter for corresponding credit objects + * + * @return WirecardCEE_QPay_Response_Toolkit_Order_CreditIterator + */ + public function getCredits() + { + return $this->_credits; + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Credit.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Credit.php index 05f6993..c6667f1 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Credit.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Credit.php @@ -1,206 +1,251 @@ _data = $creditData; - } - - /** - * getter for credits merchant number - * - * @return string - */ - public function getMerchantNumber() { - return (string) $this->_getField(self::$MERCHANT_NUMBER); - } - - /** - * getter for credit number - * - * @return string - */ - public function getCreditNumber() { - return (string) $this->_getField(self::$CREDIT_NUMBER); - } - - /** - * getter for the corresponding order number - * - * @return string - */ - public function getOrderNumber() { - return $this->_getField(self::$ORDER_NUMBER); - } - - /** - * getter for the corresponding batch number - * - * @return string - */ - public function getBatchNumber() { - return $this->_getField(self::$BATCH_NUMBER); - } - - /** - * getter for the credit amount - * - * @return string - */ - public function getAmount() { - return $this->_getField(self::$AMOUNT); - } - - /** - * getter for the credit currency - * - * @return string - */ - public function getCurrency() { - return (string) $this->_getField(self::$CURRENCY); - } - - /** - * getter for the creation time - * - * @return DateTime - */ - public function getTimeCreated() { - return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_CREATED)); - } - - /** - * getter for the last time this credit has been updated - * - * @return DateTime - */ - public function getTimeModified() { - return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_MODIFIED)); - } - - /** - * getter for the currenc credit state - * - * @return string - */ - public function getState() { - return $this->_getField(self::$STATE); - } - - /** - * getter for the allowed follow-up operations - * - * @return array - */ - public function getOperationsAllowed() { - return explode(',', $this->_getField(self::$OPERATIONS_ALLOWED)); - } - - /** - * getter for the gateway reference number - * - * @return string - */ - public function getGatewayReferenceNumber() { - return $this->_getField(self::$GATEWAY_REFERENCE_NUMBER); - } +class WirecardCEE_QPay_Response_Toolkit_Order_Credit extends WirecardCEE_QPay_Response_Toolkit_FinancialObject +{ + /** + * Merchant number + * + * @staticvar string + * @internal + */ + private static $MERCHANT_NUMBER = 'merchantNumber'; + + /** + * Credit number + * + * @staticvar string + * @internal + */ + private static $CREDIT_NUMBER = 'creditNumber'; + + /** + * Order number + * + * @staticvar string + * @internal + */ + private static $ORDER_NUMBER = 'orderNumber'; + + /** + * Batch number + * + * @staticvar string + * @internal + */ + private static $BATCH_NUMBER = 'batchNumber'; + + /** + * Amount + * + * @staticvar string + * @internal + */ + private static $AMOUNT = 'amount'; + + /** + * Currency + * + * @staticvar string + * @internal + */ + private static $CURRENCY = 'currency'; + + /** + * Time created + * + * @staticvar string + * @internal + */ + private static $TIME_CREATED = 'timeCreated'; + + /** + * Time modified + * + * @staticvar string + * @internal + */ + private static $TIME_MODIFIED = 'timeModified'; + + /** + * State + * + * @staticvar string + * @internal + */ + private static $STATE = 'state'; + + /** + * Operations allowed + * + * @staticvar string + * @internal + */ + private static $OPERATIONS_ALLOWED = 'operationsAllowed'; + + /** + * Gateway reference number + * + * @staticvar string + * @internal + */ + private static $GATEWAY_REFERENCE_NUMBER = 'gatewayReferenceNumber'; + + /** + * creates an instance of an {@link + * WirecardCEE_QPay_Response_Toolkit_Order_Credit} object + * + * @param string[] $creditData + */ + public function __construct($creditData) + { + $this->_data = $creditData; + } + + /** + * getter for credits merchant number + * + * @return string + */ + public function getMerchantNumber() + { + return (string) $this->_getField(self::$MERCHANT_NUMBER); + } + + /** + * getter for credit number + * + * @return string + */ + public function getCreditNumber() + { + return (string) $this->_getField(self::$CREDIT_NUMBER); + } + + /** + * getter for the corresponding order number + * + * @return string + */ + public function getOrderNumber() + { + return $this->_getField(self::$ORDER_NUMBER); + } + + /** + * getter for the corresponding batch number + * + * @return string + */ + public function getBatchNumber() + { + return $this->_getField(self::$BATCH_NUMBER); + } + + /** + * getter for the credit amount + * + * @return string + */ + public function getAmount() + { + return $this->_getField(self::$AMOUNT); + } + + /** + * getter for the credit currency + * + * @return string + */ + public function getCurrency() + { + return (string) $this->_getField(self::$CURRENCY); + } + + /** + * getter for the creation time + * + * @return DateTime + */ + public function getTimeCreated() + { + return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_CREATED)); + } + + /** + * getter for the last time this credit has been updated + * + * @return DateTime + */ + public function getTimeModified() + { + return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_MODIFIED)); + } + + /** + * getter for the currenc credit state + * + * @return string + */ + public function getState() + { + return $this->_getField(self::$STATE); + } + + /** + * getter for the allowed follow-up operations + * + * @return array + */ + public function getOperationsAllowed() + { + return explode(',', $this->_getField(self::$OPERATIONS_ALLOWED)); + } + + /** + * getter for the gateway reference number + * + * @return string + */ + public function getGatewayReferenceNumber() + { + return $this->_getField(self::$GATEWAY_REFERENCE_NUMBER); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/CreditIterator.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/CreditIterator.php index b2f1cd8..30c98d7 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/CreditIterator.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/CreditIterator.php @@ -1,20 +1,43 @@ _position = 0; - $this->_objectArray = $objectArray; - } + /** + * + * @param array $objectArray objects to iterate through + */ + public function __construct(array $objectArray) + { + $this->_position = 0; + $this->_objectArray = $objectArray; + } - /** - * resets the current position to 0(first entry) - */ - public function rewind() { - $this->_position = 0; - } + /** + * resets the current position to 0(first entry) + */ + public function rewind() + { + $this->_position = 0; + } - /** - * the current Object - * @return Object - */ - public function current() { - return $this->_objectArray[$this->_position]; - } + /** + * the current Object + * + * @return Object + */ + public function current() + { + return $this->_objectArray[$this->_position]; + } - /** - * the current position - * @return int - */ - public function key() { - return $this->_position; - } + /** + * the current position + * + * @return int + */ + public function key() + { + return $this->_position; + } - /** - * go to the next position - */ - public function next() { - ++$this->_position; - } + /** + * go to the next position + */ + public function next() + { + ++ $this->_position; + } - /** - * checks if position is valid - * @see Iterator::valid() - */ - public function valid() { - return (bool) isset($this->_objectArray[$this->_position]); - } + /** + * checks if position is valid + * + * @see Iterator::valid() + */ + public function valid() + { + return (bool) isset( $this->_objectArray[$this->_position] ); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment.php index 31d369b..1eed5b6 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment.php @@ -1,253 +1,304 @@ _data = $paymentData; - } - - /** - * getter for payments merchant number - * - * @return string - */ - public function getMerchantNumber() { - return $this->_getField(self::$MERCHANT_NUMBER); - } - - /** - * getter for the payment number - * - * @return string - */ - public function getPaymentNumber() { - return $this->_getField(self::$PAYMENT_NUMBER); - } - - /** - * getter for the corrensponding order number - * - * @return string - */ - public function getOrderNumber() { - return $this->_getField(self::$ORDER_NUMBER); - } - - /** - * getter for the approved amount - * - * @return string - */ - public function getApproveAmount() { - return $this->_getField(self::$APPROVE_AMOUNT); - } - - /** - * getter for the deposited amount - * - * @return string - */ - public function getDepositAmount() { - return $this->_getField(self::$DEPOSIT_AMOUNT); - } - - /** - * getter for the payment currency - * - * @return string - */ - public function getCurrency() { - return $this->_getField(self::$CURRENCY); - } - - /** - * getter for the creation time of this payment - * - * @return DateTime - */ - public function getTimeCreated() { - return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_CREATED)); - } - - /** - * getter for the last time this payment has been updated - * - * @return DateTime - */ - public function getTimeModified() { - return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_MODIFIED)); - } - - /** - * getter for the current payment state - * - * @return string - */ - public function getState() { - return $this->_getField(self::$STATE); - } - - /** - * getter for the paymenttype - * - * @return string - */ - public function getPaymentType() { - return $this->_getField(self::$PAYMENT_TYPE); - } - - /** - * getter for the allowed follow-up operations - * - * @return string[] - */ - public function getOperationsAllowed() { - return explode(',', $this->_getField(self::$OPERATIONS_ALLOWED)); - } - - /** - * getter for the gateway reference number - * - * @return string - */ - public function getGatewayReferencenumber() { - return $this->_getField(self::$GATEWAY_REFERENCE_NUMBER); - } - - /** - * getter for the AVS result-code - * - * @return string - */ - public function getAvsResultCode() { - return $this->_getField(self::$AVS_RESULT_CODE); - } - - /** - * getter for the AVS result-message - * - * @return string - */ - public function getAvsResultMessage() { - return $this->_getField(self::$AVS_RESULT_MESSAGE); - } +class WirecardCEE_QPay_Response_Toolkit_Order_Payment extends WirecardCEE_QPay_Response_Toolkit_FinancialObject +{ + /** + * Merchant number + * + * @staticvar string + * @internal + */ + private static $MERCHANT_NUMBER = 'merchantNumber'; + + /** + * Payment number + * + * @staticvar string + * @internal + */ + private static $PAYMENT_NUMBER = 'paymentNumber'; + + /** + * Order number + * + * @staticvar string + * @internal + */ + private static $ORDER_NUMBER = 'orderNumber'; + + /** + * Approve amount + * + * @staticvar string + * @internal + */ + private static $APPROVE_AMOUNT = 'approveAmount'; + + /** + * Deposit amount + * + * @staticvar string + * @internal + */ + private static $DEPOSIT_AMOUNT = 'depositAmount'; + + /** + * Currency + * + * @staticvar string + * @internal + */ + private static $CURRENCY = 'currency'; + + /** + * Time created + * + * @staticvar string + * @internal + */ + private static $TIME_CREATED = 'timeCreated'; + + /** + * Time modified + * + * @staticvar string + * @internal + */ + private static $TIME_MODIFIED = 'timeModified'; + + /** + * State + * + * @staticvar string + * @internal + */ + private static $STATE = 'state'; + + /** + * Payment type + * + * @staticvar string + * @internal + */ + private static $PAYMENT_TYPE = 'paymentType'; + + /** + * Operations allowed + * + * @staticvar string + * @internal + */ + private static $OPERATIONS_ALLOWED = 'operationsAllowed'; + + /** + * Gateway reference number + * + * @staticvar string + * @internal + */ + private static $GATEWAY_REFERENCE_NUMBER = 'gatewayReferenceNumber'; + + /** + * AVS result code + * + * @staticvar string + * @internal + */ + private static $AVS_RESULT_CODE = 'avsResultCode'; + + /** + * AVS result message + * + * @staticvar string + * @internal + */ + private static $AVS_RESULT_MESSAGE = 'avsResultMessage'; + + /** + * creates an instance of an {@link + * WirecardCEE_QPay_Response_Toolkit_Order_Payment} object + * + * @param string[] $paymentData + */ + public function __construct($paymentData) + { + $this->_data = $paymentData; + } + + /** + * getter for payments merchant number + * + * @return string + */ + public function getMerchantNumber() + { + return $this->_getField(self::$MERCHANT_NUMBER); + } + + /** + * getter for the payment number + * + * @return string + */ + public function getPaymentNumber() + { + return $this->_getField(self::$PAYMENT_NUMBER); + } + + /** + * getter for the corrensponding order number + * + * @return string + */ + public function getOrderNumber() + { + return $this->_getField(self::$ORDER_NUMBER); + } + + /** + * getter for the approved amount + * + * @return string + */ + public function getApproveAmount() + { + return $this->_getField(self::$APPROVE_AMOUNT); + } + + /** + * getter for the deposited amount + * + * @return string + */ + public function getDepositAmount() + { + return $this->_getField(self::$DEPOSIT_AMOUNT); + } + + /** + * getter for the payment currency + * + * @return string + */ + public function getCurrency() + { + return $this->_getField(self::$CURRENCY); + } + + /** + * getter for the creation time of this payment + * + * @return DateTime + */ + public function getTimeCreated() + { + return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_CREATED)); + } + + /** + * getter for the last time this payment has been updated + * + * @return DateTime + */ + public function getTimeModified() + { + return DateTime::createFromFormat(self::$DATETIME_FORMAT, $this->_getField(self::$TIME_MODIFIED)); + } + + /** + * getter for the current payment state + * + * @return string + */ + public function getState() + { + return $this->_getField(self::$STATE); + } + + /** + * getter for the paymenttype + * + * @return string + */ + public function getPaymentType() + { + return $this->_getField(self::$PAYMENT_TYPE); + } + + /** + * getter for the allowed follow-up operations + * + * @return string[] + */ + public function getOperationsAllowed() + { + return explode(',', $this->_getField(self::$OPERATIONS_ALLOWED)); + } + + /** + * getter for the gateway reference number + * + * @return string + */ + public function getGatewayReferencenumber() + { + return $this->_getField(self::$GATEWAY_REFERENCE_NUMBER); + } + + /** + * getter for the AVS result-code + * + * @return string + */ + public function getAvsResultCode() + { + return $this->_getField(self::$AVS_RESULT_CODE); + } + + /** + * getter for the AVS result-message + * + * @return string + */ + public function getAvsResultMessage() + { + return $this->_getField(self::$AVS_RESULT_MESSAGE); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Ideal.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Ideal.php index 95762bd..afd6f75 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Ideal.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Ideal.php @@ -1,67 +1,95 @@ _getField(self::$CONSUMER_NAME); - } + /** + * getter for iDEAL consumer Name + * + * @return string + */ + public function getConsumerName() + { + return $this->_getField(self::$CONSUMER_NAME); + } - /** - * getter for iDEAL consumer City - * - * @return string - */ - public function getConsumerCity() { - return $this->_getField(self::$CONSUMER_CITY); - } + /** + * getter for iDEAL consumer City + * + * @return string + */ + public function getConsumerCity() + { + return $this->_getField(self::$CONSUMER_CITY); + } - /** - * getter for iDEAL consumer account-number - * - * @return string - */ - public function getConsumerAccountNumber() { - return $this->_getField(self::$CONSUMER_ACCOUNT_NUMBER); - } + /** + * getter for iDEAL consumer account-number + * + * @return string + */ + public function getConsumerAccountNumber() + { + return $this->_getField(self::$CONSUMER_ACCOUNT_NUMBER); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Paypal.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Paypal.php index 74c0fd1..9ebc4ed 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Paypal.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Paypal.php @@ -1,227 +1,275 @@ _getField(self::$PAYER_ID); - } - - /** - * getter for PayPal payer email - * - * @return string - */ - public function getPayerEmail() { - return $this->_getField(self::$PAYER_EMAIL); - } - - /** - * getter for PayPal payer firstname - * - * @return string - */ - public function getPayerFirstName() { - return $this->_getField(self::$PAYER_FIRST_NAME); - } - - /** - * getter for PayPal payer lastname - * - * @return string - */ - public function getPayerLastName() { - return $this->_getField(self::$PAYER_LAST_NAME); - } - - /** - * getter for PayPal payer country address field - * - * @return string - */ - public function getPayerAddressCountry() { - return $this->_getField(self::$PAYER_ADDRESS_COUNTRY); - } - - /** - * getter for PayPal payer city address field - * - * @return string - */ - public function getPayerAddressCity() { - return $this->_getField(self::$PAYER_ADDRESS_CITY); - } - - /** - * getter for PayPal payer state address field - * - * @return string - */ - public function getPayerAddressState() { - return $this->_getField(self::$PAYER_ADDRESS_STATE); - } - - /** - * getter for PayPal payer name address field - * - * @return string - */ - public function getPayerAddressName() { - return $this->_getField(self::$PAYER_ADDRESS_NAME); - } - - /** - * getter for PayPal payer street 1 address field - * - * @return string - */ - public function getPayerAddressStreet1() { - return $this->_getField(self::$PAYER_ADDRESS_STREET_1); - } - - /** - * getter for PayPal payer street 2 address field - * - * @return string - */ - public function getPayerAddressStreet2() { - return $this->_getField(self::$PAYER_ADDRESS_STREET_2); - } - - /** - * getter for PayPal payer zipcode address field - * - * @return string - */ - public function getPayerAddressZip() { - return $this->_getField(self::$PAYER_ADDRESS_ZIP); - } - - /** - * getter for PayPal payer address status - * - * @return string - */ - public function getPayerAddressStatus() { - return $this->_getField(self::$PAYER_ADDRESS_STATUS); - } - - /** - * getter for PayPal protection eligibility - * - * @return string - */ - public function getProtectionEligibility() { - return $this->_getField(self::$PROTECTION_ELIGIBILITY); - } +class WirecardCEE_QPay_Response_Toolkit_Order_Payment_Paypal extends WirecardCEE_QPay_Response_Toolkit_Order_Payment +{ + /** + * PayPal - payer ID + * + * @staticvar string + * @internal + */ + private static $PAYER_ID = 'paypalPayerID'; + + /** + * PayPal - payer email + * + * @staticvar string + * @internal + */ + private static $PAYER_EMAIL = 'paypalPayerEmail'; + + /** + * PayPal - payer first name + * + * @staticvar string + * @internal + */ + private static $PAYER_FIRST_NAME = 'paypalPayerFirstName'; + + /** + * PayPal - payer last name + * + * @staticvar string + * @internal + */ + private static $PAYER_LAST_NAME = 'paypalPayerLastName'; + + /** + * PayPal - payer address - coountry + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_COUNTRY = 'paypalPayerAddressCountry'; + + /** + * PayPal - payer address - city + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_CITY = 'paypalPayerAddressCity'; + + /** + * PayPal - payer address - state + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_STATE = 'paypalPayerAddressState'; + + /** + * PayPal - payer address - name + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_NAME = 'paypalPayerAddressName'; + + /** + * PayPal - payer address - street 1 + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_STREET_1 = 'paypalPayerAddressStreet1'; + + /** + *PayPal - payer address - street 2 + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_STREET_2 = 'paypalPayerAddressStreet2'; + + /** + * PayPal - payer address - zip + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_ZIP = 'paypalPayerAddressZIP'; + + /** + * PayPal - payer address - status + * + * @staticvar string + * @internal + */ + private static $PAYER_ADDRESS_STATUS = 'paypalPayerAddressStatus'; + + /** + * PayPal - payer eligibility + * + * @staticvar string + * @internal + */ + private static $PROTECTION_ELIGIBILITY = 'paypalProtectionEligibility'; + + /** + * getter for PayPal payerID + * + * @return string + */ + public function getPayerId() + { + return $this->_getField(self::$PAYER_ID); + } + + /** + * getter for PayPal payer email + * + * @return string + */ + public function getPayerEmail() + { + return $this->_getField(self::$PAYER_EMAIL); + } + + /** + * getter for PayPal payer firstname + * + * @return string + */ + public function getPayerFirstName() + { + return $this->_getField(self::$PAYER_FIRST_NAME); + } + + /** + * getter for PayPal payer lastname + * + * @return string + */ + public function getPayerLastName() + { + return $this->_getField(self::$PAYER_LAST_NAME); + } + + /** + * getter for PayPal payer country address field + * + * @return string + */ + public function getPayerAddressCountry() + { + return $this->_getField(self::$PAYER_ADDRESS_COUNTRY); + } + + /** + * getter for PayPal payer city address field + * + * @return string + */ + public function getPayerAddressCity() + { + return $this->_getField(self::$PAYER_ADDRESS_CITY); + } + + /** + * getter for PayPal payer state address field + * + * @return string + */ + public function getPayerAddressState() + { + return $this->_getField(self::$PAYER_ADDRESS_STATE); + } + + /** + * getter for PayPal payer name address field + * + * @return string + */ + public function getPayerAddressName() + { + return $this->_getField(self::$PAYER_ADDRESS_NAME); + } + + /** + * getter for PayPal payer street 1 address field + * + * @return string + */ + public function getPayerAddressStreet1() + { + return $this->_getField(self::$PAYER_ADDRESS_STREET_1); + } + + /** + * getter for PayPal payer street 2 address field + * + * @return string + */ + public function getPayerAddressStreet2() + { + return $this->_getField(self::$PAYER_ADDRESS_STREET_2); + } + + /** + * getter for PayPal payer zipcode address field + * + * @return string + */ + public function getPayerAddressZip() + { + return $this->_getField(self::$PAYER_ADDRESS_ZIP); + } + + /** + * getter for PayPal payer address status + * + * @return string + */ + public function getPayerAddressStatus() + { + return $this->_getField(self::$PAYER_ADDRESS_STATUS); + } + + /** + * getter for PayPal protection eligibility + * + * @return string + */ + public function getProtectionEligibility() + { + return $this->_getField(self::$PROTECTION_ELIGIBILITY); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Sofortueberweisung.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Sofortueberweisung.php index b58eb44..6abb97f 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Sofortueberweisung.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/Payment/Sofortueberweisung.php @@ -1,147 +1,185 @@ _getField(self::$SENDER_ACCOUNT_OWNER); - } - - /** - * getter for sofortueberweisung.de sender account number - * - * @return string - */ - public function getSenderAccountNumber() { - return $this->_getField(self::$SENDER_ACCOUNT_NUMBER); - } - - /** - * getter for sofortueberweisung.de sender bank number - * - * @return string - */ - public function getSenderBankNumber() { - return $this->_getField(self::$SENDER_BANK_NUMBER); - } - - /** - * getter for sofortueberweisung.de sender bank name - * - * @return string - */ - public function getSenderBankName() { - return $this->_getField(self::$SENDER_BANK_NAME); - } - - /** - * getter for sofortueberweisung.de sender BIC - * - * @return string - */ - public function getSenderBic() { - return $this->_getField(self::$SENDER_BIC); - } - - /** - * getter for sofortueberweisung.de sender IBAN - * - * @return string - */ - public function getSenderIban() { - return $this->_getField(self::$SENDER_IBAN); - } - - /** - * getter for sofortueberweisung.de sender country - * - * @return string - */ - public function getSenderCountry() { - return $this->_getField(self::$SENDER_COUNTRY); - } - - /** - * getter for sofortueberweisung.de Security criteria - * - * @return string - */ - public function getSecurityCriteria() { - return $this->_getField(self::$SECURITY_CRITERIA); - } +class WirecardCEE_QPay_Response_Toolkit_Order_Payment_Sofortueberweisung extends WirecardCEE_QPay_Response_Toolkit_Order_Payment +{ + /** + * Sender - account owner + * + * @staticvar string + * @internal + */ + private static $SENDER_ACCOUNT_OWNER = 'senderAccountOwner'; + + /** + * Sender - account number + * + * @staticvar string + * @internal + */ + private static $SENDER_ACCOUNT_NUMBER = 'senderAccountNumber'; + + /** + * Sender - bank number + * + * @staticvar string + * @internal + */ + private static $SENDER_BANK_NUMBER = 'senderBankNumber'; + + /** + * Sender - bank name + * + * @staticvar string + * @internal + */ + private static $SENDER_BANK_NAME = 'senderBankName'; + + /** + * Sender - BIC + * + * @staticvar string + * @internal + */ + private static $SENDER_BIC = 'senderBIC'; + + /** + * Sender - IBAN + * + * @staticvar string + * @internal + */ + private static $SENDER_IBAN = 'senderIBAN'; + + /** + * Sender - Country + * + * @staticvar string + * @internal + */ + private static $SENDER_COUNTRY = 'senderCountry'; + + /** + * Security criteria + * + * @staticvar string + * @internal + */ + private static $SECURITY_CRITERIA = 'securityCriteria'; + + /** + * getter for sofortueberweisung.de sender account owner + * + * @return string + */ + public function getSenderAccountOwner() + { + return $this->_getField(self::$SENDER_ACCOUNT_OWNER); + } + + /** + * getter for sofortueberweisung.de sender account number + * + * @return string + */ + public function getSenderAccountNumber() + { + return $this->_getField(self::$SENDER_ACCOUNT_NUMBER); + } + + /** + * getter for sofortueberweisung.de sender bank number + * + * @return string + */ + public function getSenderBankNumber() + { + return $this->_getField(self::$SENDER_BANK_NUMBER); + } + + /** + * getter for sofortueberweisung.de sender bank name + * + * @return string + */ + public function getSenderBankName() + { + return $this->_getField(self::$SENDER_BANK_NAME); + } + + /** + * getter for sofortueberweisung.de sender BIC + * + * @return string + */ + public function getSenderBic() + { + return $this->_getField(self::$SENDER_BIC); + } + + /** + * getter for sofortueberweisung.de sender IBAN + * + * @return string + */ + public function getSenderIban() + { + return $this->_getField(self::$SENDER_IBAN); + } + + /** + * getter for sofortueberweisung.de sender country + * + * @return string + */ + public function getSenderCountry() + { + return $this->_getField(self::$SENDER_COUNTRY); + } + + /** + * getter for sofortueberweisung.de Security criteria + * + * @return string + */ + public function getSecurityCriteria() + { + return $this->_getField(self::$SECURITY_CRITERIA); + } } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/PaymentIterator.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/PaymentIterator.php index f3fa837..6c15e29 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/PaymentIterator.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Order/PaymentIterator.php @@ -1,19 +1,42 @@ _getField(self::$ORDER_NUMBER); - } + /** + * getter for the returned order number + * + * @return string + */ + public function getOrderNumber() + { + return $this->_getField(self::$ORDER_NUMBER); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Refund.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Refund.php index cc67521..988093b 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Refund.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/Refund.php @@ -1,35 +1,59 @@ _getField(self::$CREDIT_NUMBER); - } + /** + * getter for the returned credit number + * + * @return string + */ + public function getCreditNumber() + { + return $this->_getField(self::$CREDIT_NUMBER); + } } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/RefundReversal.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/RefundReversal.php index 7ae6fdb..3b90bc9 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/RefundReversal.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Response/Toolkit/RefundReversal.php @@ -1,19 +1,42 @@ _getField(self::$STATUS); - } + /** + * getter for the toolkit operation status + * + * @return string + */ + public function getStatus() + { + return $this->_getField(self::$STATUS); + } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Cancel.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Cancel.php index 4bbbea4..4875118 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Cancel.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Cancel.php @@ -1,18 +1,42 @@ _returnData[self::$ERROR_MESSAGE]); - if(isset($this->_returnData[self::$ERROR_CONSUMER_MESSAGE])) + if (isset( $this->_returnData[self::$ERROR_CONSUMER_MESSAGE] )) { $oError->setConsumerMessage($this->_returnData[self::$ERROR_CONSUMER_MESSAGE]); + } return $oError; } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Pending.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Pending.php index 125ca5a..79e8b7d 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Pending.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/Return/Pending.php @@ -1,18 +1,42 @@ |WirecardCEE_QPay_Return_Cancel|WirecardCEE_QPay_Return_Failure */ - protected static function _getInstance($return, $secret) { - switch(strtoupper($return['paymentState'])) { + protected static function _getInstance($return, $secret) + { + switch (strtoupper($return['paymentState'])) { case self::STATE_SUCCESS: return self::_getSuccessInstance($return, $secret); break; @@ -77,20 +107,25 @@ protected static function _getInstance($return, $secret) { * * @param string[] $return * @param string $secret - * @access private - * @return WirecardCEE_QPay_Return_Success + * + * @return WirecardCEE_QPay_Return_Success|WirecardCEE_QPay_Return_Success_CreditCard|WirecardCEE_QPay_Return_Success_Ideal|WirecardCEE_QPay_Return_Success_PayPal|WirecardCEE_QPay_Return_Success_Sofortueberweisung + * @throws WirecardCEE_QPay_Exception_InvalidResponseException */ - protected static function _getSuccessInstance($return, $secret) { + protected static function _getSuccessInstance($return, $secret) + { if (!array_key_exists('paymentType', $return)) { throw new WirecardCEE_QPay_Exception_InvalidResponseException('Invalid response from QPAY. Paymenttype is missing.'); } - switch(strtoupper($return['paymentType'])) { + switch (strtoupper($return['paymentType'])) { case WirecardCEE_Stdlib_PaymentTypeAbstract::CCARD: case WirecardCEE_Stdlib_PaymentTypeAbstract::CCARD_MOTO: case WirecardCEE_Stdlib_PaymentTypeAbstract::MAESTRO: return new WirecardCEE_QPay_Return_Success_CreditCard($return, $secret); break; + case WirecardCEE_Stdlib_PaymentTypeAbstract::MASTERPASS: + return new WirecardCEE_QPay_Return_Success_Masterpass($return, $secret); + break; case WirecardCEE_Stdlib_PaymentTypeAbstract::PAYPAL: return new WirecardCEE_QPay_Return_Success_PayPal($return, $secret); break; diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/ToolkitClient.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/ToolkitClient.php index 7e070dc..c9a8c36 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/ToolkitClient.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/QPay/ToolkitClient.php @@ -1,77 +1,205 @@ _fingerprintOrder = new WirecardCEE_Stdlib_FingerprintOrder(); - if(is_null($aConfig)) { + if (is_null($aConfig)) { $aConfig = WirecardCEE_QPay_Module::getConfig(); } - if (isset($aConfig['WirecardCEEQPayConfig'])) { + if (is_array($aConfig) && isset( $aConfig['WirecardCEEQPayConfig'] )) { // we only need the WirecardCEEQPayConfig here $aConfig = $aConfig['WirecardCEEQPayConfig']; } // let's store configuration details in internal objects - $this->oUserConfig = new WirecardCEE_Stdlib_Config($aConfig); + $this->oUserConfig = is_object($aConfig) ? $aConfig : new WirecardCEE_Stdlib_Config($aConfig); $this->oClientConfig = new WirecardCEE_Stdlib_Config(WirecardCEE_QPay_Module::getClientConfig()); // now let's check if the CUSTOMER_ID, SHOP_ID, LANGUAGE and SECRET // exist in $this->oUserConfig object that we created from config array - $sCustomerId = isset($this->oUserConfig->CUSTOMER_ID) ? trim($this->oUserConfig->CUSTOMER_ID) : null; - $sShopId = isset($this->oUserConfig->SHOP_ID) ? trim($this->oUserConfig->SHOP_ID) : null; - $sLanguage = isset($this->oUserConfig->LANGUAGE) ? trim($this->oUserConfig->LANGUAGE) : null; - $sSecret = isset($this->oUserConfig->SECRET) ? trim($this->oUserConfig->SECRET) : null; - $sToolkitPassword = isset($this->oUserConfig->TOOLKIT_PASSWORD) ? trim($this->oUserConfig->TOOLKIT_PASSWORD): null; + $sCustomerId = isset( $this->oUserConfig->CUSTOMER_ID ) ? trim($this->oUserConfig->CUSTOMER_ID) : null; + $sShopId = isset( $this->oUserConfig->SHOP_ID ) ? trim($this->oUserConfig->SHOP_ID) : null; + $sLanguage = isset( $this->oUserConfig->LANGUAGE ) ? trim($this->oUserConfig->LANGUAGE) : null; + $sSecret = isset( $this->oUserConfig->SECRET ) ? trim($this->oUserConfig->SECRET) : null; + $sToolkitPassword = isset( $this->oUserConfig->TOOLKIT_PASSWORD ) ? trim($this->oUserConfig->TOOLKIT_PASSWORD) : null; // If not throw the InvalidArgumentException exception! - if (empty($sCustomerId) || is_null($sCustomerId)) { - throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('CUSTOMER_ID passed to %s is invalid.', __METHOD__)); + if (empty( $sCustomerId ) || is_null($sCustomerId)) { + throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('CUSTOMER_ID passed to %s is invalid.', + __METHOD__)); } - if (empty($sLanguage) || is_null($sLanguage)) { - throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('LANGUAGE passed to %s is invalid.', __METHOD__)); + if (empty( $sLanguage ) || is_null($sLanguage)) { + throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('LANGUAGE passed to %s is invalid.', + __METHOD__)); } - if (empty($sSecret) || is_null($sSecret)) { - throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('SECRET passed to %s is invalid.', __METHOD__)); + if (empty( $sSecret ) || is_null($sSecret)) { + throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('SECRET passed to %s is invalid.', + __METHOD__)); } - if (empty($sToolkitPassword) || is_null($sToolkitPassword)) { - throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('TOOLKIT PASSWORD passed to %s is invalid.', __METHOD__)); + if (empty( $sToolkitPassword ) || is_null($sToolkitPassword)) { + throw new WirecardCEE_QPay_Exception_InvalidArgumentException(sprintf('TOOLKIT PASSWORD passed to %s is invalid.', + __METHOD__)); } - // we're using md5 for hash-ing - WirecardCEE_Stdlib_Fingerprint::setHashAlgorithm(WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_MD5); + // we're using hmac sha512 for hash-ing + WirecardCEE_Stdlib_Fingerprint::setHashAlgorithm(WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_HMAC_SHA512); // everything ok! let's set the fields $this->_setField(self::CUSTOMER_ID, $sCustomerId); @@ -168,24 +305,27 @@ public function __construct(Array $aConfig = null) { * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return WirecardCEE_QPay_Response_Toolkit_Refund */ - public function refund($iOrderNumber, $iAmount, $sCurrency) { + public function refund($iOrderNumber, $iAmount, $sCurrency, $basket=null) + { $this->_requestData[self::COMMAND] = self::$COMMAND_REFUND; $this->_setField(self::ORDER_NUMBER, $iOrderNumber); $this->_setField(self::AMOUNT, $iAmount); $this->_setField(self::CURRENCY, strtoupper($sCurrency)); + $this->_setBasket($basket); $this->_fingerprintOrder->setOrder(Array( - self::CUSTOMER_ID, - self::SHOP_ID, - self::TOOLKIT_PASSWORD, - self::SECRET, - self::COMMAND, - self::LANGUAGE, - self::ORDER_NUMBER, - self::AMOUNT, - self::CURRENCY + self::CUSTOMER_ID, + self::SHOP_ID, + self::TOOLKIT_PASSWORD, + self::SECRET, + self::COMMAND, + self::LANGUAGE, + self::ORDER_NUMBER, + self::AMOUNT, + self::CURRENCY )); + $this->_appendBasketFingerprintOrder($basket); return new WirecardCEE_QPay_Response_Toolkit_Refund($this->_send()); } @@ -196,22 +336,24 @@ public function refund($iOrderNumber, $iAmount, $sCurrency) { * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return WirecardCEE_QPay_Response_Toolkit_RefundReversal */ - public function refundReversal($iOrderNumber, $iCreditNumber) { + public function refundReversal($iOrderNumber, $iCreditNumber) + { $this->_requestData[self::COMMAND] = self::$COMMAND_REFUND_REVERSAL; $this->_setField(self::ORDER_NUMBER, $iOrderNumber); $this->_setField(self::CREDIT_NUMBER, $iCreditNumber); $this->_fingerprintOrder->setOrder(Array( - self::CUSTOMER_ID, - self::SHOP_ID, - self::TOOLKIT_PASSWORD, - self::SECRET, - self::COMMAND, - self::LANGUAGE, - self::ORDER_NUMBER, - self::CREDIT_NUMBER + self::CUSTOMER_ID, + self::SHOP_ID, + self::TOOLKIT_PASSWORD, + self::SECRET, + self::COMMAND, + self::LANGUAGE, + self::ORDER_NUMBER, + self::CREDIT_NUMBER )); + return new WirecardCEE_QPay_Response_Toolkit_RefundReversal($this->_send()); } @@ -221,7 +363,14 @@ public function refundReversal($iOrderNumber, $iCreditNumber) { * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return WirecardCEE_QPay_Response_Toolkit_RecurPayment */ - public function recurPayment($iSourceOrderNumber, $iAmount, $sCurrency, $sOrderDescription, $iOrderNumber = null, $bDepositFlag = null) { + public function recurPayment( + $iSourceOrderNumber, + $iAmount, + $sCurrency, + $sOrderDescription, + $iOrderNumber = null, + $bDepositFlag = null + ) { $this->_requestData[self::COMMAND] = self::$COMMAND_RECUR_PAYMENT; $this->_setField(self::SOURCE_ORDER_NUMBER, $iSourceOrderNumber); @@ -230,29 +379,30 @@ public function recurPayment($iSourceOrderNumber, $iAmount, $sCurrency, $sOrderD $this->_setField(self::ORDER_DESCRIPTION, $sOrderDescription); - if(!is_null($iOrderNumber)) { + if (!is_null($iOrderNumber)) { $this->_setField(self::ORDER_NUMBER, $iOrderNumber); } - if(!is_null($bDepositFlag)) { + if (!is_null($bDepositFlag)) { $this->_setField(self::AUTO_DEPOSIT, $bDepositFlag ? self::$BOOL_TRUE : self::$BOOL_FALSE); } $this->_fingerprintOrder->setOrder(Array( - self::CUSTOMER_ID, - self::SHOP_ID, - self::TOOLKIT_PASSWORD, - self::SECRET, - self::COMMAND, - self::LANGUAGE, - self::ORDER_NUMBER, - self::SOURCE_ORDER_NUMBER, - self::AUTO_DEPOSIT, - self::ORDER_DESCRIPTION, - self::AMOUNT, - self::CURRENCY + self::CUSTOMER_ID, + self::SHOP_ID, + self::TOOLKIT_PASSWORD, + self::SECRET, + self::COMMAND, + self::LANGUAGE, + self::ORDER_NUMBER, + self::SOURCE_ORDER_NUMBER, + self::AUTO_DEPOSIT, + self::ORDER_DESCRIPTION, + self::AMOUNT, + self::CURRENCY )); + return new WirecardCEE_QPay_Response_Toolkit_RecurPayment($this->_send()); } @@ -260,21 +410,23 @@ public function recurPayment($iSourceOrderNumber, $iAmount, $sCurrency, $sOrderD * Returns order details * * @param int|string $iOrderNumber + * * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return WirecardCEE_QPay_Response_Toolkit_GetOrderDetails */ - public function getOrderDetails($iOrderNumber) { + public function getOrderDetails($iOrderNumber) + { $this->_requestData[self::COMMAND] = self::$COMMAND_GET_ORDER_DETAILS; $this->_setField(self::ORDER_NUMBER, $iOrderNumber); $this->_fingerprintOrder->setOrder(Array( - self::CUSTOMER_ID, - self::SHOP_ID, - self::TOOLKIT_PASSWORD, - self::SECRET, - self::COMMAND, - self::LANGUAGE, - self::ORDER_NUMBER + self::CUSTOMER_ID, + self::SHOP_ID, + self::TOOLKIT_PASSWORD, + self::SECRET, + self::COMMAND, + self::LANGUAGE, + self::ORDER_NUMBER )); return new WirecardCEE_QPay_Response_Toolkit_GetOrderDetails($this->_send()); @@ -286,19 +438,21 @@ public function getOrderDetails($iOrderNumber) { * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return WirecardCEE_QPay_Response_Toolkit_ApproveReversal */ - public function approveReversal($iOrderNumber) { + public function approveReversal($iOrderNumber) + { $this->_requestData[self::COMMAND] = self::$COMMAND_APPROVE_REVERSAL; $this->_setField(self::ORDER_NUMBER, $iOrderNumber); $this->_fingerprintOrder->setOrder(Array( - self::CUSTOMER_ID, - self::SHOP_ID, - self::TOOLKIT_PASSWORD, - self::SECRET, - self::COMMAND, - self::LANGUAGE, - self::ORDER_NUMBER + self::CUSTOMER_ID, + self::SHOP_ID, + self::TOOLKIT_PASSWORD, + self::SECRET, + self::COMMAND, + self::LANGUAGE, + self::ORDER_NUMBER )); + return new WirecardCEE_QPay_Response_Toolkit_ApproveReversal($this->_send()); } @@ -308,24 +462,28 @@ public function approveReversal($iOrderNumber) { * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return WirecardCEE_QPay_Response_Toolkit_Deposit */ - public function deposit($iOrderNumber, $iAmount, $sCurrency) { + public function deposit($iOrderNumber, $iAmount, $sCurrency, $basket=null) + { $this->_requestData[self::COMMAND] = self::$COMMAND_DEPOSIT; $this->_setField(self::ORDER_NUMBER, $iOrderNumber); $this->_setField(self::AMOUNT, $iAmount); $this->_setField(self::CURRENCY, strtoupper($sCurrency)); + $this->_setBasket($basket); $this->_fingerprintOrder->setOrder(Array( - self::CUSTOMER_ID, - self::SHOP_ID, - self::TOOLKIT_PASSWORD, - self::SECRET, - self::COMMAND, - self::LANGUAGE, - self::ORDER_NUMBER, - self::AMOUNT, - self::CURRENCY + self::CUSTOMER_ID, + self::SHOP_ID, + self::TOOLKIT_PASSWORD, + self::SECRET, + self::COMMAND, + self::LANGUAGE, + self::ORDER_NUMBER, + self::AMOUNT, + self::CURRENCY )); + $this->_appendBasketFingerprintOrder($basket); + return new WirecardCEE_QPay_Response_Toolkit_Deposit($this->_send()); } @@ -335,25 +493,65 @@ public function deposit($iOrderNumber, $iAmount, $sCurrency) { * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return WirecardCEE_QPay_Response_Toolkit_DepositReversal */ - public function depositReversal($iOrderNumber, $iPaymentNumber) { + public function depositReversal($iOrderNumber, $iPaymentNumber) + { $this->_requestData[self::COMMAND] = self::$COMMAND_DEPOSIT_REVERSAL; $this->_setField(self::ORDER_NUMBER, $iOrderNumber); $this->_setField(self::PAYMENT_NUMBER, $iPaymentNumber); $this->_fingerprintOrder->setOrder(Array( - self::CUSTOMER_ID, - self::SHOP_ID, - self::TOOLKIT_PASSWORD, - self::SECRET, - self::COMMAND, - self::LANGUAGE, - self::ORDER_NUMBER, - self::PAYMENT_NUMBER + self::CUSTOMER_ID, + self::SHOP_ID, + self::TOOLKIT_PASSWORD, + self::SECRET, + self::COMMAND, + self::LANGUAGE, + self::ORDER_NUMBER, + self::PAYMENT_NUMBER )); + return new WirecardCEE_QPay_Response_Toolkit_DepositReversal($this->_send()); } + + /** + * TransferFund + * + * @param string $fundTransferType + * + * @return WirecardCEE_QPay_Request_Backend_TransferFund + * @throws WirecardCEE_Stdlib_Exception_InvalidTypeException + */ + public function transferFund($fundTransferType) + { + + switch ($fundTransferType) { + case self::$TRANSFER_FUND_TYPE_EXISTING: + $client = new WirecardCEE_QPay_Request_Backend_TransferFund_Existing($this->oUserConfig); + break; + + case self::$TRANSFER_FUND_TYPE_SKIRLLWALLET: + $client = new WirecardCEE_QPay_Request_Backend_TransferFund_SkrillWallet($this->oUserConfig); + break; + + case self::$TRANSFER_FUND_TYPE_MONETA: + $client = new WirecardCEE_QPay_Request_Backend_TransferFund_Moneta($this->oUserConfig); + break; + + case self::$TRANSFER_FUND_TYPE_SEPACT: + $client = new WirecardCEE_QPay_Request_Backend_TransferFund_SepaCT($this->oUserConfig); + break; + + default: + throw new WirecardCEE_Stdlib_Exception_InvalidTypeException('Invalid fundTransferType'); + } + + $client->setType($fundTransferType); + + return $client; + } + /** * ******************* * PROTECTED METHODS * @@ -365,15 +563,30 @@ public function depositReversal($iOrderNumber, $iPaymentNumber) { * @see WirecardCEE_Stdlib_Client_ClientAbstract::_getRequestUrl() * @return string */ - protected function _getRequestUrl() { + protected function _getRequestUrl() + { return (string) $this->oClientConfig->TOOLKIT_URL; } + /** + * getter for given field + * + * @param string $name + * + * @return string|null + */ + protected function _getField($name) + { + return array_key_exists($name, $this->_requestData) ? $this->_requestData[$name] : null; + } + /** * Returns the user agent string + * * @return string */ - protected function _getUserAgent() { + protected function _getUserAgent() + { return "{$this->oClientConfig->MODULE_NAME};{$this->oClientConfig->MODULE_VERSION}"; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket.php index a78512f..a3649c9 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket.php @@ -1,47 +1,53 @@ getArticleNumber(); - $_quantity = $this->_getItemQuantity($_mArticleNumber); + $_quantity = $this->_getItemQuantity($_mArticleNumber); if (!$_quantity) { $this->_items[md5($_mArticleNumber)] = Array( - 'instance' => $oItem, - self::QUANTITY => $iQuantity + 'instance' => $oItem, + self::QUANTITY => $iQuantity ); - } - else { + } else { $this->_increaseQuantity($_mArticleNumber, $iQuantity); } return $this; } - /** - * Returns the basket total amount - * - * @return float - */ - public function getAmount() { - $total = 0.0; - - foreach($this->_items as $oItem) { - $total += $oItem['instance']->getUnitPrice() * $this->_getItemQuantity($oItem['instance']->getArticleNumber()); - } - - return $total; - } - /** * Returns the basket as pre-defined array (defined by WirecardCEE) * * @return Array */ - public function __toArray() { + public function getData() + { $_basketItems = $this->_items; - $_counter = 1; + $_counter = 1; - $this->_basket[self::BASKET_AMOUNT] = $this->getAmount(); - $this->_basket[self::BASKET_CURRENCY] = $this->_currency; - $this->_basket[self::BASKET_ITEMS] = count($_basketItems); + $this->_basket[self::BASKET_ITEMS] = count($_basketItems); - foreach($_basketItems as $oItem) { + foreach ($_basketItems as $oItem) { $mArticleNumber = $oItem['instance']->getArticleNumber(); - $oItem = $oItem['instance']; - - $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_ARTICLE_NUMBER] = $mArticleNumber; - $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . self::QUANTITY] = $this->_getItemQuantity($mArticleNumber); - $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_PRICE] = $oItem->getUnitPrice(); - $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_TAX] = $oItem->getTax(); - $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_DESCRIPTION] = $oItem->getDescription(); - - $_counter++; + $oItem = $oItem['instance']; + + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_ARTICLE_NUMBER] = $mArticleNumber; + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . self::QUANTITY] = $this->_getItemQuantity($mArticleNumber); + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_GROSS_AMOUNT] = $oItem->getUnitGrossAmount(); + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_NET_AMOUNT] = $oItem->getUnitNetAmount(); + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_TAX_AMOUNT] = $oItem->getUnitTaxAmount(); + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_TAX_RATE] = $oItem->getUnitTaxRate(); + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_DESCRIPTION] = $oItem->getDescription(); + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_NAME] = $oItem->getName(); + $this->_basket[self::BASKET_ITEM_PREFIX . $_counter . WirecardCEE_Stdlib_Basket_Item::ITEM_IMAGE_URL] = $oItem->getImageUrl(); + + $_counter ++; } return $this->_basket; } - /** - * Sets the basket currency - * - * @param string $sCurrency - * @return WirecardCEE_Stdlib_Basket - */ - public function setCurrency($sCurrency) { - $this->_currency = $sCurrency; - return $this; - } - /** * Destructor */ - public function __destruct() { - unset($this); + public function __destruct() + { + unset( $this ); } /*************************************** @@ -160,12 +146,15 @@ public function __destruct() { * @param mixed(integer|string) $mArticleNumber * @param int $iQuantity */ - protected function _increaseQuantity($mArticleNumber, $iQuantity) { - if(!isset($this->_items[md5($mArticleNumber)])) { - throw new Exception(sprintf("There is no item in the basket with article number '%s'. Thrown in %s.", $mArticleNumber, __METHOD__)); + protected function _increaseQuantity($mArticleNumber, $iQuantity) + { + if (!isset( $this->_items[md5($mArticleNumber)] )) { + throw new Exception(sprintf("There is no item in the basket with article number '%s'. Thrown in %s.", + $mArticleNumber, __METHOD__)); } $this->_items[md5($mArticleNumber)][self::QUANTITY] += $iQuantity; + return true; } @@ -173,9 +162,11 @@ protected function _increaseQuantity($mArticleNumber, $iQuantity) { * Returns the quantity of item in basket * * @param mixed(integer|string) $mArticleNumber + * * @return integer */ - protected function _getItemQuantity($mArticleNumber) { - return (int) isset($this->_items[md5($mArticleNumber)]) ? $this->_items[md5($mArticleNumber)][self::QUANTITY] : 0; + protected function _getItemQuantity($mArticleNumber) + { + return (int) isset( $this->_items[md5($mArticleNumber)] ) ? $this->_items[md5($mArticleNumber)][self::QUANTITY] : 0; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket/Item.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket/Item.php index 853b323..afe9858 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket/Item.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Basket/Item.php @@ -1,31 +1,59 @@ setArticleNumber($mArticleNumber); } } /** - * Sets the item tax (amount not percentage!) + * Sets the item tax amount + * + * @param mixed(integer|float) $fTaxAmount + * @return WirecardCEE_Stdlib_Basket_Item + */ + public function setUnitTaxAmount($fTaxAmount) + { + $this->_setField(self::ITEM_UNIT_TAX_AMOUNT, $fTaxAmount); + return $this; + } + + /** + * Returns the tax amount + * + * @return mixed(integer|float) + */ + public function getUnitTaxAmount() + { + return $this->_itemData[self::ITEM_UNIT_TAX_AMOUNT]; + } + + /** + * Sets the item tax rate * - * @param integer/float + * @param mixed(integer|float) $fTaxRate + * @return WirecardCEE_Stdlib_Basket_Item */ - public function setTax($fTax) { - $this->_setField(self::ITEM_TAX, $fTax); + public function setUnitTaxRate($fTaxRate) + { + $this->_setField(self::ITEM_UNIT_TAX_RATE, $fTaxRate); return $this; } /** - * Returns the tax + * Returns the tax rate * - * @return multitype: + * @return mixed(integer|float) */ - public function getTax() { - return $this->_itemData[self::ITEM_TAX]; + public function getUnitTaxRate() + { + return $this->_itemData[self::ITEM_UNIT_TAX_RATE]; } /** * Sets the article number for an item * * @param mixed(string|integer) $mArticleNumber + * * @return WirecardCEE_Stdlib_Basket_Item */ - public function setArticleNumber($mArticleNumber) { + public function setArticleNumber($mArticleNumber) + { $this->_setField(self::ITEM_ARTICLE_NUMBER, $mArticleNumber); + return $this; } @@ -79,55 +137,134 @@ public function setArticleNumber($mArticleNumber) { * * @return mixed(string|integer) */ - public function getArticleNumber() { + public function getArticleNumber() + { return $this->_itemData[self::ITEM_ARTICLE_NUMBER]; } /** - * Sets the price for a unit + * Sets the gross amount for a unit * - * @param mixed(integer|float) $fPrice + * @param mixed(integer|float) $fAmount * @return WirecardCEE_Stdlib_Basket_Item */ - public function setUnitPrice($fPrice) { - $this->_setField(self::ITEM_UNIT_PRICE, $fPrice); + public function setUnitGrossAmount($fAmount) + { + $this->_setField(self::ITEM_UNIT_GROSS_AMOUNT, $fAmount); return $this; } /** - * Returns the price for a unit + * Returns the gross amount for a unit * * @return mixed(integer|float) */ - public function getUnitPrice() { - return $this->_itemData[self::ITEM_UNIT_PRICE]; + public function getUnitGrossAmount() + { + return $this->_itemData[self::ITEM_UNIT_GROSS_AMOUNT]; + } + + /** + * Sets the net amount for a unit + * + * @param mixed(integer|float) $fAmount + * @return WirecardCEE_Stdlib_Basket_Item + */ + public function setUnitNetAmount($fAmount) + { + $this->_setField(self::ITEM_UNIT_NET_AMOUNT, $fAmount); + return $this; + } + + /** + * Returns the net amount for a unit + * + * @return mixed(integer|float) + */ + public function getUnitNetAmount() + { + return $this->_itemData[self::ITEM_UNIT_NET_AMOUNT]; } /** * Sets the item description * * @param string $sDescription + * * @return WirecardCEE_Stdlib_Basket_Item */ - public function setDescription($sDescription) { + public function setDescription($sDescription) + { $this->_setField(self::ITEM_DESCRIPTION, (string) $sDescription); + return $this; } /** - * Retuns the item description + * Returns the item description * * @return string */ - public function getDescription() { - return (string) $this->_itemData[self::ITEM_DESCRIPTION]; + public function getDescription() + { + if(array_key_exists(self::ITEM_DESCRIPTION, $this->_itemData)) { + return (string) $this->_itemData[self::ITEM_DESCRIPTION]; + } + return null; + } + + /** + * Sets the item name + * + * @param string $sName + * @return WirecardCEE_Stdlib_Basket_Item + */ + public function setName($sName) { + $this->_setField(self::ITEM_NAME, (string) $sName); + return $this; + } + + /** + * Returns the item name + * + * @return string + */ + public function getName() + { + return (string) $this->_itemData[self::ITEM_NAME]; + } + + + /** + * Sets the item image url + * + * @param string $sImageUrl + * @return WirecardCEE_Stdlib_Basket_Item + */ + public function setImageUrl($sImageUrl) { + $this->_setField(self::ITEM_IMAGE_URL, (string) $sImageUrl); + return $this; + } + + /** + * Returns the item image url + * + * @return string + */ + public function getImageUrl() + { + if(array_key_exists(self::ITEM_IMAGE_URL, $this->_itemData)) { + return (string) $this->_itemData[self::ITEM_IMAGE_URL]; + } + return null; } /** * Destructor */ - public function __destruct() { - unset($this); + public function __destruct() + { + unset( $this ); } /*************************************** @@ -140,7 +277,8 @@ public function __destruct() { * @param string $sName * @param mixed $mValue */ - protected function _setField($sName, $mValue) { + protected function _setField($sName, $mValue) + { $this->_itemData[$sName] = $mValue; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/ClientAbstract.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/ClientAbstract.php index 83a1e24..7eb09ec 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/ClientAbstract.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/ClientAbstract.php @@ -1,23 +1,45 @@ _httpClient = $httpClient; return $this; } @@ -204,7 +234,8 @@ public function setZendHttpClient(Zend_Http_Client $httpClient) { * * @return WirecardCEE_Stdlib_Config */ - public function getUserConfig() { + public function getUserConfig() + { return $this->oUserConfig; } @@ -213,7 +244,8 @@ public function getUserConfig() { * * @return WirecardCEE_Stdlib_Config */ - public function getClientConfig() { + public function getClientConfig() + { return $this->oClientConfig; } @@ -222,12 +254,13 @@ public function getClientConfig() { * * @return string */ - public function getUserAgentString() { + public function getUserAgentString() + { $oClientConfig = new WirecardCEE_Stdlib_Config(WirecardCEE_Stdlib_Module::getClientConfig()); $sUserAgent = $this->_getUserAgent() . ";{$oClientConfig->MODULE_NAME};{$oClientConfig->MODULE_VERSION};"; - foreach($oClientConfig->DEPENDENCIES as $sValue) { + foreach ($oClientConfig->DEPENDENCIES as $sValue) { $sUserAgent .= is_string($sValue) ? $sValue . ";" : $sValue->CURRENT . ";"; } @@ -238,14 +271,16 @@ public function getUserAgentString() { * Returns all the request data as an array * @return array */ - public function getRequestData() { - return (array) $this->_requestData; + public function getRequestData() + { + return (array)$this->_requestData; } /** * Destructor */ - public function __destruct() { + public function __destruct() + { unset($this); } @@ -274,7 +309,8 @@ abstract protected function _getUserAgent(); * * @param string $secret */ - protected function _setSecret($secret) { + protected function _setSecret($secret) + { $this->_secret = $secret; $this->_fingerprintOrder[] = self::SECRET; } @@ -285,7 +321,8 @@ protected function _setSecret($secret) { * @throws WirecardCEE_Stdlib_Client_Exception_InvalidResponseException * @return Zend_Http_Response */ - protected function _send() { + protected function _send() + { if (count($this->_fingerprintOrder)) { $this->_fingerprintString = $this->_calculateFingerprint(); if (!is_null($this->_fingerprintString)) { @@ -295,8 +332,7 @@ protected function _send() { try { $response = $this->_sendRequest(); - } - catch (Zend_Http_Client_Exception $e) { + } catch (Zend_Http_Client_Exception $e) { throw new WirecardCEE_Stdlib_Client_Exception_InvalidResponseException($e->getMessage(), $e->getCode(), $e); } @@ -308,13 +344,14 @@ protected function _send() { * * @return string - md5 fingerprint hash */ - protected function _calculateFingerprint() { + protected function _calculateFingerprint() + { $oFingerprintOrder = $this->_fingerprintOrder; if ($this->_fingerprintOrderType == self::$FINGERPRINT_TYPE_DYNAMIC) { // we have to add REQUESTFINGERPRINTORDER to local fingerprintOrder to add correct value to param list $oFingerprintOrder[] = self::REQUEST_FINGERPRINT_ORDER; - $this->_requestData[self::REQUEST_FINGERPRINT_ORDER] = (string) $oFingerprintOrder; + $this->_requestData[self::REQUEST_FINGERPRINT_ORDER] = (string)$oFingerprintOrder; } // fingerprintFields == requestFields + secret - secret MUST NOT be send as param $fingerprintFields = $this->_requestData; @@ -329,11 +366,12 @@ protected function _calculateFingerprint() { * @throws Zend_Http_Client_Exception * @return Zend_Http_Response */ - protected function _sendRequest() { + protected function _sendRequest() + { $httpClient = $this->_getZendHttpClient(); $httpClient->setParameterPost($this->_requestData); $httpClient->setConfig(Array( - 'useragent' => $this->getUserAgentString() + 'useragent' => $this->getUserAgentString() )); return $httpClient->request(Zend_Http_Client::POST); @@ -348,9 +386,10 @@ protected function _sendRequest() { * @param string $name * @param mixed $value */ - protected function _setField($name, $value) { - $this->_requestData[(string) $name] = (string) $value; - $this->_fingerprintOrder[] = (string) $name; + protected function _setField($name, $value) + { + $this->_requestData[(string)$name] = (string)$value; + $this->_fingerprintOrder[] = (string)$name; } /** @@ -359,8 +398,9 @@ protected function _setField($name, $value) { * @param string $sFieldname * @return boolean */ - protected function _isFieldSet($sFieldname) { - return (bool) (isset($this->_requestData[$sFieldname]) && !empty($this->_requestData[$sFieldname])); + protected function _isFieldSet($sFieldname) + { + return (bool)(isset($this->_requestData[$sFieldname]) && !empty($this->_requestData[$sFieldname])); } /** @@ -369,12 +409,12 @@ protected function _isFieldSet($sFieldname) { * * @return Zend_Http_Client */ - protected function _getZendHttpClient() { + protected function _getZendHttpClient() + { if (is_null($this->_httpClient)) { // @todo implement SSL check here $this->_httpClient = new Zend_Http_Client($this->_getRequestUrl()); - } - else { + } else { $this->_httpClient->resetParameters(true); $this->_httpClient->setUri($this->_getRequestUrl()); } @@ -382,22 +422,66 @@ protected function _getZendHttpClient() { return $this->_httpClient; } + /** + * Sets shopping basket data to _requestData + * + * @param WirecardCEE_Stdlib_Basket $basket + */ + protected function _setBasket($basket) + { + if($basket == null) { + return; + } + + foreach($basket->getData() AS $key => $value) { + $this->_setField($key, $value); + } + } + + /** + * Appends basket to fingerprint order + * + * @param WirecardCEE_Stdlib_Basket $basket + */ + protected function _appendBasketFingerprintOrder($basket) + { + if($basket == null) { + return; + } + + $data = $basket->getData(); + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEMS; + for ($i = 1; $i <= (int)$data[WirecardCEE_Stdlib_Basket::BASKET_ITEMS]; $i++) { + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_ARTICLE_NUMBER; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_QUANTITY; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_DESCRIPTION; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_NAME; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_IMAGE_URL; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_GROSS_AMOUNT; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_NET_AMOUNT; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_TAX_AMOUNT; + $this->_fingerprintOrder[] = WirecardCEE_Stdlib_Basket::BASKET_ITEM_PREFIX . $i . WirecardCEE_Stdlib_Basket_Item::ITEM_UNIT_TAX_RATE; + } + } + protected function _composeCustomerStatement($paymenttype, $prefix = null, $uniqString = null) { - if (!strlen($uniqString)) + if (!strlen($uniqString)) { $uniqString = $this->generateUniqString(9); + } - if ($paymenttype == WirecardCEE_Stdlib_PaymentTypeAbstract::POLI) - { - if (strlen($prefix)) + if ($paymenttype == WirecardCEE_Stdlib_PaymentTypeAbstract::POLI) { + if (strlen($prefix)) { $customerStatement = substr($prefix, 0, 9); - else + } else { $customerStatement = $uniqString; + } } else { - if (strlen($prefix)) + if (strlen($prefix)) { $customerStatement = sprintf('%s Id:%s', $prefix, $uniqString); - else + } else { $customerStatement = $uniqString; + } } return $customerStatement; @@ -415,17 +499,14 @@ public function generateUniqString($length = 10) $alphabet = "023456789abcdefghikmnopqrstuvwxyzABCDEFGHIKMNOPQRSTUVWXYZ"; - for ($i = 0; $i < $length; $i++) - { + for ($i = 0; $i < $length; $i++) { $c = substr($alphabet, mt_rand(0, strlen($alphabet) - 1), 1); - if ((($i % 2) == 0) && !is_numeric($c)) - { + if ((($i % 2) == 0) && !is_numeric($c)) { $i--; continue; } - if ((($i % 2) == 1) && is_numeric($c)) - { + if ((($i % 2) == 1) && is_numeric($c)) { $i--; continue; } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/Exception/ExceptionInterface.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/Exception/ExceptionInterface.php index c7f6c17..bf6ac0f 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/Exception/ExceptionInterface.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Client/Exception/ExceptionInterface.php @@ -1,19 +1,42 @@ _index = 0; - $this->_data = array(); - foreach($array as $key => $value) { - if(is_array($value)) { + $this->_data = array(); + foreach ($array as $key => $value) { + if (is_array($value)) { $this->_data[$key] = new self($value); - } - else { + } else { $this->_data[$key] = $value; } } @@ -71,47 +98,56 @@ public function __construct(array $array) { /** * Support isset() overloading on PHP 5.1 * - * @param string $name + * @param string $name + * * @return boolean */ - public function __isset($name) { - return (bool) isset($this->_data[$name]); + public function __isset($name) + { + return (bool) isset( $this->_data[$name] ); } /** * Support unset() overloading on PHP 5.1 * - * @param string $name + * @param string $name + * * @return void */ - public function __unset($name) { - unset($this->_data[$name]); - $this->_count = count($this->_data); + public function __unset($name) + { + unset( $this->_data[$name] ); + $this->_count = count($this->_data); $this->_skipNextIteration = true; } /** * Magic function so that $obj->value will work. * - * @param string $name + * @param string $name + * * @return mixed */ - public function __get($name) { + public function __get($name) + { return $this->get($name); } - + /** * Retrieve a value and return $default if there is no element set. * * @param string $name * @param mixed $default + * * @return mixed */ - public function get($name, $default = null) { + public function get($name, $default = null) + { $result = $default; - if(array_key_exists($name, $this->_data)) { + if (array_key_exists($name, $this->_data)) { $result = $this->_data[$name]; } + return $result; } @@ -120,7 +156,8 @@ public function get($name, $default = null) { * * @return int */ - public function count() { + public function count() + { return $this->_count; } @@ -129,8 +166,10 @@ public function count() { * * @return mixed */ - public function current() { + public function current() + { $this->_skipNextIteration = false; + return current($this->_data); } @@ -139,26 +178,30 @@ public function current() { * * @return mixed */ - public function key() { + public function key() + { return key($this->_data); } /** * Defined by Iterator interface */ - public function next() { - if($this->_skipNextIteration) { + public function next() + { + if ($this->_skipNextIteration) { $this->_skipNextIteration = false; + return; } next($this->_data); - $this->_index++; + $this->_index ++; } /** * Defined by Iterator interface */ - public function rewind() { + public function rewind() + { $this->_skipNextIteration = false; reset($this->_data); $this->_index = 0; @@ -169,7 +212,8 @@ public function rewind() { * * @return boolean */ - public function valid() { + public function valid() + { return $this->_index < $this->_count; } @@ -178,17 +222,18 @@ public function valid() { * * @return array */ - public function toArray() { + public function toArray() + { $array = array(); - $data = $this->_data; - foreach($data as $key => $value) { - if($value instanceof WirecardCEE_Stdlib_Config) { + $data = $this->_data; + foreach ($data as $key => $value) { + if ($value instanceof WirecardCEE_Stdlib_Config) { $array[$key] = $value->toArray(); - } - else { + } else { $array[$key] = $value; } } + return $array; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Config/client.config.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Config/client.config.php index d4de992..9865524 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Config/client.config.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Config/client.config.php @@ -1,24 +1,46 @@ 'WirecardCEE_Stdlib', - 'MODULE_VERSION' => '3.0.0', - 'DEPENDENCIES' => array( - 'FRAMEWORK_NAME' => 'Zend_Framework', - 'FRAMEWORK_VERSION' => Array( - 'MINIMUM' => '1.11.10', - 'CURRENT' => Zend_Version::VERSION - ), - 'SCRIPTING_LANG' => 'PHP', - 'SCRIPTING_LANG_VERSION' => '5.2' + 'MODULE_NAME' => 'WirecardCEE_Stdlib', + 'MODULE_VERSION' => '3.0.2', + 'DEPENDENCIES' => array( + 'FRAMEWORK_NAME' => 'Zend_Framework', + 'FRAMEWORK_VERSION' => Array( + 'MINIMUM' => '1.11.10', + 'CURRENT' => Zend_Version::VERSION ), - 'USE_DEBUG' => FALSE + 'SCRIPTING_LANG' => 'PHP', + 'SCRIPTING_LANG_VERSION' => '5.2' + ), + 'USE_DEBUG' => false ); \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData.php index 758c5b4..9e35e6e 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData.php @@ -1,13 +1,35 @@ _setField(self::$EMAIL, $mailAddress); + return $this; } @@ -100,10 +140,13 @@ public function setEmail($mailAddress) { * setter for the birthdate of the consumer * * @param DateTime $birthDate + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function setBirthDate(DateTime $birthDate) { + public function setBirthDate(DateTime $birthDate) + { $this->_setField(self::$BIRTH_DATE, $birthDate->format(self::$BIRTH_DATE_FORMAT)); + return $this; } @@ -111,10 +154,13 @@ public function setBirthDate(DateTime $birthDate) { * setter for the tax identification number of the consumer * * @param string $taxIdentificationNumber + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function setTaxIdentificationNumber($taxIdentificationNumber) { + public function setTaxIdentificationNumber($taxIdentificationNumber) + { $this->_setField(self::$TAX_IDENTIFICATION_NUMBER, $taxIdentificationNumber); + return $this; } @@ -122,10 +168,13 @@ public function setTaxIdentificationNumber($taxIdentificationNumber) { * setter for the drivers license number of the consumer * * @param string $driversLicenseNumber + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function setDriversLicenseNumber($driversLicenseNumber) { + public function setDriversLicenseNumber($driversLicenseNumber) + { $this->_setField(self::$DRIVERS_LICENSE_NUMBER, $driversLicenseNumber); + return $this; } @@ -133,10 +182,13 @@ public function setDriversLicenseNumber($driversLicenseNumber) { * setter for the drivers license country of the consumer * * @param string $driversLicenseCountry + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function setDriversLicenseCountry($driversLicenseCountry) { + public function setDriversLicenseCountry($driversLicenseCountry) + { $this->_setField(self::$DRIVERS_LICENSE_COUNTRY, $driversLicenseCountry); + return $this; } @@ -144,10 +196,49 @@ public function setDriversLicenseCountry($driversLicenseCountry) { * setter for the drivers license state of the consumer * * @param string $driversLicenseState + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function setDriversLicenseState($driversLicenseState) { + public function setDriversLicenseState($driversLicenseState) + { $this->_setField(self::$DRIVERS_LICENSE_STATE, $driversLicenseState); + + return $this; + } + + /** + * @param string $companyName + * + * @return WirecardCEE_Stdlib_ConsumerData + */ + public function setCompanyName($companyName) + { + $this->_setField(self::$COMPANY_NAME, $companyName); + + return $this; + } + + /** + * @param string $companyVatId + * + * @return WirecardCEE_Stdlib_ConsumerData + */ + public function setCompanyVatId($companyVatId) + { + $this->_setField(self::$COMPANY_VAT_ID, $companyVatId); + + return $this; + } + + /** + * @param string $companyTradeRegistryNumber + * + * @return WirecardCEE_Stdlib_ConsumerData + */ + public function setCompanyTradeRegistryNumber($companyTradeRegistryNumber) + { + $this->_setField(self::$COMPANY_TRADE_REGISTRY_NUMBER, $companyTradeRegistryNumber); + return $this; } @@ -156,11 +247,14 @@ public function setDriversLicenseState($driversLicenseState) { * used {@link WirecardCEE_Stdlib_ConsumerData::getData()} * * @param WirecardCEE_Stdlib_ConsumerData_Address $address + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function addAddressInformation(WirecardCEE_Stdlib_ConsumerData_Address $address) { + public function addAddressInformation(WirecardCEE_Stdlib_ConsumerData_Address $address) + { $consumerData = array_merge($this->_consumerData, $address->getData()); $this->_consumerData = $consumerData; + return $this; } @@ -168,10 +262,13 @@ public function addAddressInformation(WirecardCEE_Stdlib_ConsumerData_Address $a * setter for the consumer IP-Address * * @param string $consumerIpAddress + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function setIpAddress($consumerIpAddress) { + public function setIpAddress($consumerIpAddress) + { $this->_setField(self::$IP_ADDRESS, $consumerIpAddress); + return $this; } @@ -179,10 +276,13 @@ public function setIpAddress($consumerIpAddress) { * setter for the consumer user-agent * * @param string $consumerUserAgent + * * @return WirecardCEE_Stdlib_ConsumerData */ - public function setUserAgent($consumerUserAgent) { + public function setUserAgent($consumerUserAgent) + { $this->_setField(self::$USER_AGENT, $consumerUserAgent); + return $this; } @@ -191,27 +291,28 @@ public function setUserAgent($consumerUserAgent) { * * @return string[] */ - public function getData() { + public function getData() + { return $this->_consumerData; } /** * Static getter for consumerUserAgentField * - * @internal * @return string */ - public static function getConsumerUserAgentFieldName() { + public static function getConsumerUserAgentFieldName() + { return self::$PREFIX . self::$USER_AGENT; } /** * Static getter for consumerIpField * - * @internal * @return string */ - public static function getConsumerIpAddressFieldName() { + public static function getConsumerIpAddressFieldName() + { return self::$PREFIX . self::$IP_ADDRESS; } @@ -220,10 +321,12 @@ public static function getConsumerIpAddressFieldName() { * * @param string $name * @param string $value + * * @access private */ - protected function _setField($name, $value) { + protected function _setField($name, $value) + { // e.g. consumerBillingFirstname - $this->_consumerData[self::$PREFIX . $name] = (string) $value; + $this->_consumerData[self::$PREFIX . $name] = (string)$value; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData/Address.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData/Address.php index c4fa094..5d6ad53 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData/Address.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ConsumerData/Address.php @@ -1,13 +1,35 @@ _addressType = $addressType; } @@ -134,10 +172,13 @@ public function __construct($addressType) { * setter for the firstname used for the given address. * * @param string $firstname + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setFirstname($firstname) { + public function setFirstname($firstname) + { $this->_setField(self::$FIRSTNAME, $firstname); + return $this; } @@ -145,10 +186,13 @@ public function setFirstname($firstname) { * setter for the lastname used for the given address. * * @param string $lastname + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setLastname($lastname) { + public function setLastname($lastname) + { $this->_setField(self::$LASTNAME, $lastname); + return $this; } @@ -156,10 +200,13 @@ public function setLastname($lastname) { * setter for the addressfield 1 used for the given address. * * @param string $address1 + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setAddress1($address1) { + public function setAddress1($address1) + { $this->_setField(self::$ADDRESS1, $address1); + return $this; } @@ -167,10 +214,13 @@ public function setAddress1($address1) { * setter for the addressfield 2 used for the given address. * * @param string $address2 + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setAddress2($address2) { + public function setAddress2($address2) + { $this->_setField(self::$ADDRESS2, $address2); + return $this; } @@ -178,10 +228,13 @@ public function setAddress2($address2) { * setter for the city used for the given address. * * @param string $city + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setCity($city) { + public function setCity($city) + { $this->_setField(self::$CITY, $city); + return $this; } @@ -189,10 +242,13 @@ public function setCity($city) { * setter for the country used for the given address. * * @param string $country + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setCountry($country) { + public function setCountry($country) + { $this->_setField(self::$COUNTRY, $country); + return $this; } @@ -200,10 +256,13 @@ public function setCountry($country) { * setter for the state used for the given address. * * @param string $state + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setState($state) { + public function setState($state) + { $this->_setField(self::$STATE, $state); + return $this; } @@ -211,10 +270,13 @@ public function setState($state) { * setter for the zip code used for the given address. * * @param string $zipCode + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setZipCode($zipCode) { + public function setZipCode($zipCode) + { $this->_setField(self::$ZIP_CODE, $zipCode); + return $this; } @@ -222,10 +284,13 @@ public function setZipCode($zipCode) { * setter for the phone number used for the given address. * * @param string $phone + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setPhone($phone) { + public function setPhone($phone) + { $this->_setField(self::$PHONE, $phone); + return $this; } @@ -233,10 +298,13 @@ public function setPhone($phone) { * setter for the fax number used for the given address. * * @param string $fax + * * @return WirecardCEE_Stdlib_ConsumerData_Address */ - public function setFax($fax) { + public function setFax($fax) + { $this->_setField(self::$FAX, $fax); + return $this; } @@ -246,7 +314,8 @@ public function setFax($fax) { * @param string $name * @param string $value */ - protected function _setField($name, $value) { + protected function _setField($name, $value) + { // e.g. consumerBillingFirstname $this->_addressData[self::$PREFIX . $this->_addressType . $name] = (string) $value; } @@ -256,7 +325,8 @@ protected function _setField($name, $value) { * * @return string[] */ - public function getData() { + public function getData() + { return $this->_addressData; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Error.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Error.php index 7e20bbe..8ac5c7c 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Error.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Error.php @@ -1,21 +1,44 @@ _message; } @@ -44,10 +68,13 @@ public function getMessage() { * Error Message setter * * @param string $message + * * @return WirecardCEE_Stdlib_Error */ - public function setMessage($message) { + public function setMessage($message) + { $this->_message = (string) $message; + return $this; } @@ -55,10 +82,13 @@ public function setMessage($message) { * Consumer message setter * * @param string $consumerMessage + * * @return WirecardCEE_Stdlib_Error */ - public function setConsumerMessage($consumerMessage) { + public function setConsumerMessage($consumerMessage) + { $this->_consumerMessage = (string) $consumerMessage; + return $this; } @@ -67,7 +97,8 @@ public function setConsumerMessage($consumerMessage) { * * @return string */ - public function getConsumerMessage() { + public function getConsumerMessage() + { return (string) $this->_consumerMessage; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Exception/ExceptionInterface.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Exception/ExceptionInterface.php index 707d30c..ff55968 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Exception/ExceptionInterface.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Exception/ExceptionInterface.php @@ -1,19 +1,42 @@ pair) or string ("first, second, thrid, fourth" format) * * @param string|array $mItems + * * @throws WirecardCEE_Stdlib_Exception_InvalidArgumentException */ - public function __construct($mItems = null) { + public function __construct($mItems = null) + { $this->_fingeprintOrder = Array(); - if(!is_null($mItems) && !$this->setOrder($mItems)) { - throw new WirecardCEE_Stdlib_Exception_InvalidArgumentException(sprintf("Unknown fingerprint format in %s on line %s", __METHOD__, __LINE__)); + if (!is_null($mItems) && !$this->setOrder($mItems)) { + throw new WirecardCEE_Stdlib_Exception_InvalidArgumentException(sprintf("Unknown fingerprint format in %s on line %s", + __METHOD__, __LINE__)); } } @@ -58,20 +84,21 @@ public function __construct($mItems = null) { * or from an existing array (normal "key=>pair" format). * * @param string|array $mItems + * * @return boolean */ - public function setOrder($mItems) { - if(is_array($mItems) && count($mItems)) { + public function setOrder($mItems) + { + if (is_array($mItems) && count($mItems)) { $this->_fingeprintOrder = Array(); - foreach($mItems as $sItem) { + foreach ($mItems as $sItem) { $this->_fingeprintOrder[] = trim($sItem); } + return true; - } - elseif(is_string($mItems)) { + } elseif (is_string($mItems)) { return $this->setOrder(explode(",", $mItems)); - } - else { + } else { return false; } } @@ -83,7 +110,8 @@ public function setOrder($mItems) { * * @return array */ - public function __toArray() { + public function __toArray() + { return (array) $this->_fingeprintOrder; } @@ -92,7 +120,8 @@ public function __toArray() { * * @return string */ - public function __toString() { + public function __toString() + { return (string) implode(",", $this->_fingeprintOrder); } @@ -102,11 +131,11 @@ public function __toString() { * @param int|string $mOffset * @param int|string $mValue */ - public function offsetSet($mOffset, $mValue) { - if(!$mOffset) { + public function offsetSet($mOffset, $mValue) + { + if (!$mOffset) { $this->_fingeprintOrder[] = trim($mValue); - } - else { + } else { $this->_fingeprintOrder[$mOffset] = trim($mValue); } } @@ -115,20 +144,24 @@ public function offsetSet($mOffset, $mValue) { * @see ArrayAccess::offsetGet($mOffset) * * @param int|string $mOffset + * * @return Mixed */ - public function offsetGet($mOffset) { - return isset($this->_fingeprintOrder[$mOffset]) ? $this->_fingeprintOrder[$mOffset] : null; + public function offsetGet($mOffset) + { + return isset( $this->_fingeprintOrder[$mOffset] ) ? $this->_fingeprintOrder[$mOffset] : null; } /** * @see ArrayAccess::offsetExists($mOffset) * * @param int|string $mOffset + * * @return boolean */ - public function offsetExists($mOffset) { - return (bool) isset($this->_fingeprintOrder[$mOffset]); + public function offsetExists($mOffset) + { + return (bool) isset( $this->_fingeprintOrder[$mOffset] ); } /** @@ -136,8 +169,9 @@ public function offsetExists($mOffset) { * * @param int|string $mOffset */ - public function offsetUnset($mOffset) { - unset($this->_fingeprintOrder[$mOffset]); + public function offsetUnset($mOffset) + { + unset( $this->_fingeprintOrder[$mOffset] ); } /** @@ -147,7 +181,8 @@ public function offsetUnset($mOffset) { * @see IteratorAggregate::getIterator() * @return ArrayIterator */ - public function getIterator() { + public function getIterator() + { return new ArrayIterator($this->_fingeprintOrder); } @@ -157,7 +192,8 @@ public function getIterator() { * @see Countable::count(); * @return number */ - public function count() { + public function count() + { return (int) count($this->_fingeprintOrder); } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Module.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Module.php index 5fee6a4..9053f40 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Module.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Module.php @@ -1,29 +1,52 @@ 'Austrian Anadi Bank AG', 'BA-CA' => 'Bank Austria Creditanstalt', - 'Bawag|B' => 'BAWAG', - 'Bawag|E' => 'easybank', - 'Bawag|P' => 'PSK Bank', - 'Bawag|S' => 'Sparda Bank', 'BB-Racon' => 'Bank Burgenland', - 'Hypo-Racon|O' => 'Hypo Oberösterreich', - 'Hypo-Racon|S' => 'Hypo Salzburg', - 'Hypo-Racon|St' => 'Hypo Steiermark', - 'Racon' => 'Raiffeisen Bank', - 'Spardat|EBS' => 'Erste Bank und Sparkassen', - 'ARZ|AAB' => 'Austrian Anadi Bank AG', - 'ARZ|AB' => 'Österreichische Apothekerbank', - 'ARZ|BAF' => 'Ärztebank', - 'ARZ|BCS' => 'Bankhaus Carl Spängler & Co. AG', 'ARZ|BD' => 'bankdirekt.at AG', - 'ARZ|BKS' => 'BKS Bank AG', + 'ARZ|BAF' => 'Ärztebank', + 'ARZ|BCS' => 'Bankhaus Carl Spängler & Co. AG', 'ARZ|BSS' => 'Bankhaus Schelhammer & Schattera AG', - 'ARZ|BTV' => 'BTV VIER LÄNDER BANK', + 'Bawag|B' => 'BAWAG', + 'ARZ|VB' => 'Die österreichischen Volksbanken', + 'Bawag|E' => 'easybank', + 'Spardat|EBS' => 'Erste Bank und Sparkassen', 'ARZ|GB' => 'Gärtnerbank', 'ARZ|HAA' => 'Hypo Alpe-Adria-Bank AG, HYPO Alpe-Adria-Bank International AG', 'ARZ|HI' => 'Hypo Investmentbank AG', 'ARZ|HTB' => 'Hypo Tirol Bank AG', 'ARZ|IB' => 'Immo-Bank', 'ARZ|IKB' => 'Investkredit Bank AG', - 'ARZ|NLH' => 'Niesterösterreichische Landes-Hypothekenbank AG', - 'ARZ|OB' => 'Oberbank AG', + 'ARZ|NLH' => 'Niederösterreichische Landes-Hypothekenbank AG', + 'ARZ|AB' => 'Österreichische Apothekerbank', 'ARZ|PB' => 'PRIVAT BANK AG', + 'Bawag|P' => 'PSK Bank', + 'Racon' => 'Raiffeisen Bank', 'ARZ|SB' => 'Schoellerbank AG', + 'Bawag|S' => 'Sparda Bank', 'ARZ|SBL' => 'Sparda-Bank Linz', 'ARZ|SBVI' => 'Sparda-Bank Villach/Innsbruck', - 'ARZ|VB' => 'Die östereischischen Volksbanken', 'ARZ|VLH' => 'Vorarlberger Landes- und Hypothekerbank AG', - 'ARZ|VRB' => 'VR-Bank Braunau', + 'ARZ|VRB' => 'VR-Bank Braunau' ); /** @@ -99,34 +118,38 @@ abstract class WirecardCEE_Stdlib_PaymentTypeAbstract { protected static $_idl_financial_institutions = Array( 'ABNAMROBANK' => 'ABN AMRO Bank', 'ASNBANK' => 'ASN Bank', - 'FRIESLANDBANK' => 'Friesland Bank', 'INGBANK' => 'ING', - 'KNAB' => 'knab', + 'KNAB' => 'Knab', 'RABOBANK' => 'Rabobank', 'SNSBANK' => 'SNS Bank', - 'REGIOBANK' => 'RegioBank', + 'REGIOBANK' => 'Regio Bank', 'TRIODOSBANK' => 'Triodos Bank', 'VANLANSCHOT' => 'Van Lanschot Bankiers' ); + /** * check if the given paymenttype has financial institions * * @param string $paymentType + * * @return bool */ - public static function hasFinancialInstitutions($paymentType) { - return (bool) ($paymentType == self::EPS || $paymentType == self::IDL); + public static function hasFinancialInstitutions($paymentType) + { + return (bool)($paymentType == self::EPS || $paymentType == self::IDL); } /** * the an array of financial institutions for the given paymenttype. * * @param string $paymentType + * * @return string[] */ - public static function getFinancialInstitutions($paymentType) { - switch($paymentType) { + public static function getFinancialInstitutions($paymentType) + { + switch ($paymentType) { case self::EPS: return self::$_eps_financial_institutions; break; @@ -144,9 +167,11 @@ public static function getFinancialInstitutions($paymentType) { * Used in dd_wirecard_order.php (function: getPayment()) * * @param string $sFinancialInstitutionShortCode + * * @return string */ - public static function getFinancialInstitutionFullName($sFinancialInstitutionShortCode) { + public static function getFinancialInstitutionFullName($sFinancialInstitutionShortCode) + { if (array_key_exists($sFinancialInstitutionShortCode, self::$_eps_financial_institutions)) { return self::$_eps_financial_institutions[$sFinancialInstitutionShortCode]; } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Response/ResponseAbstract.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Response/ResponseAbstract.php index 952081f..394a257 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Response/ResponseAbstract.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Response/ResponseAbstract.php @@ -1,23 +1,45 @@ _response = WirecardCEE_Stdlib_SerialApi::decode($response->getBody()); - } - elseif (is_array($response)) { + } elseif (is_array($response)) { $this->_response = $response; - } - else { - throw new WirecardCEE_Stdlib_Exception_InvalidResponseException(sprintf('Invalid response from WirecardCEE thrown in %s.', __METHOD__)); + } else { + throw new WirecardCEE_Stdlib_Exception_InvalidResponseException(sprintf('Invalid response from WirecardCEE thrown in %s.', + __METHOD__)); } } @@ -84,8 +106,9 @@ public function __construct($response) { * * @return boolean */ - public function hasFailed() { - return (bool) ($this->getStatus() == self::STATE_FAILURE); + public function hasFailed() + { + return (bool)($this->getStatus() == self::STATE_FAILURE); } /** @@ -94,7 +117,8 @@ public function hasFailed() { * @param string $name * @return string|array|null */ - protected function _getField($name) { + protected function _getField($name) + { return isset($this->_response[$name]) ? $this->_response[$name] : null; } @@ -104,7 +128,18 @@ protected function _getField($name) { * * @return string */ - public function getRedirectUrl() { - return (string) $this->_getField(self::REDIRECT_URL); + public function getRedirectUrl() + { + return (string)$this->_getField(self::REDIRECT_URL); + } + + /** + * getter for the response data + * + * @return array + */ + public function getResponse() + { + return $this->_response; } } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Cancel.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Cancel.php index 8d3128f..2760521 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Cancel.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Cancel.php @@ -1,23 +1,45 @@ $secret, - self::$FINGERPRINT_ORDER_FIELD => 'responseFingerprintOrder', + self::$SECRET => $secret, + self::$FINGERPRINT_ORDER_FIELD => 'responseFingerprintOrder', )); $oFingerprintValidator->setHashAlgorithm($hashAlgo); @@ -64,7 +91,8 @@ public function __construct($returnData, $secret, $hashAlgo = WirecardCEE_Stdlib * * @return string */ - public function getOrderNumber() { + public function getOrderNumber() + { return $this->orderNumber; } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/ReturnAbstract.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/ReturnAbstract.php index f157c58..c47c663 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/ReturnAbstract.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/ReturnAbstract.php @@ -1,23 +1,45 @@ _returnData = $returnData; } @@ -53,21 +76,23 @@ public function __construct($returnData) { * * @return boolean */ - public function validate() { + public function validate() + { // If there are no validators in the array then the validation is "successfull" - if(!count($this->_validators)) { + if (!count($this->_validators)) { return true; } $_bValid = true; // Iterate thru all the validators and validate every one of them - foreach($this->_validators as $param => $aValidator) { - foreach($aValidator as $oValidator) { - $param = (string) $param; + foreach ($this->_validators as $param => $aValidator) { + foreach ($aValidator as $oValidator) { + $param = (string)$param; - if(!isset($this->_returnData[$param])) { - throw new Exception(sprintf("No key '{$param}' found in \$this->_returnData array. Thrown in %s on line %s.", __METHOD__, __LINE__)); + if (!isset($this->_returnData[$param])) { + throw new Exception(sprintf("No key '{$param}' found in \$this->_returnData array. Thrown in %s on line %s.", + __METHOD__, __LINE__)); } $bValidatorResult = $oValidator->isValid($this->_returnData[$param], $this->_returnData); @@ -76,7 +101,7 @@ public function validate() { } } - return (bool) $_bValid; + return (bool)$_bValid; } /** @@ -86,8 +111,9 @@ public function validate() { * @param string $param * @return WirecardCEE_Stdlib_Return_ReturnAbstract */ - public function addValidator(Zend_Validate_Abstract $oValidator, $param) { - $this->_validators[(string) $param][] = $oValidator; + public function addValidator(Zend_Validate_Abstract $oValidator, $param) + { + $this->_validators[(string)$param][] = $oValidator; return $this; } @@ -96,8 +122,9 @@ public function addValidator(Zend_Validate_Abstract $oValidator, $param) { * * @return string */ - public function getPaymentState() { - return (string) $this->_state; + public function getPaymentState() + { + return (string)$this->_state; } /** @@ -106,9 +133,10 @@ public function getPaymentState() { * @param string $name * @return string */ - public function __get($name) { - $name = (string) $name; - return (string) array_key_exists($name, $this->_returnData) ? $this->_returnData[$name] : ''; + public function __get($name) + { + $name = (string)$name; + return (string)array_key_exists($name, $this->_returnData) ? $this->_returnData[$name] : ''; } /** @@ -116,14 +144,19 @@ public function __get($name) { * * @return string[] */ - public function getReturned() { - // noone needs the responseFingerprintOrder and responseFingerprint in - // the shop. - if (array_key_exists('responseFingerprintOrder', $this->_returnData) && array_key_exists('responseFingerprint', $this->_returnData)) { - unset($this->_returnData['responseFingerprintOrder']); - unset($this->_returnData['responseFingerprint']); + public function getReturned() + { + $ret = $this->_returnData; + + // noone needs the responseFingerprintOrder and responseFingerprint in the shop. + if (array_key_exists('responseFingerprintOrder', $ret)) { + unset( $ret['responseFingerprintOrder'] ); + } + + if (array_key_exists('responseFingerprint', $ret)) { + unset( $ret['responseFingerprint'] ); } - return $this->_returnData; + return $ret; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success.php index 9af6319..36e7b73 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success.php @@ -1,23 +1,45 @@ _secret = (string) $secret; + public function __construct( + Array $returnData, + $secret, + $hashAlgo = WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_HMAC_SHA512 + ) { + $this->_secret = (string)$secret; parent::__construct($returnData); $oFingerprintValidator = new WirecardCEE_Stdlib_Validate_Fingerprint(Array( - self::$SECRET => $secret, - self::$FINGERPRINT_ORDER_FIELD => 'responseFingerprintOrder', + self::$SECRET => $secret, + self::$FINGERPRINT_ORDER_FIELD => 'responseFingerprintOrder', )); $oFingerprintValidator->setHashAlgorithm($hashAlgo); @@ -71,7 +97,8 @@ public function __construct(Array $returnData, $secret, $hashAlgo = WirecardCEE_ * * @return string */ - public function getAmount() { + public function getAmount() + { return $this->amount; } @@ -80,8 +107,9 @@ public function getAmount() { * * @return string */ - public function getCurrency() { - return (string) $this->currency; + public function getCurrency() + { + return (string)$this->currency; } /** @@ -89,8 +117,9 @@ public function getCurrency() { * * @return string */ - public function getPaymentType() { - return (string) $this->paymentType; + public function getPaymentType() + { + return (string)$this->paymentType; } /** @@ -98,8 +127,9 @@ public function getPaymentType() { * * @return string */ - public function getFinancialInstitution() { - return (string) $this->financialInstitution; + public function getFinancialInstitution() + { + return (string)$this->financialInstitution; } /** @@ -107,8 +137,9 @@ public function getFinancialInstitution() { * * @return string */ - public function getLanguage() { - return (string) $this->language; + public function getLanguage() + { + return (string)$this->language; } /** @@ -116,7 +147,8 @@ public function getLanguage() { * * @return string */ - public function getOrderNumber() { + public function getOrderNumber() + { return $this->orderNumber; } @@ -125,7 +157,8 @@ public function getOrderNumber() { * * @return string */ - public function getGatewayReferenceNumber() { + public function getGatewayReferenceNumber() + { return $this->gatewayReferenceNumber; } @@ -134,7 +167,8 @@ public function getGatewayReferenceNumber() { * * @return string */ - public function getGatewayContractNumber() { + public function getGatewayContractNumber() + { return $this->gatewayContractNumber; } @@ -143,7 +177,8 @@ public function getGatewayContractNumber() { * * @return string */ - public function getAvsResponseCode() { + public function getAvsResponseCode() + { return $this->avsResponseCode; } @@ -152,7 +187,8 @@ public function getAvsResponseCode() { * * @return string */ - public function getAvsResponseMessage() { - return (string) $this->avsResponseMessage; + public function getAvsResponseMessage() + { + return (string)$this->avsResponseMessage; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/CreditCard.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/CreditCard.php index 0c1755b..5bc9a4f 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/CreditCard.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/CreditCard.php @@ -1,31 +1,54 @@ anonymousPan; + public function getAnonymousPan() + { + return (string)$this->anonymousPan; } /** @@ -33,8 +56,9 @@ public function getAnonymousPan() { * * @return string */ - public function getAuthenticated() { - return (string) $this->authenticated; + public function getAuthenticated() + { + return (string)$this->authenticated; } /** @@ -42,8 +66,9 @@ public function getAuthenticated() { * * @return string */ - public function getExpiry() { - return (string) $this->expiry; + public function getExpiry() + { + return (string)$this->expiry; } /** @@ -51,8 +76,9 @@ public function getExpiry() { * * @return string */ - public function getCardholder() { - return (string) $this->cardholder; + public function getCardholder() + { + return (string)$this->cardholder; } /** @@ -60,7 +86,8 @@ public function getCardholder() { * * @return string */ - public function getMaskedPan() { - return (string) $this->maskedPan; + public function getMaskedPan() + { + return (string)$this->maskedPan; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Ideal.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Ideal.php index ea18f8a..c47917d 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Ideal.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Ideal.php @@ -1,30 +1,53 @@ idealConsumerName; + public function getConsumerName() + { + return (string)$this->idealConsumerName; } /** @@ -32,8 +55,9 @@ public function getConsumerName() { * * @return string */ - public function getConsumerCity() { - return (string) $this->idealConsumerCity; + public function getConsumerCity() + { + return (string)$this->idealConsumerCity; } /** @@ -41,7 +65,8 @@ public function getConsumerCity() { * * @return string */ - public function getConsumerAccountNumber() { - return (string) $this->idealConsumerAccountNumber; + public function getConsumerAccountNumber() + { + return (string)$this->idealConsumerAccountNumber; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Masterpass.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Masterpass.php new file mode 100644 index 0000000..fb24834 --- /dev/null +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Masterpass.php @@ -0,0 +1,203 @@ +masterpassBillingAddressCity; + } + + /** + * getter for the return parameter masterpassBillingAddressCountry + * + * @return string + */ + public function getMasterpassBillingAddressCountry() + { + return (string)$this->masterpassBillingAddressCountry; + } + + /** + * getter for the return parameter masterpassBillingAddressCountrySubdivision + * + * @return string + */ + public function getMasterpassBillingAddressCountrySubdivision() + { + return (string)$this->masterpassBillingAddressCountrySubdivision; + } + + /** + * getter for the return parameter masterpassBillingAddressPostalCode + * + * @return string + */ + public function getMasterpassBillingAddressPostalCode() + { + return (string)$this->masterpassBillingAddressPostalCode; + } + + /** + * getter for the return parameter masterpassBillingAddressAddressLine1 + * + * @return string + */ + public function getMasterpassBillingAddressAddressLine1() + { + return (string)$this->masterpassBillingAddressAddressLine1; + } + + /** + * getter for the return parameter masterpassBillingAddressAddressLine2 + * + * @return string + */ + public function getMasterpassBillingAddressAddressLine2() + { + return (string)$this->masterpassBillingAddressAddressLine2; + } + + /** + * getter for the return parameter masterpassBillingAddressAddressLine3 + * + * @return string + */ + public function getMasterpassBillingAddressAddressLine3() + { + return (string)$this->masterpassBillingAddressAddressLine3; + } + + /** + * getter for the return parameter masterpassShippingAddressRecipientName + * + * @return string + */ + public function getMasterpassShippingAddressRecipientName() + { + return (string)$this->masterpassShippingAddressRecipientName; + } + + /** + * getter for the return parameter masterpassShippingAddressRecipientPhoneNumber + * + * @return string + */ + public function getMasterpassShippingAddressRecipientPhoneNumber() + { + return (string)$this->masterpassShippingAddressRecipientPhoneNumber; + } + + /** + * getter for the return parameter masterpassShippingAddressCity + * + * @return string + */ + public function getMasterpassShippingAddressCity() + { + return (string)$this->masterpassShippingAddressCity; + } + + /** + * getter for the return parameter masterpassShippingAddressCountry + * + * @return string + */ + public function getMasterpassShippingAddressCountry() + { + return (string)$this->masterpassShippingAddressCountry; + } + + /** + * getter for the return parameter masterpassShippingAddressCountrySubdivision + * + * @return string + */ + public function getMasterpassShippingAddressCountrySubdivision() + { + return (string)$this->masterpassShippingAddressCountrySubdivision; + } + + /** + * getter for the return parameter masterpassShippingAddressPostalCode + * + * @return string + */ + public function getMasterpassShippingAddressPostalCode() + { + return (string)$this->masterpassShippingAddressPostalCode; + } + + /** + * getter for the return parameter masterpassShippingAddressAddressLine1 + * + * @return string + */ + public function getMasterpassShippingAddressAddressLine1() + { + return (string)$this->masterpassShippingAddressAddressLine1; + } + + /** + * getter for the return parameter masterpassShippingAddressAddressLine2 + * + * @return string + */ + public function getMasterpassShippingAddressAddressLine2() + { + return (string)$this->masterpassShippingAddressAddressLine2; + } + + /** + * getter for the return parameter masterpassShippingAddressAddressLine3 + * + * @return string + */ + public function getMasterpassShippingAddressAddressLine3() + { + return (string)$this->masterpassShippingAddressAddressLine3; + } + +} \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/PayPal.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/PayPal.php index cd479d8..236485b 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/PayPal.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/PayPal.php @@ -1,30 +1,53 @@ paypalPayerID; } @@ -33,7 +56,8 @@ public function getPayerId() { * * @return string */ - public function getPayerEmail() { + public function getPayerEmail() + { return $this->paypalPayerEmail; } @@ -42,7 +66,8 @@ public function getPayerEmail() { * * @return string */ - public function getPayerLastName() { + public function getPayerLastName() + { return $this->paypalPayerLastName; } @@ -51,7 +76,8 @@ public function getPayerLastName() { * * @return string */ - public function getPayerFirstName() { + public function getPayerFirstName() + { return $this->paypalPayerFirstName; } @@ -60,7 +86,8 @@ public function getPayerFirstName() { * * @return string */ - public function getPayerAddressName() { + public function getPayerAddressName() + { return $this->paypalPayerAddressName; } @@ -69,7 +96,8 @@ public function getPayerAddressName() { * * @return string */ - public function getPayerAddressCountry() { + public function getPayerAddressCountry() + { return $this->paypalPayerAddressCountry; } @@ -78,7 +106,8 @@ public function getPayerAddressCountry() { * * @return string */ - public function getPayerAddressCity() { + public function getPayerAddressCity() + { return $this->paypalPayerAddressCity; } @@ -87,7 +116,8 @@ public function getPayerAddressCity() { * * @return string */ - public function getPayerAddressState() { + public function getPayerAddressState() + { return $this->paypalPayerAddressState; } @@ -96,7 +126,8 @@ public function getPayerAddressState() { * * @return string */ - public function getPayerAddressStreet1() { + public function getPayerAddressStreet1() + { return $this->paypalPayerAddressStreet1; } @@ -105,7 +136,8 @@ public function getPayerAddressStreet1() { * * @return string */ - public function getPayerAddressStreet2() { + public function getPayerAddressStreet2() + { return $this->paypalPayerAddressStreet2; } @@ -114,7 +146,8 @@ public function getPayerAddressStreet2() { * * @return string */ - public function getPayerAddressZip() { + public function getPayerAddressZip() + { return $this->paypalPayerAddressZIP; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/SepaDD.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/SepaDD.php index dbf3cc2..29a7e61 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/SepaDD.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/SepaDD.php @@ -1,28 +1,52 @@ creditorId; } @@ -31,7 +55,8 @@ public function getCreditorId() { * * @return string */ - public function getDueDate() { + public function getDueDate() + { return $this->dueDate; } @@ -40,7 +65,8 @@ public function getDueDate() { * * @return string */ - public function getMandateId() { + public function getMandateId() + { return $this->mandateId; } @@ -49,7 +75,8 @@ public function getMandateId() { * * @return string */ - public function getMandateSignatureDate() { + public function getMandateSignatureDate() + { return $this->mandateSignatureDate; } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Sofortueberweisung.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Sofortueberweisung.php index 098557b..de58400 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Sofortueberweisung.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Return/Success/Sofortueberweisung.php @@ -1,30 +1,53 @@ senderAccountOwner; } @@ -33,7 +56,8 @@ public function getSenderAccountOwner() { * * @return string */ - public function getSenderAccountNumber() { + public function getSenderAccountNumber() + { return $this->senderAccountNumber; } @@ -42,7 +66,8 @@ public function getSenderAccountNumber() { * * @return string */ - public function getSenderBankNumber() { + public function getSenderBankNumber() + { return $this->senderBankNumber; } @@ -51,7 +76,8 @@ public function getSenderBankNumber() { * * @return string */ - public function getSenderBankName() { + public function getSenderBankName() + { return $this->senderBankName; } @@ -60,7 +86,8 @@ public function getSenderBankName() { * * @return string */ - public function getSenderBic() { + public function getSenderBic() + { return $this->senderBIC; } @@ -69,7 +96,8 @@ public function getSenderBic() { * * @return string */ - public function getSenderIban() { + public function getSenderIban() + { return $this->senderIBAN; } @@ -78,7 +106,8 @@ public function getSenderIban() { * * @return string */ - public function getSenderCountry() { + public function getSenderCountry() + { return $this->senderCountry; } @@ -87,7 +116,8 @@ public function getSenderCountry() { * * @return string */ - public function getSecurityCriteria() { + public function getSecurityCriteria() + { return $this->securityCriteria; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ReturnFactoryAbstract.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ReturnFactoryAbstract.php index 0c53ace..f0d5016 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ReturnFactoryAbstract.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/ReturnFactoryAbstract.php @@ -1,10 +1,36 @@ '; - if (empty($messages)) { + public static function generateConfirmResponseString($messages = null, $inCommentTag = false) + { + $template = ''; + if (empty( $messages )) { $returnValue = str_replace('%status%', 'OK', $template); - $returnValue = str_replace('%message% ', '', $returnValue); - } - else { + $returnValue = str_replace('%message%', '', $returnValue); + } else { $returnValue = str_replace('%status%', 'NOK', $template); - $returnValue = str_replace('%message%', 'message="' . strval($messages) . '"', $returnValue); + $returnValue = str_replace('%message%', 'message="' . strval($messages) . '" ', $returnValue); } if ($inCommentTag) { $returnValue = ''; } + return $returnValue; } } \ No newline at end of file diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/SerialApi.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/SerialApi.php index 5da85d4..8a6b400 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/SerialApi.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/SerialApi.php @@ -1,21 +1,43 @@ $value) { + foreach ($aValueToEncode as $key => $value) { $serializedString = self::_addEntryEncode($key, $value, $serializedString); } + return $serializedString; - } - else { - throw new WirecardCEE_Stdlib_Exception_InvalidTypeException(sprintf('Invalid type for %s. Array must be given.', __METHOD__)); + } else { + throw new WirecardCEE_Stdlib_Exception_InvalidTypeException(sprintf('Invalid type for %s. Array must be given.', + __METHOD__)); } } @@ -46,65 +72,64 @@ public static function encode($aValueToEncode) { * @param mixed|mixed[] value for key entry * @param string serialized String */ - protected static function _addEntryEncode($key, $value, $serializedString = '') { + protected static function _addEntryEncode($key, $value, $serializedString = '') + { if (is_array($value)) { - $entryValue = Array(); - $entryKey = ''; - $nextEntryKey = ''; + $entryValue = Array(); + $entryKey = ''; + $nextEntryKey = ''; $nextEntryValue = ''; - foreach($value as $subKey => $subValue) { + foreach ($value as $subKey => $subValue) { if (is_int($subKey)) { - $subKey++; + $subKey ++; if (!is_array($subValue)) { if ($entryKey == '') { if (is_numeric(substr(strrchr($key, '.'), 1))) { $entryKey = $key . '.' . $subKey; - } - else { + } else { $entryKey = $key; } } $entryValue[] = $subValue; // next loop continue; - } - else { - if (!empty($entryValue)) { - $serializedString = self::_addLastEntryArrayEncode($entryKey, $entryValue, $serializedString); - $entryValue = ''; - $entryKey = ''; + } else { + if (!empty( $entryValue )) { + $serializedString = self::_addLastEntryArrayEncode($entryKey, $entryValue, + $serializedString); + $entryValue = ''; + $entryKey = ''; } } } - if (empty($entryValue)) { + if (empty( $entryValue )) { $serializedString = self::_addEntryEncode($key . '.' . $subKey, $subValue, $serializedString); - } - else { - $nextEntryKey = $key . '.' . $subKey; + } else { + $nextEntryKey = $key . '.' . $subKey; $nextEntryValue = $subValue; } } - if (!empty($entryValue)) { + if (!empty( $entryValue )) { $serializedString = self::_addLastEntryArrayEncode($entryKey, $entryValue, $serializedString); - $entryValue = ''; - $entryKey = ''; + $entryValue = ''; + $entryKey = ''; if ($nextEntryKey != '' && $nextEntryValue != '') { $serializedString = self::_addEntryEncode($nextEntryKey, $nextEntryValue, $serializedString); - $nextEntryKey = ''; - $nextEntryValue = ''; + $nextEntryKey = ''; + $nextEntryValue = ''; } } - } - else { + } else { if ($serializedString != '') { $serializedString .= '&'; } if (is_int($key)) { - $key++; + $key ++; } $serializedString .= urlencode((string) $key) . '=' . urlencode((string) $value); } + return $serializedString; } @@ -113,33 +138,36 @@ protected static function _addEntryEncode($key, $value, $serializedString = '') * @param string $sKey * @param array $aValues * @param string $serializedString + * * @return string */ - protected static function _addLastEntryArrayEncode($sKey, Array $aValues, $serializedString) { + protected static function _addLastEntryArrayEncode($sKey, Array $aValues, $serializedString) + { $valueString = ''; - foreach($aValues as $value) { + foreach ($aValues as $value) { if ($valueString == '') { $valueString = urlencode((string) $value); - } - else { + } else { $valueString .= ',' . urlencode((string) $value); } } if ($serializedString == '') { $serializedString = urlencode((string) $sKey) . '=' . $valueString; - } - else { + } else { $serializedString .= '&' . urlencode((string) $sKey) . '=' . $valueString; } + return $serializedString; } - public static function decode($encodedValue) { - $decodedValue = Array(); + public static function decode($encodedValue) + { + $decodedValue = Array(); $keyValueStrings = explode('&', $encodedValue); - foreach($keyValueStrings as $entry) { + foreach ($keyValueStrings as $entry) { $decodedValue = self::_addEntryDecode($entry, $decodedValue); } + return $decodedValue; } @@ -147,59 +175,60 @@ public static function decode($encodedValue) { * * @param string $sEntry * @param array $aDecodedValue + * * @throws WirecardCEE_Stdlib_Exception_InvalidFormatException * @return Array */ - protected static function _addEntryDecode($sEntry, $aDecodedValue) { + protected static function _addEntryDecode($sEntry, $aDecodedValue) + { $aEntry = explode('=', $sEntry); if (!is_array($aEntry) || count($aEntry) < 2) { // ignore keys only return $aDecodedValue; - } - else - if (count($aEntry) == 2) { - $keyArray = explode('.', $aEntry[0]); - if (is_array($keyArray) && count($keyArray) > 1) { - $position = & $aDecodedValue; - foreach($keyArray as $keyName) { - if ($keyName == intval($keyName)) { - $keyName--; - } - if (!isset($position[$keyName])) { - $position[$keyName] = Array(); - } - $position = & $position[$keyName]; + } else if (count($aEntry) == 2) { + $keyArray = explode('.', $aEntry[0]); + if (is_array($keyArray) && count($keyArray) > 1) { + $position = &$aDecodedValue; + foreach ($keyArray as $keyName) { + if ($keyName == intval($keyName)) { + $keyName --; } - $position = self::_decodeValueArray($aEntry[1]); - } - else { - if ($aEntry[0] == intval($aEntry[0])) { - $aEntry[0]--; + if (!isset( $position[$keyName] )) { + $position[$keyName] = Array(); } - $aDecodedValue[urldecode($aEntry[0])] = self::_decodeValueArray($aEntry[1]); + $position = &$position[$keyName]; } - return $aDecodedValue; - } - else { - throw new WirecardCEE_Stdlib_Exception_InvalidFormatException('Invalid format for WirecardCEE_Stdlib_SerialApi::decode. Expecting key=value pairs'); + $position = self::_decodeValueArray($aEntry[1]); + } else { + if ($aEntry[0] == intval($aEntry[0])) { + $aEntry[0] --; + } + $aDecodedValue[urldecode($aEntry[0])] = self::_decodeValueArray($aEntry[1]); } + + return $aDecodedValue; + } else { + throw new WirecardCEE_Stdlib_Exception_InvalidFormatException('Invalid format for WirecardCEE_Stdlib_SerialApi::decode. Expecting key=value pairs'); + } } /** * * @param string $sValue + * * @return multitype: string | string */ - protected static function _decodeValueArray($sValue) { + protected static function _decodeValueArray($sValue) + { $aValues = explode(',', $sValue); if (is_array($aValues) && count($aValues) > 1) { $aEntries = Array(); - foreach($aValues as $sEntry) { + foreach ($aValues as $sEntry) { $aEntries[] = urldecode($sEntry); } + return $aEntries; - } - else { + } else { return urldecode($sValue); } } diff --git a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Validate/Fingerprint.php b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Validate/Fingerprint.php index 068cf51..fd5a96b 100644 --- a/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Validate/Fingerprint.php +++ b/Frontend/WirecardCheckoutPage/Components/WirecardCEE/Stdlib/Validate/Fingerprint.php @@ -1,22 +1,44 @@ "Given fingerprint does not match calculated one.", - self::INVALID_LENGTH => "'%value%' has invalid length for hash algorithm %hash%.", - self::FINGERPRINTORDER_MISSING => 'Parameter fingerprintOrder is missing' + self::INVALID => "Given fingerprint does not match calculated one.", + self::INVALID_LENGTH => "'%value%' has invalid length for hash algorithm %hash%.", + self::FINGERPRINTORDER_MISSING => 'Parameter fingerprintOrder is missing' ); /** @@ -109,34 +131,35 @@ class WirecardCEE_Stdlib_Validate_Fingerprint extends Zend_Validate_Abstract { * @internal */ protected $_messageVariables = array( - 'hash' => 'hashAlgorithm' + 'hash' => 'hashAlgorithm' ); /** * Constructor * @param Array $options - optional */ - public function __construct($options = array()) { + public function __construct($options = array()) + { $this->fingerprintOrder = new WirecardCEE_Stdlib_FingerprintOrder(); - if($options instanceof WirecardCEE_Stdlib_Config) { + if ($options instanceof WirecardCEE_Stdlib_Config) { $options = $options->toArray(); } - if(!empty($options['fingerprintOrder'])) { + if (!empty($options['fingerprintOrder'])) { $this->setOrder($options['fingerprintOrder']); } - if(!empty($options['fingerprintOrderField'])) { + if (!empty($options['fingerprintOrderField'])) { $this->setFingerprintOrderField($options['fingerprintOrderField']); } - if(!empty($options['hashAlgorithm'])) { + if (!empty($options['hashAlgorithm'])) { $this->setHashAlgorithm($options['hashAlgorithm']); } - if(!empty($options['orderType'])) { + if (!empty($options['orderType'])) { $this->setOrderType($options['orderType']); } - if(!empty($options['secret'])) { + if (!empty($options['secret'])) { $this->setSecret($options['secret']); } } @@ -146,7 +169,8 @@ public function __construct($options = array()) { * @param string $sFingerprintOrderField * @return WirecardCEE_Stdlib_Validate_Fingerprint */ - public function setFingerprintOrderField($sFingerprintOrderField) { + public function setFingerprintOrderField($sFingerprintOrderField) + { $this->fingerprintOrderField = strtolower($sFingerprintOrderField); return $this; } @@ -156,8 +180,9 @@ public function setFingerprintOrderField($sFingerprintOrderField) { * @param string $orderType * @return WirecardCEE_Stdlib_Validate_FingerprintValidator */ - public function setOrderType($orderType) { - $this->fingerprintOrderType = (string) $orderType; + public function setOrderType($orderType) + { + $this->fingerprintOrderType = (string)$orderType; return $this; } @@ -166,7 +191,8 @@ public function setOrderType($orderType) { * @param string|array $order * @return WirecardCEE_Stdlib_Validate_FingerprintValidator */ - public function setOrder($order) { + public function setOrder($order) + { $this->fingerprintOrder->setOrder($order); return $this; } @@ -176,8 +202,9 @@ public function setOrder($order) { * @param string $hashAlgorithm * @return WirecardCEE_Stdlib_Validate_FingerprintValidator */ - public function setHashAlgorithm($hashAlgorithm) { - $this->hashAlgorithm = (string) $hashAlgorithm; + public function setHashAlgorithm($hashAlgorithm) + { + $this->hashAlgorithm = (string)$hashAlgorithm; WirecardCEE_Stdlib_Fingerprint::setHashAlgorithm($hashAlgorithm); return $this; } @@ -187,8 +214,9 @@ public function setHashAlgorithm($hashAlgorithm) { * @param string $secret * @return WirecardCEE_Stdlib_Validate_FingerprintValidator */ - public function setSecret($secret) { - $this->secret = (string) $secret; + public function setSecret($secret) + { + $this->secret = (string)$secret; return $this; } @@ -197,9 +225,10 @@ public function setSecret($secret) { * @param string $mandatoryField * @return WirecardCEE_Stdlib_Validate_FingerprintValidator */ - public function addMandatoryField($mandatoryField) { - if(!in_array((string) $mandatoryField, $this->_mandatoryFields)) { - $this->_mandatoryFields[] = (string) $mandatoryField; + public function addMandatoryField($mandatoryField) + { + if (!in_array((string)$mandatoryField, $this->_mandatoryFields)) { + $this->_mandatoryFields[] = (string)$mandatoryField; } return $this; } @@ -209,7 +238,8 @@ public function addMandatoryField($mandatoryField) { * @param array $mandatoryFields * @return WirecardCEE_Stdlib_Validate_FingerprintValidator */ - public function setMandatoryFields(Array $mandatoryFields) { + public function setMandatoryFields(Array $mandatoryFields) + { $this->_mandatoryFields = $mandatoryFields; return $this; } @@ -218,10 +248,12 @@ public function setMandatoryFields(Array $mandatoryFields) { * Is validator check valid? * @see Zend_Validate_Interface::isValid() */ - public function isValid($value, $context = null) { + public function isValid($value, $context = null) + { $context = array_change_key_case($context, CASE_LOWER); - switch($this->hashAlgorithm) { + switch ($this->hashAlgorithm) { + case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_HMAC_SHA512: case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_SHA512: $stringLength = 128; break; @@ -229,40 +261,41 @@ public function isValid($value, $context = null) { $stringLength = 32; break; default: - throw new WirecardCEE_Stdlib_Exception_UnexpectedValueException(sprintf("Used hash algorithm '%s' is not supported. MD5 or SHA512 are currently supported.", $this->hashAlgorithm)); + throw new WirecardCEE_Stdlib_Exception_UnexpectedValueException(sprintf("Used hash algorithm '%s' is not supported. MD5 or SHA512 are currently supported.", + $this->hashAlgorithm)); break; } - if(strlen($value) != $stringLength) { + if (strlen($value) != $stringLength) { return false; } - if($this->fingerprintOrderType == self::TYPE_FIXED) { + if ($this->fingerprintOrderType == self::TYPE_FIXED) { $fingerprintOrder = $this->fingerprintOrder; - } - else { - if(array_key_exists($this->fingerprintOrderField, $context)) { + } else { + if (array_key_exists($this->fingerprintOrderField, $context)) { $fingerprintOrder = new WirecardCEE_Stdlib_FingerprintOrder(strtolower($context[$this->fingerprintOrderField])); - } - else { + } else { $this->_error(self::FINGERPRINTORDER_MISSING); return false; } } $fingerprintOrder->setOrder(array_map('strtolower', $this->fingerprintOrder->__toArray())); + if (!in_array('secret', $fingerprintOrder->__toArray())) { + throw new WirecardCEE_Stdlib_Exception_UnexpectedValueException(); + } $fingerprintFields = Array(); - foreach($fingerprintOrder as $fingerprintFieldKey) { - if($fingerprintFieldKey == 'secret') { + foreach ($fingerprintOrder as $fingerprintFieldKey) { + if ($fingerprintFieldKey == 'secret') { $fingerprintFields[$fingerprintFieldKey] = $this->secret; - } - else { + } else { $fingerprintFields[$fingerprintFieldKey] = isset($context[$fingerprintFieldKey]) ? $context[$fingerprintFieldKey] : ''; } } - if(!WirecardCEE_Stdlib_Fingerprint::compare($fingerprintFields, $fingerprintOrder, $value)) { + if (!WirecardCEE_Stdlib_Fingerprint::compare($fingerprintFields, $fingerprintOrder, $value)) { $this->_error(self::INVALID); return false; } diff --git a/Frontend/WirecardCheckoutPage/Controllers/Frontend/WirecardCheckoutPage.php b/Frontend/WirecardCheckoutPage/Controllers/Frontend/WirecardCheckoutPage.php index 36d4bc8..7a34529 100644 --- a/Frontend/WirecardCheckoutPage/Controllers/Frontend/WirecardCheckoutPage.php +++ b/Frontend/WirecardCheckoutPage/Controllers/Frontend/WirecardCheckoutPage.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ use Shopware\Components\CSRFWhitelistAware; diff --git a/Frontend/WirecardCheckoutPage/Models/Basket.php b/Frontend/WirecardCheckoutPage/Models/Basket.php index bb81ee0..25aacc3 100644 --- a/Frontend/WirecardCheckoutPage/Models/Basket.php +++ b/Frontend/WirecardCheckoutPage/Models/Basket.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ /** diff --git a/Frontend/WirecardCheckoutPage/Models/Config.php b/Frontend/WirecardCheckoutPage/Models/Config.php index e33ae68..3591c01 100644 --- a/Frontend/WirecardCheckoutPage/Models/Config.php +++ b/Frontend/WirecardCheckoutPage/Models/Config.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ /** diff --git a/Frontend/WirecardCheckoutPage/Models/Log.php b/Frontend/WirecardCheckoutPage/Models/Log.php index 00c5d53..ee08159 100644 --- a/Frontend/WirecardCheckoutPage/Models/Log.php +++ b/Frontend/WirecardCheckoutPage/Models/Log.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ /** diff --git a/Frontend/WirecardCheckoutPage/Models/Page.php b/Frontend/WirecardCheckoutPage/Models/Page.php index a891cd6..d57e3c8 100644 --- a/Frontend/WirecardCheckoutPage/Models/Page.php +++ b/Frontend/WirecardCheckoutPage/Models/Page.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ /** @@ -71,6 +77,9 @@ protected function getFrontendClient(Shopware_Plugins_Frontend_WirecardCheckoutP public function initiatePayment($paymentType, $amount, $currency, $returnUrl, $confimUrl, $params = array()) { $oFrontendClient = $this->getFrontendClient(Shopware()->WirecardCheckoutPage()->getConfig()); + $email = (string) Shopware()->WirecardCheckoutPage()->getUser('user')->email; + $shippingProfile = 'NO_SHIPPING'; + $oFrontendClient->setPaymentType($paymentType) ->setAmount($amount) ->setCurrency($currency) @@ -80,7 +89,9 @@ public function initiatePayment($paymentType, $amount, $currency, $returnUrl, $c ->setPendingUrl($returnUrl) ->setConfirmUrl($confimUrl) ->setDisplayText($confimUrl) - ->setConsumerData($this->getConsumerData($paymentType)); + ->setConsumerData($this->getConsumerData($paymentType)) + ->createConsumerMerchantCrmId($email) + ->setShippingProfile($shippingProfile); if(Shopware()->WirecardCheckoutPage()->getConfig()->ENABLE_DUPLICATE_REQUEST_CHECK){ $oFrontendClient->setDuplicateRequestCheck(true); diff --git a/Frontend/WirecardCheckoutPage/Models/PaymentMethods.php b/Frontend/WirecardCheckoutPage/Models/PaymentMethods.php index 027b4c6..284c018 100644 --- a/Frontend/WirecardCheckoutPage/Models/PaymentMethods.php +++ b/Frontend/WirecardCheckoutPage/Models/PaymentMethods.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ /** @@ -37,7 +43,13 @@ class Shopware_Plugins_Frontend_WirecardCheckoutPage_Models_PaymentMethods 'call' => WirecardCEE_QPay_PaymentType::SELECT, 'translation' => Array( 'description' => 'Selection within wirecard checkout page', 'additionalDescription' => '') ), - + 'MASTERPASS' => array( + 'name' => 'masterpass', + 'description' => 'Wirecard Masterpass', + 'template' => '', + 'call' => WirecardCEE_QPay_PaymentType::MASTERPASS, + 'translation' => Array('description' => 'Wirecard Masterpass', 'additionalDescription' => '') + ), 'CCARD' => array( 'name' => 'ccard', 'description' => 'Wirecard Kreditkarte', @@ -53,7 +65,7 @@ class Shopware_Plugins_Frontend_WirecardCheckoutPage_Models_PaymentMethods 'call' => WirecardCEE_QPay_PaymentType::CCARD_MOTO, 'translation' => Array('description' => 'Wirecard Credit Card (backoffice)', 'additionalDescription' => '') ), - + 'EPS' => array( 'name' => 'eps', 'description' => 'Wirecard eps Online-Überweisung', @@ -222,7 +234,7 @@ class Shopware_Plugins_Frontend_WirecardCheckoutPage_Models_PaymentMethods 'template' => '', 'call' => WirecardCEE_QPay_PaymentType::VOUCHER, 'translation' => Array('description' => 'Wirecard Voucher', 'additionalDescription' => '') - ), + ) ); public function getList() diff --git a/Frontend/WirecardCheckoutPage/Models/Resources.php b/Frontend/WirecardCheckoutPage/Models/Resources.php index 6559e1d..9d02323 100644 --- a/Frontend/WirecardCheckoutPage/Models/Resources.php +++ b/Frontend/WirecardCheckoutPage/Models/Resources.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ /** diff --git a/Frontend/WirecardCheckoutPage/assets/lang/de.php b/Frontend/WirecardCheckoutPage/assets/lang/de.php index 9168c08..53decbd 100755 --- a/Frontend/WirecardCheckoutPage/assets/lang/de.php +++ b/Frontend/WirecardCheckoutPage/assets/lang/de.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ return array( diff --git a/Frontend/WirecardCheckoutPage/assets/lang/en.php b/Frontend/WirecardCheckoutPage/assets/lang/en.php index c16de82..648e8b9 100755 --- a/Frontend/WirecardCheckoutPage/assets/lang/en.php +++ b/Frontend/WirecardCheckoutPage/assets/lang/en.php @@ -3,25 +3,31 @@ * Shop System Plugins - Terms of Use * * The plugins offered are provided free of charge by Wirecard Central Eastern Europe GmbH - * (abbreviated to Wirecard CEE) and explicitly do not form part of the Wirecard CEE range - * of products and services. + * (abbreviated to Wirecard CEE) and are explicitly not part of the Wirecard CEE range of + * products and services. + * * They have been tested and approved for full functionality in the standard configuration * (status on delivery) of the corresponding shop system. They are under General Public - * License Version 2 (GPLv2) and can be used, developed and passed to third parties under + * License Version 2 (GPLv2) and can be used, developed and passed on to third parties under * the same terms. - * However, Wirecard CEE does not provide any guarantee or accept any liability for any - * errors occurring when used in an enhanced, customized shop system configuration. + * + * However, Wirecard CEE does not provide any guarantee or accept any liability for any errors + * occurring when used in an enhanced, customized shop system configuration. + * * Operation in an enhanced, customized configuration is at your own risk and requires a * comprehensive test phase by the user of the plugin. - * The customer uses the plugin at own risk. Wirecard CEE does not guarantee its full - * functionality neither does Wirecard CEE assume liability for any disadvantage related - * to the use of this plugin. Additionally Wirecard CEE does not guarantee its full - * functionality for customized shop systems or installed plugins of other vendors of - * plugins within the same shop system. - * The customer is responsible for testing the plugin's functionality within its own shop - * system before using it within a production environment of a shop system. - * By installing the plugin to the shop system the customer agrees to the terms of use. - * Please do not use these plugins if you do not agree to this terms of use! + * + * Customers use the plugins at their own risk. Wirecard CEE does not guarantee their full + * functionality neither does Wirecard CEE assume liability for any disadvantages related to + * the use of the plugins. Additionally, Wirecard CEE does not guarantee the full functionality + * for customized shop systems or installed plugins of other vendors of plugins within the same + * shop system. + * + * Customers are responsible for testing the plugin's functionality before starting productive + * operation. + * + * By installing the plugin into the shop system the customer agrees to these terms of use. + * Please do not use the plugin if you do not agree to these terms of use! */ return array(