diff --git a/CHANGELOG.md b/CHANGELOG.md index 4055e9c..5c1e861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Release Notes - heidelpay Payment Gateway for WooCommerce +## 1.1.0 + +### Added + +#### New payment methods: + - iDeal + - PayPal + - Direct Debit + +#### Features: +- Credit Card and Debit Card: Added css file to customize the appearance of the iFrame. +- Credit Card, Debit Card and Paypal: Added setting to chose between bookingmodes debit (default) and authorize. +- Secured Invoice: added settings for minimum and maximum Amount to accept for payment. +- Secured Invoice: added settings to enable payment for Germany and Austria. +- Secured Invoice: added validation on checkout. + +### Changed + + ## 1.0.1 ### Fixed diff --git a/README.md b/README.md index c8f71a4..a532500 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ To use this extension please paste the contents of the folder "woocommerce"" int * credit card * debit card +* direct debit +* iDEAL +* Paypal * Sofort * secured invoice b2c diff --git a/assets/css/creditCardFrame.css b/assets/css/creditCardFrame.css new file mode 100644 index 0000000..9db644f --- /dev/null +++ b/assets/css/creditCardFrame.css @@ -0,0 +1,59 @@ +#paymentFrameForm { + background: #fff; +} + +.form-row { + margin: 0 0 1.5em; + padding: 0; + display: block; +} + +.form-label { + color: #333; + margin-bottom: 0.5em; + position: relative; + word-wrap: break-word; + line-height: 1.66; + font: 800 15px Arial; + +} + +.form-input, .form-select{ + border: 1px solid #bbb; + border-radius: 3px; + display: block; + width: 90%; + box-sizing: content-box; + padding: 0.7em; + font: 400 15px Arial; + color: #666; +} + +.form-select { + width: 75%; +} + +.verificationInlineHintWrapper { + width: 62%; +} + +.form-input fullWidth {} + +.form-select fullWidth {} + +.creditCardSymbols {} + +.creditCardImage {} + +.fillWidth {} + +.halfWidth{} + +#verificationInlineHint { + right: -15px; +} + + + + + diff --git a/includes/js/creditCardFrame.js b/assets/js/creditCardFrame.js similarity index 86% rename from includes/js/creditCardFrame.js rename to assets/js/creditCardFrame.js index cff5658..dd3798c 100644 --- a/includes/js/creditCardFrame.js +++ b/assets/js/creditCardFrame.js @@ -1,30 +1,27 @@ /** - * SUMMARY + * Payment card script * - * DESC + * Script to handle the communication with the iFrame in order to submit the form from outside the iFrame * * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. * @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. - * @link https://dev.heidelpay.de/JTL + * @link https://dev.heidelpay.de/woocommerce * @author David Owusu * @category WOOCOMMERCE */ -/*var paymentFrameForm; -var targetOrigin;*/ - - -/** - * Get hostname and protocol from paymentIframe - */ jQuery(function () { + /** + * Get the form element + */ paymentFrameForm = document.getElementById('paymentFrameForm'); if(paymentFrameForm != null) { - console.log(paymentFrameForm); - var paymentFrameIframe = document.getElementById('paymentFrameIframe'); + /** + * Add an event listener to from submit, which will execute the sendMessage function + */ if (paymentFrameForm.addEventListener) {// W3C DOM paymentFrameForm.addEventListener('submit', sendMessage); } @@ -35,21 +32,6 @@ jQuery(function () { } ) - - - -/** - * Get the form element - */ - - - - -/** - * Add an event listener to from submit, which will execute the sendMessage function - */ - - /** * Define send Message function * This function will collect each inpunt inside the form and then submit diff --git a/assets/js/securedInvoice.js b/assets/js/securedInvoice.js new file mode 100644 index 0000000..f0a744e --- /dev/null +++ b/assets/js/securedInvoice.js @@ -0,0 +1,24 @@ +/** + * SUMMARY + * + * DESC + * + * @license Use of this software requires acceptance of the License Agreement. See LICENSE file. + * @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. + * @author Florian Evertz + * @category WOOCOMMERCE + */ + +/** + * This function checks if the billing_company is empty + */ +jQuery(function () { + jQuery('#billing_company').change(function () { + if (jQuery('#billing_company').val() !== '') { + jQuery('li.payment_method_hp_ivpg').hide(); + } else { + jQuery('li.payment_method_hp_ivpg').show(); + } + ; + }); +}); \ No newline at end of file diff --git a/composer.json b/composer.json index 1452028..a44d2b6 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,9 @@ { "name": "Florian Evertz", "email": "florian.evertz@googlemail.com" + }, + { + "name": "David Owusu" } ] } diff --git a/includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php b/includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php new file mode 100644 index 0000000..060f76b --- /dev/null +++ b/includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php @@ -0,0 +1,180 @@ +bookingModes = array( + 'PA' => 'authorize', + 'DB' => 'debit' + ); + } + + public function process_payment($order_id) + { + return $this->toCheckoutPayment($order_id); + } + + /** + * Redirect to an extra Checkout page. + * @param $order_id + * @return array + */ + public function toCheckoutPayment($order_id) + { + $order = wc_get_order($order_id); + + $order->update_status('pending', __('Awaiting payment', 'woocommerce-heidelpay')); + return [ + 'result' => 'success', + 'redirect' => $order->get_checkout_payment_url(true) + ]; + } + + protected function performRequest($order_id) + { + $order = wc_get_order($order_id); + echo $this->getIFrame($order); + } + + /** + * Initialise Gateway Settings Form Fields. + */ + public function init_form_fields() + { + parent::init_form_fields(); + + $this->form_fields['security_sender']['default'] = '31HA07BC8142C5A171745D00AD63D182'; + $this->form_fields['user_login']['default'] = '31ha07bc8142c5a171744e5aef11ffd3'; + $this->form_fields['user_password']['default'] = '93167DE7'; + $this->form_fields['transaction_channel']['default'] = '31HA07BC8142C5A171744F3D6D155865'; + + $this->form_fields['description']['default'] = ''; + $this->form_fields['bookingmode'] = $this->getBookingSelection(); + } + + /** + * register scripts and stylesheets for your payment gateway + */ + public function enqueue_assets() + { + wp_register_script('heidelpay-iFrame', + WC_HEIDELPAY_PLUGIN_URL . '/assets/js/creditCardFrame.js', + [], + false, + true + ); + } + + /** + * @throws \Heidelpay\PhpPaymentApi\Exceptions\PaymentFormUrlException + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException + */ + public function after_pay() + { + $order_id = wc_get_order_id_by_order_key($_GET['key']); + $order = wc_get_order($order_id); + + if ($order->get_payment_method() === $this->id) { + $this->performRequest($order_id); + } + } + + /** + * Build the Iframe and return the String + * @param $order + * @throws \Heidelpay\PhpPaymentApi\Exceptions\PaymentFormUrlException + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException + * @return String + */ + protected function getIFrame( WC_Order $order) + { + // Load script for payment cards + wp_enqueue_script('heidelpay-iFrame'); + + $this->prepareRequest($order); + + // build host url and css path + $protocol = $_SERVER['HTTPS'] ? 'https' : 'http'; + $host = $protocol . '://' . $_SERVER['SERVER_NAME']; + $cssPath = WC_HEIDELPAY_PLUGIN_URL . '/assets/css/creditCardFrame.css'; + + $bookingAction = $this->getBookingAction(); + + if (method_exists($this->payMethod, $bookingAction)) { + $this->payMethod->$bookingAction( + $host, // PaymentFrameOrigin - uri of your application like https://dev.heidelpay.com + 'FALSE', + $cssPath + ); + + $iFrame = '
'; + if ($this->payMethod->getResponse()->isSuccess()) { + $iFrame .= '
'; + } else { + $iFrame .= get_home_url() . '/wp-content/plugins/woocommerce-heidelpay/vendor/'; + $iFrame .= '
' . print_r($this->getErrorMessage(), 1) . '
'; + } + $iFrame .= ''; + $iFrame .= '
'; + + return $iFrame; + } + + $this->addPaymentError($this->getErrorMessage()); + wc_print_notices(); + + wc_get_logger()->log( + WC_Log_Levels::ERROR, + htmlspecialchars( + print_r( + $this->plugin_id . ' - ' . $this->id . __( + ' Error: Paymentmethod was not found: ', 'woocommerce-heidelpay' + ) . $bookingAction, + 1 + ) + ) + ); + return null; + } + + public function getBookingAction() + { + if(!empty($this->bookingModes[$this->get_option('bookingmode')])) { + return $this->bookingModes[$this->get_option('bookingmode')]; + } + return $this->bookingAction; + } +} diff --git a/includes/abstracts/abstract-wc-heidelpay-payment-gateway.php b/includes/abstracts/abstract-wc-heidelpay-payment-gateway.php index a4488ff..9b9a934 100644 --- a/includes/abstracts/abstract-wc-heidelpay-payment-gateway.php +++ b/includes/abstracts/abstract-wc-heidelpay-payment-gateway.php @@ -1,19 +1,43 @@ has_fields = false; + $this->bookingAction = 'debit'; + $this->messageMapper = new MessageCodeMapper(get_locale()); $this->setPayMethod(); $this->method_title = sprintf(__('%s', 'woocommerce-heidelpay'), strtoupper($this->id)); @@ -27,18 +51,45 @@ public function __construct() $this->title = $this->get_option('title'); $this->description = $this->get_option('description'); $this->instructions = $this->get_option('instructions'); - + // Actions add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); add_action('woocommerce_api_' . strtolower(get_class($this)), array($this, 'callback_handler')); - add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); + add_action('wp_enqueue_scripts', array($this, 'enqueue_assets')); + add_action('woocommerce_after_checkout_validation', array($this, 'checkoutValidation')); + + // Filter + add_filter('woocommerce_available_payment_gateways', array($this, 'setAvailability')); } /** - * Set the id and PaymenMethod + * Set the id and PaymentMethod */ abstract protected function setPayMethod(); + /** + * Validate the customer input coming from checkout. + * @return boolean + */ + public function checkoutValidation() + { + //return true; + } + + /** + * Check whether this paymethod was selected based on + * @return bool + */ + public function isGatewayActive() + { + if(!empty($_POST['payment_method'])) { + if($_POST['payment_method'] === $this->id) + return true; + } + + return false; + } + public function init_form_fields() { $this->form_fields = array( @@ -46,14 +97,14 @@ public function init_form_fields() 'title' => __('Enable/Disable', 'woocommerce-heidelpay'), 'type' => 'checkbox', 'label' => sprintf(__('Enable %s', 'woocommerce-heidelpay'), $this->name), - 'default' => 'yes', + 'default' => 'no', ), 'title' => array( 'title' => __('Title', 'woocommerce-heidelpay'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-heidelpay'), - 'default' => sprintf(__('%s', 'woocommerce-heidelpay'), $this->name), + 'default' => $this->name, 'desc_tip' => true, ), 'description' => array( @@ -73,7 +124,7 @@ public function init_form_fields() 'Instructions that will be added to the thank you page and emails.', 'woocommerce-heidelpay' ), - 'default' => __('The following acount will be billed:', 'woocommerce-heidelpay'), + 'default' => __('The following account will be billed:', 'woocommerce-heidelpay'), 'desc_tip' => true, ), 'security_sender' => array( @@ -122,28 +173,39 @@ public function init_form_fields() ); } - public function enqueue_scripts() + /** + * register scripts and stylesheets for your payment gateway + */ + public function enqueue_assets() { - wp_register_script('heidelpay-iFrame', - WC_HEIDELPAY_PLUGIN_URL . '/includes/js/creditCardFrame.js', + wp_register_script('heidelpay-secured', + WC_HEIDELPAY_PLUGIN_URL . '/assets/js/securedInvoice.js', [], false, true ); - wp_enqueue_script('heidelpay-iFrame'); + wp_enqueue_script('heidelpay-secured'); } public function process_payment($order_id) { $order = wc_get_order($order_id); + $this->prepareRequest($order); + + return $this->performRequest($order_id); + } + /** + * @param $order WC_Order + */ + public function prepareRequest(WC_Order $order) + { $this->setAuthentification(); $this->setAsync(); $this->setCustomer($order); - $this->setBasket($order_id); - - return $this->performRequest($order_id); + $this->setBasket($order->get_id()); + $this->setCriterions(); } /** @@ -183,7 +245,7 @@ public function getLanguage() return 'en'; } - protected function setCustomer($order) + protected function setCustomer(WC_Order $order) { $this->payMethod->getRequest()->customerAddress( $order->get_billing_first_name(), // Given name @@ -211,10 +273,117 @@ protected function setBasket($order_id) } /** - * Send payment request + * @global string $wp_version + */ + protected function setCriterions() + { + global $wp_version; + + $shopType = 'WordPress: ' . $wp_version . ' - ' . 'WooCommerce: ' . wc()->version; + $this->payMethod->getRequest()->getCriterion()->set('PUSH_URL', 'push-url for testing'); //TODO insert URL + $this->payMethod->getRequest()->getCriterion()->set('SHOP.TYPE', $shopType); + $this->payMethod->getRequest()->getCriterion()->set( + 'SHOPMODULE.VERSION', + 'heidelpay gateway ' . WC_HEIDELPAY_VERSION + ); + } + + /** + * Send payment request. + * Validation happens before this in the checkoutValidation() function. * @return mixed */ - abstract protected function performRequest($order_id); + protected function performRequest($order_id) + { + if (!empty($_POST)) { + $this->handleFormPost($_POST); + } + + if (!empty($this->bookingAction) AND method_exists($this->payMethod, $this->bookingAction)) { + $action = $this->getbookingAction(); + try { + $this->payMethod->$action(); + } catch (Exception $e) { + wc_get_logger()->log(WC_Log_Levels::DEBUG, htmlspecialchars(print_r($e->getMessage(), 1))); + + $this->addPaymentError($this->getErrorMessage()); + + return null; + } + + if ($this->payMethod->getResponse()->isSuccess()) { + return [ + 'result' => 'success', + 'redirect' => $this->payMethod->getResponse()->getPaymentFormUrl(), + ]; + } + + $this->addPaymentError($this->getErrorMessage()); + } else { + $this->addPaymentError($this->getErrorMessage()); + + wc_get_logger()->log( + WC_Log_Levels::ERROR, + htmlspecialchars( + print_r( + $this->plugin_id . ' - ' . $this->id . __(' Error: Paymentmethod was not found: ', 'woocommerce-heidelpay') . $this->bookingAction, + 1 + ) + ) + ); + + return null; + } + } + + /** + * @return string + */ + public function getBookingAction() + { + return $this->bookingAction; + } + + /** + * @param String $message + */ + public function addPaymentError(String $message) + { + wc_add_notice( + __('Payment error: ', 'woocommerce-heidelpay') . htmlspecialchars($message), + 'error' + ); + } + + /** + * process the Form input from customer comimg from checkout. + */ + protected function handleFormPost() + { + } + + /** + * Get the mapped Errormessage from Respone wich is html escaped. + * If a response is given as a parameter that will determine the message. Otherwise the Response from the payMethod + * is used. If none of them is given return the default message + * @param Response|null $response + * @return string + */ + protected function getErrorMessage(Response $response = null) + { + if ($response !== null AND $this->payMethod->getResponse() !== null) { + if (!empty($response['code'])) { + return htmlspecialchars($this->messageMapper->getMessage($response->getError()['code'])); + } + if (!empty($this->payMethod->getResponse()->getError()['code'])) { + return htmlspecialchars( + $this->messageMapper->getMessage($this->payMethod->getResponse()->getError()['code']) + ); + } + } + + return $this->messageMapper->getDefaultMessage(); + } public function admin_options() { @@ -226,6 +395,10 @@ public function admin_options() echo ''; } + /** + * Action for woocommerce_api. + * Handle the Response coming from payment system and return redirect url. + */ public function callback_handler() { $response = new WC_Heidelpay_Response(); @@ -234,4 +407,33 @@ public function callback_handler() } exit(); } + + /** + * Filter function for the hook: woocommerce_available_payment_gateways + * Can be used to set conditions vor availability of a paymethod. + * @param $available_gateways + * @return mixed + */ + public function setAvailability($available_gateways) + { + return $available_gateways; + } + + /** + * @return array Containing the optionfield to select booking mode in the admin menue. + */ + protected function getBookingSelection() + { + return array( + 'title' => __('Bookingmode', 'woocommerce-heidelpay'), + 'type' => 'select', + 'options' => array( + 'DB' => __('Debit', 'woocommerce-heidelpay'), + 'PA' => __('Authorization', 'woocommerce-heidelpay') + ), + 'id' => $this->id . '_bookingmode', + 'label' => __('Choose a bookingmode', 'woocommerce-heidelpay'), + 'default' => 'DB' + ); + } } diff --git a/includes/class-wc-heidelpay-response.php b/includes/class-wc-heidelpay-response.php index 518764f..bdffd7a 100644 --- a/includes/class-wc-heidelpay-response.php +++ b/includes/class-wc-heidelpay-response.php @@ -1,12 +1,23 @@ log(WC_Log_Levels::NOTICE, print_r("Heidelpay - " . - $callers [0] ['function'] . ": Invalid response hash from ". + $callers [0] ['function'] . ": Invalid response hash from " . $_SERVER ['REMOTE_ADDR'] . ", suspecting manipulation", 1)); exit(); //error } $orderId = self::$response->getIdentification()->getTransactionId(); + $order = wc_get_order($orderId); + - $this->handleResult($post_data, $orderId); + $this->handleResult($post_data, $order); //TODO: if case for distinction between result and push } - /* + /** * handle result post */ - public function handleResult($post_data, $orderId) + public function handleResult($post_data, WC_Order $order) { - - $uid = self::$response->getIdentification()->getUniqueId();; - - $order = wc_get_order($orderId); + $uid = self::$response->getIdentification()->getUniqueId(); if (self::$response->isSuccess()) { $payCode = explode('.', $post_data ['PAYMENT_CODE']); - - if (strtoupper($payCode [0]) != 'PP' AND strtoupper($payCode [0]) != 'IV') { - - //let wc take care of it + $note = ''; + + // If no money has been payed yet. + if (strtoupper($payCode[1]) === 'PA' or strtoupper($payCode[1]) === 'RG') { + // In not Prepayment and Invoice payment can be captured manually + if (strtoupper($payCode [0]) !== 'PP' and strtoupper($payCode [0]) !== 'IV') { + $note = __( + 'Payment reservation successful. Please use the hiP to check the payment.', + 'woocommerce-heidelpay.' + ); + $order->add_order_note($note, false); + } + + $order->update_status('on-hold', __('Awaiting payment.', 'woocommerce-heidelpay') + . ' ' . $note) . ' '; + } else { $order->payment_complete(); + } - //show thank you page - echo $order->get_checkout_order_received_url(); + echo $order->get_checkout_order_received_url(); - } else { - echo $order->get_checkout_order_received_url(); - } /* redirect customer to success page */ } elseif (self::$response->isError()) { $error = self::$response->getError(); + $order->update_status('failed'); - echo apply_filters( 'woocommerce_get_cancel_order_url_raw', add_query_arg( array( + echo apply_filters('woocommerce_get_cancel_order_url_raw', add_query_arg(array( 'cancel_order' => 'true', - 'order' => $order->get_order_key(), - 'order_id' => $order->get_id(), - '_wpnonce' => wp_create_nonce( 'woocommerce-cancel_order' ), - 'errorCode' => $error['code'], - ), $order->get_cancel_endpoint() ) ); + 'order' => $order->get_order_key(), + 'order_id' => $order->get_id(), + '_wpnonce' => wp_create_nonce('woocommerce-cancel_order'), + 'errorCode' => $error['code'], + ), $order->get_cancel_endpoint())); } elseif (self::$response->isPending()) { - //update status to on hold - $order->update_status('on-hold', __('Awaiting payment', 'woocommerce-heidelpay')); - //empty cart wc()->cart->empty_cart(); diff --git a/includes/gateways/class-wc-heidelpay-gateway-cc.php b/includes/gateways/class-wc-heidelpay-gateway-cc.php index 264b3bb..dd91884 100644 --- a/includes/gateways/class-wc-heidelpay-gateway-cc.php +++ b/includes/gateways/class-wc-heidelpay-gateway-cc.php @@ -1,135 +1,35 @@ performRequest($order_id); - } - - protected function performRequest($order_id) - { - $order = wc_get_order($order_id); - - $order->update_status('pending', __('Awaiting payment', 'woocommerce-heidelpay')); - return [ - 'result' => 'success', - 'redirect' => $order->get_checkout_payment_url(true) - ]; - } - public function setPayMethod() { $this->payMethod = new CreditCardPaymentMethod(); $this->id = 'hp_cc'; $this->name = __('Credit Card', 'woocommerce-heidelpay'); } - - /** - * Initialise Gateway Settings Form Fields. - */ - public function init_form_fields() - { - - parent::init_form_fields(); - - $this->form_fields['security_sender']['default'] = '31HA07BC8142C5A171745D00AD63D182'; - $this->form_fields['user_login']['default'] = '31ha07bc8142c5a171744e5aef11ffd3'; - $this->form_fields['user_password']['default'] = '93167DE7'; - $this->form_fields['transaction_channel']['default'] = '31HA07BC8142C5A171744F3D6D155865'; - } - - public function payment_fields() - { - } - - public function after_pay() - { - $order_id = wc_get_order_id_by_order_key($_GET['key']); - $order = wc_get_order($order_id); - - if ($order->get_payment_method() === $this->id) { - $this->getIFrame($order_id, $order); - } - } - - protected function getIFrame($order_id, $order) - { - wp_enqueue_script('heidelpay-iFrame'); - - $this->setAuthentification(); - $this->setAsync(); - $this->setCustomer($order); - $this->setBasket($order_id); - - $protocol = $_SERVER['HTTPS'] ? 'https' : 'http'; - - $this->payMethod->debit( - $protocol . '://' . $_SERVER['SERVER_NAME'], // PaymentFrameOrigin - uri of your application like https://dev.heidelpay.com - 'FALSE' - ); - - echo '
'; - if ($this->payMethod->getResponse()->isSuccess()) { - echo '
'; - } else { - echo get_home_url() . '/wp-content/plugins/woocommerce-heidelpay/vendor/'; - echo '
' . print_r($this->payMethod->getResponse()->getError(), 1) . '
'; - } - echo ''; - echo '
'; - } - - /** - * Output for the order received page. - * - * @param int $order_id - */ - public function thankyou_page($order_id) - { - - if ($this->instructions) { - echo wpautop(wptexturize(wp_kses_post($this->instructions))); - } - $this->bank_details($order_id); - } - - /** - * Add content to the WC emails. - */ - public function email_instructions($order, $sent_to_admin, $plain_text = false) - { - - if (!$sent_to_admin && 'hp_cc' === $order->get_payment_method() && $order->has_status('on-hold')) { - if ($this->instructions) { - echo wpautop(wptexturize($this->instructions)) . PHP_EOL; - } - $this->bank_details($order->get_id()); - } - } } diff --git a/includes/gateways/class-wc-heidelpay-gateway-dc.php b/includes/gateways/class-wc-heidelpay-gateway-dc.php index af90212..dc8dec9 100644 --- a/includes/gateways/class-wc-heidelpay-gateway-dc.php +++ b/includes/gateways/class-wc-heidelpay-gateway-dc.php @@ -1,31 +1,30 @@ performRequest($order_id); - } +class WC_Gateway_HP_DC extends WC_Heidelpay_IFrame_Gateway { public function setPayMethod() { @@ -33,96 +32,4 @@ public function setPayMethod() $this->id = 'hp_dc'; $this->name = __('Debit Card', 'woocommerce-heidelpay'); } - - /** - * Initialise Gateway Settings Form Fields. - */ - public function init_form_fields() { - - parent::init_form_fields(); - - $this->form_fields['security_sender']['default'] = '31HA07BC8142C5A171745D00AD63D182'; - $this->form_fields['user_login']['default'] = '31ha07bc8142c5a171744e5aef11ffd3'; - $this->form_fields['user_password']['default'] = '93167DE7'; - $this->form_fields['transaction_channel']['default'] = '31HA07BC8142C5A171744F3D6D155865'; - } - - public function payment_fields() - { - } - - public function after_pay() { - $order_id = wc_get_order_id_by_order_key($_GET['key']); - $order = wc_get_order($order_id); - - if ($order->get_payment_method() === $this->id) { - $this->getIFrame($order_id, $order); - } - } - - protected function getIFrame($order_id, $order) { - wp_enqueue_script('heidelpay-iFrame'); - - $this->setAuthentification(); - $this->setAsync(); - $this->setCustomer($order); - $this->setBasket($order_id); - $this->setBasket($order_id); - - $protokoll = $protokoll = $_SERVER['HTTPS']?'https':'http'; - - $this->payMethod->debit( - $protokoll.'://'.$_SERVER['SERVER_NAME'], // PaymentFrameOrigin - uri of your application like https://dev.heidelpay.com - 'FALSE' - ); - - echo '
'; - if ($this->payMethod->getResponse()->isSuccess()) { - echo '
'; - } else { - echo get_home_url() . '/wp-content/plugins/woocommerce-heidelpay/vendor/'; - echo '
' . print_r($this->payMethod->getResponse()->getError(), 1) . '
'; - } - echo ''; - echo '
'; - } - - /** - * Output for the order received page. - * - * @param int $order_id - */ - public function thankyou_page($order_id) { - - if ($this->instructions) { - echo wpautop(wptexturize(wp_kses_post($this->instructions))); - } - $this->bank_details($order_id); - } - - /** - * Add content to the WC emails. - */ - public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { - - if ( ! $sent_to_admin && 'hp_dc' === $order->get_payment_method() && $order->has_status( 'on-hold' ) ) { - if ( $this->instructions ) { - echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL; - } - $this->bank_details( $order->get_id() ); - } - } - - protected function performRequest($order_id) { - - $order = wc_get_order($order_id); - - $order->update_status( 'pending', __( 'Awaiting payment', 'woocommerce-heidelpay' ) ); - return [ - 'result' => 'success', - 'redirect' => $order->get_checkout_payment_url(true) - ]; - } } diff --git a/includes/gateways/class-wc-heidelpay-gateway-dd.php b/includes/gateways/class-wc-heidelpay-gateway-dd.php new file mode 100644 index 0000000..1852199 --- /dev/null +++ b/includes/gateways/class-wc-heidelpay-gateway-dd.php @@ -0,0 +1,119 @@ +isGatewayActive() === false) { + return true; + } + + if (empty($_POST['accountholder'])) { + wc_add_notice( + __('You have to enter the account holder', 'woocommerce-heidelpay'), + 'error' + ); + } + + if (empty($_POST['accountiban'])) { + wc_add_notice( + __('You have to enter the IBAN', 'woocommerce-heidelpay'), + 'error' + ); + } + } + + /** + * Initialise Gateway Settings Form Fields. + */ + public function init_form_fields() + { + parent::init_form_fields(); + + $this->form_fields['title']['default'] = sprintf(__('%s', 'woocommerce-heidelpay'), $this->name); + $this->form_fields['description']['default'] = sprintf(__('Insert payment data for %s', 'woocommerce-heidelpay'), $this->name); + $this->form_fields['enabled']['label'] = sprintf(__('Enable %s', 'woocommerce-heidelpay'), $this->name); + $this->form_fields['security_sender']['default'] = '31HA07BC8142C5A171745D00AD63D182'; + $this->form_fields['user_login']['default'] = '31ha07bc8142c5a171744e5aef11ffd3'; + $this->form_fields['user_password']['default'] = '93167DE7'; + $this->form_fields['transaction_channel']['default'] = '31HA07BC8142C5A171744F3D6D155865'; + } + + public function payment_fields() + { + $accountHolderLabel = __('Account Holder', 'woocommerce-heidelpay'); + $accountIbanLabel = __('IBAN', 'woocommerce-heidelpay'); + + $accountHolder = wc()->customer->get_billing_first_name(). ' ' . wc()->customer->get_last_name(); + + echo '
'; + + echo ''; + echo ' '; + echo '
'; + + echo ''; + echo ' '; + + echo '
'; + } + + //payment form + /** + * Set the id and PaymenMethod + */ + protected function setPayMethod() + { + $this->payMethod = new DirectDebitPaymentMethod(); + $this->id = 'hp_dd'; + $this->has_fields = true; + $this->name = __('Direct Debit', 'woocommerce-heidelpay'); + } + + /** + * @return false Returns false if the handling failed + */ + protected function handleFormPost() + { + parent::handleFormPost(); + + if (!empty($_POST['accountholder']) AND !empty($_POST['accountiban'])) { + $this->payMethod->getRequest()->getAccount()->setHolder(htmlspecialchars($_POST['accountholder'])); + $this->payMethod->getRequest()->getAccount()->setIban(htmlspecialchars($_POST['accountiban'])); + } + } +} \ No newline at end of file diff --git a/includes/gateways/class-wc-heidelpay-gateway-idl.php b/includes/gateways/class-wc-heidelpay-gateway-idl.php new file mode 100644 index 0000000..d5e2898 --- /dev/null +++ b/includes/gateways/class-wc-heidelpay-gateway-idl.php @@ -0,0 +1,148 @@ +payMethod = new IDealPaymentMethod(); + $this->id = 'hp_idl'; + $this->name = __('iDeal', 'woocommerce-heidelpay'); + $this->has_fields = true; + $this->bookingAction = 'authorize'; + } + + /** + * Initialise Gateway Settings Form Fields. + */ + public function init_form_fields() + { + parent::init_form_fields(); + + $this->form_fields['security_sender']['default'] = '31HA07BC8142C5A171745D00AD63D182'; + $this->form_fields['user_login']['default'] = '31ha07bc8142c5a171744e5aef11ffd3'; + $this->form_fields['user_password']['default'] = '93167DE7'; + $this->form_fields['transaction_channel']['default'] = '31HA07BC8142C5A171744B56E61281E5'; + } + + /** + * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException + */ + public function payment_fields() + { + // declare text + $accountHolderLabel = __('Account Holder', 'woocommerce-heidelpay'); + $bankNameLabel = __('Bank', 'woocommerce-heidelpay'); + + // Performe Authorize request to get paymethod config + $this->setAuthentification(); + $this->setAsync(); + $this->setCriterions(); + + $this->payMethod->authorize(); + + $brands = (array) $this->payMethod->getResponse()->getConfig()->getBrands(); + + $accountHolder = wc()->customer->get_billing_first_name(). ' ' . wc()->customer->get_last_name(); + + if(!empty($brands)) { + echo '
'; + echo ''; + echo ' '; + echo '
'; + echo ''; + echo ''; + echo '
'; + } else { + wc_print_notice($this->getErrorMessage(), 'error'); + } + + } + + /** + * @return false Returns false if the handling failed + */ + protected function handleFormPost() + { + parent::handleFormPost(); + + if (!empty($_POST['bankname'])) { + $this->payMethod->getRequest()->getAccount()->setBankName(htmlspecialchars($_POST['bankname'])); + } + } + + + public function checkoutValidation() + { + $isValid = parent::checkoutValidation(); + + // If gateway is not active no validation is necessary. + if($this->isGatewayActive() === false) { + return true; + } + + if(empty($_POST['bankname'])) { + wc_add_notice( + __('Payment error: ', 'woocommerce-heidelpay') . __('Chose a bank please.', 'woocommerce-heidelpay'), + 'error' + ); + $isValid = false; + } + + return $isValid; + } + + public function setAvailability($available_gateways) + { + $available = true; + + if (wc()->customer->get_billing_country() !== 'NL') { + $available = false; + } + + if (!$available) { + unset($available_gateways[$this->id]); + } + + return $available_gateways; + } + +} diff --git a/includes/gateways/class-wc-heidelpay-gateway-ivpg.php b/includes/gateways/class-wc-heidelpay-gateway-ivpg.php index 2c66032..dc9a797 100644 --- a/includes/gateways/class-wc-heidelpay-gateway-ivpg.php +++ b/includes/gateways/class-wc-heidelpay-gateway-ivpg.php @@ -1,12 +1,24 @@ isGatewayActive() === false) { + return true; + } + + if (!$this->is18($_POST['birthdate']) || empty($_POST['birthdate'])) { + wc_add_notice( + __('You have to be at least 18 years old in order to use secured invoice', 'woocommerce-heidelpay'), + 'error' + ); + } + if (empty($_POST['salutation'])) { + wc_add_notice( + __('You have to enter your salutation', 'woocommerce-heidelpay'), + 'error' + ); + } + + if (!empty(wc()->customer->get_billing_company())) { + wc_add_notice( + __('You are not allowed to use secured invoice with a company name', 'woocommerce-heidelpay'), + 'error' + ); + } + + } + + private function is18($given) + { + $given = strtotime($given); + $min = strtotime('+18 years', $given); + if (time() < $min) { + return false; + } + return true; + } + /** * Initialise Gateway Settings Form Fields. */ @@ -38,6 +89,111 @@ public function init_form_fields() $this->form_fields['user_login']['default'] = '31ha07bc8142c5a171744e5aef11ffd3'; $this->form_fields['user_password']['default'] = '93167DE7'; $this->form_fields['transaction_channel']['default'] = '31HA07BC81856CAD6D8E05CDDE7E2AC8'; + + $this->form_fields['advanced'] = array( + 'title' => __('Advanced options', 'woocommerce-heidelpay'), + 'type' => 'title', + 'description' => '' + ); + + $this->form_fields['min'] = array( + 'title' => __('Minimum Amount', 'woocommerce-heidelpay'), + 'type' => 'text', + 'default' => 100, + 'desc_tip' => true, + ); + + $this->form_fields['max'] = array( + 'title' => __('Maxmimum Amount', 'woocommerce-heidelpay'), + 'type' => 'text', + 'default' => 1000, + 'desc_tip' => true, + ); + + $this->form_fields['availableCountries'] = array( + 'title' => __('Available Countries for secured invoice', 'woocommerce-heidelpay'), + 'type' => 'title', + 'description' => __('Here you can enable secured Invoice for specific countries. Be aware that this will not enable the country in your WooCommerce settings and you have to enable them seperately.', 'woocommerce-heidelpay') + ); + + $this->form_fields['availableDE'] = array( + 'title' => __('Enable Germany', 'woocommerce-heidelpay'), + 'type' => 'checkbox', + 'default' => 'yes', + ); + + $this->form_fields['availableAT'] = array( + 'title' => __('Enable Austria', 'woocommerce-heidelpay'), + 'type' => 'checkbox', + 'default' => 'no', + ); + + //Switzerland not working yet + /* + $this->form_fields['availableCH'] = array( + 'title' => __('Enable Switzerland', 'woocommerce-heidelpay'), + 'type' => 'checkbox', + 'default' => 'no', + ); + */ + } + + /** + * @param $available_gateways + * @return mixed + */ + public function setAvailability($available_gateways) + { + $security = true; + + if (!empty(wc()->customer->get_billing_company())) { + $security = false; + } + + if (!in_array(wc()->customer->get_billing_country(), $this->getEnabledCountries(), true)) { + $security = false; + } + + if (wc()->customer->get_billing_address_1() !== wc()->customer->get_shipping_address_1() || + wc()->customer->get_billing_address_2() !== wc()->customer->get_shipping_address_2() || + wc()->customer->get_billing_city() !== wc()->customer->get_shipping_city() || + wc()->customer->get_billing_postcode() !== wc()->customer->get_shipping_postcode() + ) { + $security = false; + } + + if (wc()->cart->get_totals()['total'] > $this->get_option('max') || + wc()->cart->get_totals()['total'] < $this->get_option('min')) { + $security = false; + } + + if (!$security) { + unset($available_gateways[$this->id]); + } + return $available_gateways; + } + + /** + * This function checks which countries are enabled for secured invoice + * and returns an array containing these country short codes + * + * @return array + */ + private function getEnabledCountries() + { + $availableCountries = array(); + + if ($this->get_option('availableDE') === 'yes') { + $availableCountries[] = 'DE'; + } + if ($this->get_option('availableAT') === 'yes') { + $availableCountries[] = 'AT'; + } + if ($this->get_option('availableCH') === 'yes') { + $availableCountries[] = 'CH'; + } + + return $availableCountries; } public function payment_fields() @@ -50,18 +206,49 @@ public function payment_fields() echo '
'; echo - '' . - '' . '' . '' . '' . '' . '
' . - '' . - '' . + '' . + '' . '
'; echo '
'; + echo ''; + } + + public function ErrorHtml() + { + $errorText = __('You have to be at least 18 years old in order to use secured invoice', 'woocommerce-heidelpay'); + return ''; } public function email_instructions($order, $sent_to_admin, $plain_text = false) @@ -80,41 +267,15 @@ protected function setPayMethod() $this->id = 'hp_ivpg'; $this->name = __('Secured Invoice', 'woocommerce-heidelpay'); $this->has_fields = true; + $this->bookingAction = 'authorize'; } - /** - * Send payment request - * @return mixed - */ - protected function performRequest($order_id) + protected function handleFormPost() { - $this->payMethod->getRequest()->b2cSecured($_POST['salutation'], $_POST['birthdate']); - - /** - * Set necessary parameters for Heidelpay payment Frame and send a registration request - */ - try { - $this->payMethod->authorize(); - } catch (Exception $e) { - wc_get_logger()->log(WC_Log_Levels::DEBUG, print_r($e->getMessage(), 1)); - // TODO: redirect to errorpage - wc_add_notice( - __('Payment error: ', 'woocommerce-heidelpay') . $this->payMethod->getResponse()->getError()['message'], - 'error' - ); - return null; - } + parent::handleFormPost(); - if ($this->payMethod->getResponse()->isSuccess()) { - return [ - 'result' => 'success', - 'redirect' => $this->payMethod->getResponse()->getPaymentFormUrl(), - ]; + if (!empty($_POST['salutation']) AND !empty($_POST['birthdate'])) { + $this->payMethod->getRequest()->b2cSecured($_POST['salutation'], $_POST['birthdate']); } - wc_add_notice( - __('Payment error: ' . $this->payMethod->getResponse()->getError()['message'], 'woocommerce-heidelpay'), - 'error' - ); - return null; } } diff --git a/includes/gateways/class-wc-heidelpay-gateway-so.php b/includes/gateways/class-wc-heidelpay-gateway-so.php index f19f868..a5f106a 100644 --- a/includes/gateways/class-wc-heidelpay-gateway-so.php +++ b/includes/gateways/class-wc-heidelpay-gateway-so.php @@ -1,13 +1,26 @@ payMethod = new SofortPaymentMethod(); $this->id = 'hp_so'; $this->name = 'Sofort'; + $this->bookingAction = 'authorize'; } /** @@ -36,31 +50,4 @@ public function init_form_fields() $this->form_fields['user_password']['default'] = '93167DE7'; $this->form_fields['transaction_channel']['default'] = '31HA07BC8142C5A171749CDAA43365D2'; } - - public function payment_fields() - { - } - - protected function performRequest($order_id) - { - try { - $this->payMethod->authorize(); - } catch (\Exception $exception) { - wc_get_logger()->logger->log(WC_Log_Levels::DEBUG, print_r('Paymethod not found', 1)); - } - - if ($this->payMethod->getResponse()->isSuccess()) { - return [ - 'result' => 'success', - 'redirect' => $this->payMethod->getResponse()->getPaymentFormUrl() - ]; - } - - wc_add_notice( - __('Payment error: ', 'woocommerce-heidelpay') . $this->payMethod->getResponse()->getError()['message'], - 'error' - ); - - return null; - } } diff --git a/includes/gateways/class-wc-heidelpay-gateway-va.php b/includes/gateways/class-wc-heidelpay-gateway-va.php new file mode 100644 index 0000000..925d92f --- /dev/null +++ b/includes/gateways/class-wc-heidelpay-gateway-va.php @@ -0,0 +1,69 @@ +payMethod = new PayPalPaymentMethod(); + $this->id = 'hp_va'; + $this->name = 'PayPal'; + + $this->bookingModes = array( + 'PA' => 'authorize', + 'DB' => 'debit' + ); + } + + /** + * Initialise Gateway Settings Form Fields. + */ + public function init_form_fields() + { + parent::init_form_fields(); + + $this->form_fields['security_sender']['default'] = '31HA07BC8142C5A171745D00AD63D182'; + $this->form_fields['user_login']['default'] = '31ha07bc8142c5a171744e5aef11ffd3'; + $this->form_fields['user_password']['default'] = '93167DE7'; + $this->form_fields['transaction_channel']['default'] = '31HA07BC8124365CA41D4BDA79CCCD22'; + + $this->form_fields['bookingmode'] = $this->getBookingSelection(); + } + + + + /** + * @return String get the transaction type to use for payment + */ + public function getBookingAction() { + return (string) $this->bookingModes[$this->get_option('bookingmode')]; + } +} diff --git a/languages/woocommerce-heidelpay-de_DE.mo b/languages/woocommerce-heidelpay-de_DE.mo index 428a9cb..feb8235 100644 Binary files a/languages/woocommerce-heidelpay-de_DE.mo and b/languages/woocommerce-heidelpay-de_DE.mo differ diff --git a/languages/woocommerce-heidelpay-de_DE.po b/languages/woocommerce-heidelpay-de_DE.po index 24f9071..e5f1138 100644 --- a/languages/woocommerce-heidelpay-de_DE.po +++ b/languages/woocommerce-heidelpay-de_DE.po @@ -5,172 +5,265 @@ msgstr "" "Project-Id-Version: heidelpay WooCommerce 1.0.0\n" "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woocommerce-heidelpay" "heidelpay\n" -"POT-Creation-Date: 2018-05-24 09:13:24+00:00\n" +"POT-Creation-Date: 2018-06-13 08:38:11+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2018-06-13 13:37+00:00\n" "Last-Translator: DANIEL KRAUT \n" "Language-Team: GERMAN\n" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:19 -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:56 -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:33 +#: includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php:57 +msgid "Awaiting payment" +msgstr "Auf Zahlung warten" + +#: includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php:150 +msgid "Pay Now" +msgstr "Jetzt bezahlen" + +#: includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php:163 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:329 +msgid " Error: Paymentmethod was not found: " +msgstr "Fehler: Zahlart nicht gefunden: " + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:43 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:107 +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:67 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:84 msgid "%s" msgstr "%s" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:20 -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:220 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:44 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:391 msgid "heidelpay %s" msgstr "heidelpay %s" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:46 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:97 msgid "Enable/Disable" msgstr "Aktivieren" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:48 -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:36 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:99 +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:69 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:87 msgid "Enable %s" msgstr "%s aktivieren" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:52 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:103 msgid "Title" msgstr "Bezeichnung" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:55 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:106 msgid "This controls the title which the user sees during checkout." msgstr "Bezeichnung der Zahlart im Checkout" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:60 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:111 msgid "Description" msgstr "Beschreibung" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:62 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:113 msgid "Payment method description that the customer will see on your checkout." msgstr "Beschreibung der Zahlart im Checkout" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:66 -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:34 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:117 +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:68 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:85 msgid "Insert payment data for %s" msgstr "Zahlungsdaten für %s einfügen" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:70 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:121 msgid "Instructions" msgstr "Anweisungen" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:72 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:123 msgid "Instructions that will be added to the thank you page and emails." -msgstr "Anweisungen in der Bestellbestätigungsseite und in E-Mails" +msgstr "Anweisungen auf der Bestellbestätigungsseite und in E-Mails" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:76 -msgid "The following acount will be billed:" +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:127 +msgid "The following account will be billed:" msgstr "Das folgende Konto wird belastet:" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:80 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:131 msgid "Security Sender" msgstr "Security Sender" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:87 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:138 msgid "User Login" msgstr "User Login" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:94 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:145 msgid "User Password" msgstr "User Password" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:101 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:152 msgid "Transaction Channel" msgstr "Transaction Channel" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:108 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:159 msgid "Secret" msgstr "Secret" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:116 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:167 msgid "Sandbox" msgstr "Sandbox" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:119 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:170 msgid "Enable sandbox mode" msgstr "Sandbox-Modus aktivieren" -#: includes/class-wc-heidelpay-response.php:91 -#: includes/gateways/class-wc-heidelpay-gateway-cc.php:37 -#: includes/gateways/class-wc-heidelpay-gateway-dc.php:122 -msgid "Awaiting payment" +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:353 +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:124 +msgid "Payment error: " +msgstr "Zahlungsfehler: " + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:428 +msgid "Bookingmode" +msgstr "Buchungsmodus" + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:431 +msgid "Debit" +msgstr "Direktbuchung" + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:432 +msgid "Authorization" +msgstr "Authorisierung" + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:435 +msgid "Choose a bookingmode" +msgstr "Buchungsmodus wählen" + +#: includes/class-wc-heidelpay-response.php:74 +msgid "" +"Payment reservation successful. Please use the hiP to check the payment." +msgstr "Reservierung der Zahlung erfolgreich. Bitte Zahlungseingang im hIP prüfen." + +#: includes/class-wc-heidelpay-response.php:81 +msgid "Awaiting payment." msgstr "Auf Zahlung warten" -#: includes/gateways/class-wc-heidelpay-gateway-cc.php:48 +#: includes/gateways/class-wc-heidelpay-gateway-cc.php:33 msgid "Credit Card" msgstr "Kreditkarte" -#: includes/gateways/class-wc-heidelpay-gateway-cc.php:104 -#: includes/gateways/class-wc-heidelpay-gateway-dc.php:88 -msgid "Pay Now" -msgstr "Jetzt bezahlen" - -#: includes/gateways/class-wc-heidelpay-gateway-dc.php:34 +#: includes/gateways/class-wc-heidelpay-gateway-dc.php:33 msgid "Debit Card" msgstr "Debitkarte" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:35 +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:47 +msgid "You have to enter the account holder" +msgstr "Bitte den Kontoinhaber eingeben" + +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:54 +msgid "You have to enter the IBAN" +msgstr "Bitte die IBAN eingeben" + +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:78 +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:67 +msgid "Account Holder" +msgstr "Kontoinhaber" + +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:79 +msgid "IBAN" +msgstr "IBAN" + +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:104 +msgid "Direct Debit" +msgstr "Lastschrift" + +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:43 +msgid "iDeal" +msgstr "iDeal" + +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:68 +msgid "Bank" +msgstr "Bank" + +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:124 +msgid "Chose a bank please." +msgstr "Bitte eine Bank wählen" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:47 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:249 +msgid "You have to be at least 18 years old in order to use secured invoice" +msgstr "Der versicherte Rechnungskauf ist erst ab 18 Jahren möglich" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:53 +msgid "You have to enter your salutation" +msgstr "Bitte Anrede wählen" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:60 +msgid "You are not allowed to use secured invoice with a company name" +msgstr "Der versicherte Rechnungskauf ist nicht für Firmenkunden möglich" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:86 msgid "please send the money to IBAN BIC " msgstr "Bitte überweisen Sie an IBAN BIC " -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:45 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:94 +msgid "Advanced options" +msgstr "Erweiterte Optionen" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:100 +msgid "Minimum Amount" +msgstr "Mindestbetrag" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:107 +msgid "Maxmimum Amount" +msgstr "Maximalbetrag" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:114 +msgid "Available Countries for secured invoice" +msgstr "Erlaubte Länder für den versicherten Rechnungskauf" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:116 +msgid "" +"Here you can enable secured Invoice for specific countries. Be aware that " +"this will not enable the country in your WooCommerce settings and you have " +"to enable them seperately." +msgstr "" +"Hier können Sie den versicherten Rechnungskauf auf bestimmte Länder beschränken." +"Bitte beachten Sie, dass sie entsprechende Länder weiterhin in den WooCommerce Einstellungen aktivieren müssen" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:121 +msgid "Enable Germany" +msgstr "Deutschland aktivieren" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:127 +msgid "Enable Austria" +msgstr "Österreich aktivieren" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:202 msgid "Salutation" msgstr "Anrede" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:46 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:203 msgid "Mr" msgstr "Herr" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:47 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:204 msgid "Mrs" msgstr "Frau" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:48 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:205 msgid "Birthdate" msgstr "Geburtsdatum" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:81 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:269 msgid "Secured Invoice" msgstr "Versicherter Rechnungskauf" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:102 -#: includes/gateways/class-wc-heidelpay-gateway-so.php:60 -msgid "Payment error: " -msgstr "Zahlungsfehler: " - -#: woocommerce-heidelpay.php:161 -msgid "heidelpay CC" -msgstr "heidelpay Kreditkarte" - -#: woocommerce-heidelpay.php:162 -msgid "heidelpay DC" -msgstr "heidelpay Debitkarte" - -#: woocommerce-heidelpay.php:163 -msgid "heidelpay IVPG" -msgstr "heidelpay Versicherter Rechnungskauf" - -#: woocommerce-heidelpay.php:164 -msgid "heidelpay SO" -msgstr "heidelpay Sofort" - -#: woocommerce-heidelpay.php:232 +#: woocommerce-heidelpay.php:213 msgid "minimal PHP version error" msgstr "PHP-Version zu niedrig" -#: woocommerce-heidelpay.php:238 +#: woocommerce-heidelpay.php:219 msgid "WooCommerce plugin not activated" msgstr "Das WooCommerce Plug-In ist nicht aktiviert" -#: woocommerce-heidelpay.php:242 +#: woocommerce-heidelpay.php:223 msgid "minimal WC version error" msgstr "WooCommerce-Version zu niedrig" -#: woocommerce-heidelpay.php:248 +#: woocommerce-heidelpay.php:229 msgid "cURL is not installed." msgstr "cURL ist nicht installiert" diff --git a/languages/woocommerce-heidelpay.pot b/languages/woocommerce-heidelpay.pot index b611869..f29219a 100644 --- a/languages/woocommerce-heidelpay.pot +++ b/languages/woocommerce-heidelpay.pot @@ -2,10 +2,10 @@ # This file is distributed under the same license as the heidelpay WooCommerce package. msgid "" msgstr "" -"Project-Id-Version: heidelpay WooCommerce 1.0.0\n" +"Project-Id-Version: heidelpay WooCommerce 1.1.0\n" "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woocommerce-" "heidelpay\n" -"POT-Creation-Date: 2018-05-25 10:47:19+00:00\n" +"POT-Creation-Date: 2018-06-15 08:21:52+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -13,164 +13,255 @@ msgstr "" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:19 -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:56 -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:33 +#: includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php:57 +msgid "Awaiting payment" +msgstr "" + +#: includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php:150 +msgid "Pay Now" +msgstr "" + +#: includes/abstracts/abstract-wc-heidelpay-iframe-gateway.php:163 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:329 +msgid " Error: Paymentmethod was not found: " +msgstr "" + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:43 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:107 +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:67 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:84 msgid "%s" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:20 -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:220 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:44 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:391 msgid "heidelpay %s" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:46 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:97 msgid "Enable/Disable" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:48 -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:36 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:99 +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:69 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:87 msgid "Enable %s" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:52 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:103 msgid "Title" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:55 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:106 msgid "This controls the title which the user sees during checkout." msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:60 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:111 msgid "Description" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:62 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:113 msgid "Payment method description that the customer will see on your checkout." msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:66 -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:34 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:117 +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:68 +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:85 msgid "Insert payment data for %s" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:70 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:121 msgid "Instructions" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:72 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:123 msgid "Instructions that will be added to the thank you page and emails." msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:76 -msgid "The following acount will be billed:" +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:127 +msgid "The following account will be billed:" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:80 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:131 msgid "Security Sender" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:87 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:138 msgid "User Login" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:94 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:145 msgid "User Password" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:101 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:152 msgid "Transaction Channel" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:108 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:159 msgid "Secret" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:116 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:167 msgid "Sandbox" msgstr "" -#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:119 +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:170 msgid "Enable sandbox mode" msgstr "" -#: includes/class-wc-heidelpay-response.php:91 -#: includes/gateways/class-wc-heidelpay-gateway-cc.php:37 -#: includes/gateways/class-wc-heidelpay-gateway-dc.php:122 -msgid "Awaiting payment" +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:353 +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:124 +msgid "Payment error: " msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-cc.php:48 -msgid "Credit Card" +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:428 +msgid "Bookingmode" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-cc.php:104 -#: includes/gateways/class-wc-heidelpay-gateway-dc.php:88 -msgid "Pay Now" +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:431 +msgid "Direct debit" +msgstr "" + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:432 +msgid "Authorization" +msgstr "" + +#: includes/abstracts/abstract-wc-heidelpay-payment-gateway.php:435 +msgid "Choose a bookingmode" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-dc.php:34 +#: includes/class-wc-heidelpay-response.php:74 +msgid "" +"Payment reservation successful. Please use the hiP to check the payment." +msgstr "" + +#: includes/class-wc-heidelpay-response.php:81 +msgid "Awaiting payment." +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-cc.php:33 +msgid "Credit Card" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-dc.php:33 msgid "Debit Card" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:35 -msgid "please send the money to IBAN BIC " +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:47 +msgid "You have to enter the account holder" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:45 -msgid "Salutation" +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:54 +msgid "You have to enter the IBAN" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:46 -msgid "Mr" +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:78 +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:67 +msgid "Account Holder" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:79 +msgid "IBAN" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-dd.php:104 +msgid "Direct Debit" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:43 +msgid "iDeal" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:68 +msgid "Bank" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-idl.php:124 +msgid "Chose a bank please." msgstr "" #: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:47 -msgid "Mrs" +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:248 +msgid "You have to be at least 18 years old in order to use secured invoice" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:48 -msgid "Birthdate" +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:53 +msgid "You have to enter your salutation" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:81 -msgid "Secured Invoice" +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:60 +msgid "You are not allowed to use secured invoice with a company name" msgstr "" -#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:102 -#: includes/gateways/class-wc-heidelpay-gateway-so.php:60 -msgid "Payment error: " +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:86 +msgid "please send the money to IBAN BIC " +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:94 +msgid "Advanced options" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:100 +msgid "Minimum Amount" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:107 +msgid "Maxmimum Amount" msgstr "" -#: woocommerce-heidelpay.php:161 -msgid "heidelpay CC" +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:114 +msgid "Available Countries for secured invoice" msgstr "" -#: woocommerce-heidelpay.php:162 -msgid "heidelpay DC" +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:116 +msgid "" +"Here you can enable secured Invoice for specific countries. Be aware that " +"this will not enable the country in your WooCommerce settings and you have " +"to enable them seperately." +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:120 +msgid "Enable Germany" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:126 +msgid "Enable Austria" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:201 +msgid "Salutation" msgstr "" -#: woocommerce-heidelpay.php:163 -msgid "heidelpay IVPG" +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:202 +msgid "Mr" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:203 +msgid "Mrs" msgstr "" -#: woocommerce-heidelpay.php:164 -msgid "heidelpay SO" +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:204 +msgid "Birthdate" +msgstr "" + +#: includes/gateways/class-wc-heidelpay-gateway-ivpg.php:268 +msgid "Secured Invoice" msgstr "" -#: woocommerce-heidelpay.php:232 +#: woocommerce-heidelpay.php:218 msgid "minimal PHP version error" msgstr "" -#: woocommerce-heidelpay.php:238 +#: woocommerce-heidelpay.php:224 msgid "WooCommerce plugin not activated" msgstr "" -#: woocommerce-heidelpay.php:242 +#: woocommerce-heidelpay.php:228 msgid "minimal WC version error" msgstr "" -#: woocommerce-heidelpay.php:248 +#: woocommerce-heidelpay.php:234 msgid "cURL is not installed." msgstr "" diff --git a/woocommerce-heidelpay.php b/woocommerce-heidelpay.php index d880b79..8b73d40 100644 --- a/woocommerce-heidelpay.php +++ b/woocommerce-heidelpay.php @@ -10,7 +10,7 @@ * Plugin Name: heidelpay WooCommerce * Plugin URI: https://dev.heidelpay.com * Description: heidelpay payment integration for WooCommerce - * Version: 1.0.1 + * Version: 1.1.0 * Author: heidelpay * Author URI: htts://www.heidelpay.com * Developer: heidelpay @@ -18,7 +18,7 @@ * Text Domain: woocommerce-heidelpay * Domain Path: /languages * - * Copyright: © 2018 heidelpay GmbH + * Copyright: © 2018-present heidelpay GmbH * License: see LICENSE.txt */ @@ -29,7 +29,7 @@ /** * Required minimums and constants */ - define('WC_HEIDELPAY_VERSION', '1.0.1'); + define('WC_HEIDELPAY_VERSION', '1.1.0'); define('WC_HEIDELPAY_MIN_PHP_VER', '5.6.0'); define('WC_HEIDELPAY_MIN_WC_VER', '3.0.0'); define('WC_HEIDELPAY_MAIN_FILE', __FILE__); @@ -126,13 +126,14 @@ public function init() require_once(dirname(__FILE__) . '/includes/abstracts/abstract-wc-heidelpay-payment-gateway.php'); require_once(dirname(__FILE__) . '/includes/gateways/class-wc-heidelpay-gateway-cc.php'); require_once(dirname(__FILE__) . '/includes/gateways/class-wc-heidelpay-gateway-dc.php'); + require_once(dirname(__FILE__) . '/includes/gateways/class-wc-heidelpay-gateway-idl.php'); + require_once(dirname(__FILE__) . '/includes/gateways/class-wc-heidelpay-gateway-dd.php'); require_once(dirname(__FILE__) . '/includes/gateways/class-wc-heidelpay-gateway-ivpg.php'); require_once(dirname(__FILE__) . '/includes/gateways/class-wc-heidelpay-gateway-so.php'); + require_once(dirname(__FILE__) . '/includes/gateways/class-wc-heidelpay-gateway-va.php'); require_once(dirname(__FILE__) . '/includes/class-wc-heidelpay-response.php'); add_filter('woocommerce_payment_gateways', array($this, 'add_gateways')); - add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links')); - add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin')); } /** @@ -142,8 +143,11 @@ public function add_gateways($methods) { $methods[] = 'WC_Gateway_HP_CC'; $methods[] = 'WC_Gateway_HP_DC'; + $methods[] = 'WC_Gateway_HP_IDL'; + $methods[] = 'WC_Gateway_HP_DD'; $methods[] = 'WC_Gateway_HP_IVPG'; $methods[] = 'WC_Gateway_HP_SO'; + $methods[] = 'WC_Gateway_HP_VA'; return $methods; }