Commit 581ce6a7 authored by Daniel Kazior's avatar Daniel Kazior
Browse files

Merge branch 'develop' into 'master'

Release 3.1.3

See merge request !16
parents 0ef8fb58 14278595
......@@ -3,7 +3,7 @@
"description": "CrefoPay Payment Solution for WooCommerce",
"require": {
"wp-user-manager/wp-optionskit": "1.0.15",
"crefopay/php-clientlibrary": "1.2.2",
"crefopay/php-clientlibrary": "1.2.4",
"psr/log": "1.1.3",
"monolog/monolog": "2.2.0"
}
......
......@@ -3,7 +3,7 @@
* Plugin Name: CrefoPay Payment Solution
* Plugin URI: https://repo.crefopay.de/crefopay/woocommerce
* Description: The complete solution for your eCommerce payments.
* Version: 3.1.2
* Version: 3.1.3
* Requires at least: 5.1
* Requires PHP: 7.2
* Author: Shakuras GbR
......@@ -122,7 +122,7 @@ define('PHONE_REGEX', '/^(((((((00|\+)[0-9]{2}[ \\\\\-\/]?)|0)[1-9][0-9]{1,4})[
* Main Class of the CrefoPay payment plugin
*
* @class CrefoPay_Payment_Solution
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution
*/
class Crefopay_Payment_Solution
......
......@@ -16,7 +16,7 @@ use Upg\Library\Request\Objects\Amount;
*
* @class WC_API_CrefoPay_Api_Callback
* @extends WC_API
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Callbacks
*/
class WC_API_CrefoPay_Api_Callback extends WC_API
......
......@@ -16,7 +16,7 @@ use Upg\Library\Mns\Handler;
*
* @class WC_API_Crefo_Notification_Callback
* @extends WC_API
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Callbacks
*/
class WC_API_Crefo_Notification_Callback extends WC_API
......
......@@ -12,7 +12,7 @@ require_once plugin_dir_path(__FILE__) . '../controllers/class-wc-crefopay.php';
* Process redirect payments
*
* @class WC_API_CrefoPay_Api_Callback
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Controllers
*/
class CrefoPay_API_Callback_Processor
......
......@@ -52,7 +52,7 @@ use Upg\Library\Validation\Validation;
*
* @class CrefoPay
* @autoloads Upg\Library
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Controllers
*/
class CrefoPay
......@@ -1029,8 +1029,7 @@ class CrefoPay
foreach ($cart->get_cart_contents() as $item) {
$basketItemAmount = new Amount();
$basketItemAmount
->setAmount(round($item['line_total'] * 100))
->setVatAmount(round($item['line_tax'] * 100));
->setAmount(round($item['line_total'] * 100));
$basketItem = new BasketItem();
$basketItem
......@@ -1060,8 +1059,7 @@ class CrefoPay
// Shipping costs
$basketItemAmount = new Amount();
$basketItemAmount
->setAmount(round($cart->get_shipping_total() * 100))
->setVatAmount(round($cart->get_shipping_tax() * 100));
->setAmount(round($cart->get_shipping_total() * 100));
$basketItem = new BasketItem();
$basketItem
......
......@@ -14,7 +14,7 @@ if ( class_exists( 'WC_GZD_Email_Customer_Paid_For_Order' ) ) :
* from the WooCommerce Germanized extension.
*
* @class CrefoPay_GZD_Email_Customer_Paid_For_Order
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Controllers
*/
class CrefoPay_GZD_Email_Customer_Paid_For_Order extends WC_GZD_Email_Customer_Paid_For_Order
......
......@@ -15,7 +15,7 @@ use Upg\Library\Mns\ProcessorInterface;
*
* @class CrefoPay_Notification_Callback_Processor
* @implements Upg\Library\Mns\ProcessorInterface
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Controllers
*/
class CrefoPay_Notification_Callback_Processor implements ProcessorInterface
......
......@@ -10,7 +10,7 @@ defined('ABSPATH') or die('No script kiddies please!');
* Process CrefoPay notifications.
*
* @class CrefoPay_Notification_Processor
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Controllers
*/
class CrefoPay_Notification_Processor
......@@ -167,11 +167,17 @@ class CrefoPay_Notification_Processor
case self::STATE_EXPIRED:
if ($this->options['crefopay_orderstate_expired'] != 'disabled') {
$newState = empty($this->options['crefopay_orderstate_expired']) ? ORDER_STATE_FAILED : $this->options['crefopay_orderstate_expired'];
$this->logger->debug("set new order status: " . $newState);
if ($order->set_status($newState, __('TRANSACTION_EXPIRED', 'crefopay-payment-solution'))) {
$this->logger->debug("successfully set new order state " . $newState);
if ($order->get_status() == 'pending') {
$this->logger->debug("set new order status: " . $newState);
if ($order->set_status($newState, __('TRANSACTION_EXPIRED', 'crefopay-payment-solution'))) {
$this->logger->debug("successfully set new order state " . $newState);
} else {
$this->logger->error("unable to set new order state " . $newState);
}
} else {
$this->logger->error("unable to set new order state " . $newState);
$this->logger->debug("skip updating order state because current state is already " . $order->get_status());
}
}
break;
......
......@@ -19,7 +19,7 @@ require_once plugin_dir_path(__FILE__) . '../models/class-wc-crefopay-error.php'
*
* @class WC_Crefo_Exception
* @extends WC_Data_Exception
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay Payment Solution
*/
class WC_Crefo_Exception extends WC_Data_Exception
......
......@@ -14,7 +14,7 @@ require_once plugin_dir_path(__FILE__) . '../controllers/class-wc-crefopay.php';
*
* @class WC_Crefo_Credit Card
* @extends WC_Crefo_Gateway
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay Payment Solution
*/
class WC_Crefo_CreditCard extends WC_Crefo_Gateway
......
......@@ -15,7 +15,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Debit
* @extends WC_Crefo_Gateway
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Gateways
*/
class WC_Crefo_Debit extends WC_Crefo_Gateway
......@@ -361,15 +361,6 @@ class WC_Crefo_Debit extends WC_Crefo_Gateway
$accountHolder = $_POST['cp-account-holder-debit'];
$iban = str_replace(' ', '', $_POST['cp-iban-debit']);
// Validate IBAN
$bankAccount = $this->calculateBic($iban);
if ($bankAccount['valid']) {
$bic = $bankAccount['bic'];
} else {
wc_add_notice(print_r($bankAccount['error'], true), 'error');
return false;
}
// Account holder empty
if (empty($accountHolder)) {
wc_add_notice(__('accountHolder.empty', 'crefopay-payment-solution'), 'error');
......@@ -385,45 +376,11 @@ class WC_Crefo_Debit extends WC_Crefo_Gateway
// All checks successfully done
$this
->_setAccountHolder($accountHolder)
->_setIban($iban)
->_setBic($bic);
->_setIban($iban);
return true;
}
/**
* Validate iban and calculates bic
*
* @param string $iban
* @return array
*/
private function calculateBic($iban)
{
$url = "https://openiban.com/validate/" . $iban . '?getBIC=true';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);
$result = json_decode(substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE)));
if ($result->valid) {
return array(
'valid' => $result->valid,
'iban' => $result->iban,
'bic' => $result->bankData->bic
);
} else {
return array(
'valid' => $result->valid,
'error' => $result->checkResults,
'message' => $result->messages
);
}
}
/**
* Set bank account holder
*
......@@ -438,20 +395,6 @@ class WC_Crefo_Debit extends WC_Crefo_Gateway
return $this;
}
/**
* Set bank account bic
*
* @param string $bic Bank account bic
*
* @return self
*/
protected function _setBic(string $bic)
{
$this->bic = str_replace(' ', '', $bic);
return $this;
}
/**
* Set bank account iban
*
......@@ -467,9 +410,9 @@ class WC_Crefo_Debit extends WC_Crefo_Gateway
}
/**
* Set bank account iban
* Set paymentInstrumentId
*
* @param string $iban Bank account iban
* @param string $paymentInstrumentId
*
* @return self
*/
......
......@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Invoice
* @extends WC_Crefo_Gateway
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Gateways
*/
class WC_Crefo_Invoice extends WC_Crefo_Gateway
......
......@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_PayPal
* @extends WC_Crefo_Gateway
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay Payment Solution
*/
class WC_Crefo_PayPal extends WC_Crefo_Gateway
......
......@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Prepaid
* @extends WC_Crefo_Gateway
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay Payment Solution
*/
class WC_Crefo_Prepaid extends WC_Crefo_Gateway
......
......@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Sofort
* @extends WC_Crefo_Gateway
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay Payment Solution
*/
class WC_Crefo_Sofort extends WC_Crefo_Gateway
......
......@@ -15,7 +15,7 @@ use Upg\Library\Request\Objects\PaymentInstrument;
*
* @class WC_Crefo_Gateway
* @extends WC_Payment_Gateway
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Gateways
*/
abstract class WC_Crefo_Gateway extends WC_Payment_Gateway
......
......@@ -10,7 +10,7 @@ defined('ABSPATH') or die('No script kiddies please!');
* Represents CrefoPay error details.
*
* @class WC_Crefo_Error
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Models
*/
class WC_Crefo_Error
......
......@@ -17,7 +17,7 @@ use Upg\Library\Request\Objects\SolvencyCheckInformation;
* Represents a CrefoPay Transaction.
*
* @class WC_Crefo_Transaction
* @version 3.1.2
* @version 3.1.3
* @package CrefoPay-Payment-Solution\Models
*/
class WC_Crefo_Transaction
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment