Skip to content

Commit

Permalink
v1.14.23
Browse files Browse the repository at this point in the history
  • Loading branch information
iverok committed Jan 18, 2024
2 parents f8c9ee1 + b942edd commit 99204be
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 36 deletions.
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ When you enable this plugin, your customers will be able to choose Vipps as a pa
## How to get started

* Sign up to use [*Vipps på Nett*](https://www.vipps.no/produkter-og-tjenester/bedrift/ta-betalt-paa-nett/ta-betalt-paa-nett/woocommerce/).
* After 1-2 days, you will get an email with login details to Vipps Developer Portal, where you can get the API credentials.
* After 1-2 days, you will get an email with login details to [portal.vippsmobilepay.com](https://portal.vippsmobilepay.com/), where you can get the API credentials.
* Download and install the plugin.
* Configure the plugin.

Expand All @@ -56,19 +56,18 @@ When you enable this plugin, your customers will be able to choose Vipps as a pa
The plugin can also be installed manually by uploading the plugin files to the `/wp-content/plugins/` directory.
2. Activate the plugin through the *Plugins* screen on WordPress.
3. Go to the *WooCommerce Settings* page, choose *Payment Gateways* (*Betalinger*), and enable Vipps.
4. Go the *Settings* page for the Vipps plugin and enter your Vipps account keys. Your account keys are available in the Vipps Developer Portal. For information, see [How to get Vipps account keys from Vipps Developer Portal](#how-to-get-vipps-account-keys-from-vipps-developer-portal).
4. Go the *Settings* page for the Vipps plugin and enter your Vipps account keys. Your account keys are available in the Vipps Merchant Portal. For information, see [How to get account keys from Merchant Portal](#how-to-get-account-keys-from-merchant-portal).

## How to get Vipps account keys from Merchant Portal
## How to get account keys from Merchant Portal

1. Sign in to the Vipps Portal at [https://portal.vipps.no/](https://portal.vipps.no/) using Bank ID
2. Select the *Utvikler* (*Developer*) tab and choose Production Keys. Here you can find the merchant serial number (6 figures)
3. Click on *Show keys* under the API keys column to see *Client ID*, *Client Secret* and *Vipps Subscription Key*
1. Sign in to [portal.vippsmobilepay.com](https://portal.vippsmobilepay.com/).
2. In the *Developer* section, choose *Production Keys*. Here you can find the merchant serial number (6 figures).
3. Click on *Show keys* under the API keys column to see *Client ID*, *Client Secret* and *Vipps Subscription Key*.

For more information, see:
See:

* [Getting Started](https://developer.vippsmobilepay.com/docs/getting-started)
* [API Keys](https://developer.vippsmobilepay.com/docs/knowledge-base/api-keys)
* [eCom FAQ](https://developer.vippsmobilepay.com/docs/APIs/ecom-api/vipps-ecom-api-faq)
* [Logging in to the portal](https://developer.vippsmobilepay.com/docs/developer-resources/portal#logging-in)
* [How to find the API keys](https://developer.vippsmobilepay.com/docs/developer-resources/portal#how-to-find-the-api-keys).

## Screenshots

Expand Down Expand Up @@ -103,11 +102,9 @@ through TestFlight. See
for more information.

API keys for both the test and production environment are available on
[portal.vipps.no](https://portal.vipps.no), where you log in with BankID.
[portal.vippsmobilepay.com](https://portal.vippsmobilepay.com), where you log in.
See [Getting the API keys](https://developer.vippsmobilepay.com/docs/developer-resources/portal/#how-to-find-the-api-keys)
and the
[Getting started](https://developer.vippsmobilepay.com/docs/getting-started)
guide for more information.
for more information.

To use test mode in WooCommerce, switch *Developer mode* on. There you can input
the API keys for the test environment, and turn test mode on and off.
Expand Down
11 changes: 7 additions & 4 deletions Vipps.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3630,10 +3630,13 @@ protected function print_express_checkout_page($execute,$action,$productinfo=nul
$classlist = apply_filters("woo_vipps_express_checkout_form_classes", "woocommerce-checkout");
$content .= "<form id='vippsdata' class='" . esc_attr($classlist) . "'>";
$content .= "<input type='hidden' name='action' value='" . esc_attr($action) ."'>";
// This is for the new order attribution feature of woo. IOK 2024-01-09
ob_start();
do_action( 'woocommerce_after_order_notes');
$content .= ob_get_clean();
if ($this->gateway()->get_option('vippsorderattribution') == 'yes') {
// This is for the new order attribution feature of woo. IOK 2024-01-09
$content .= '<input type="hidden" id="vippsorderattribution" value="1" />';
ob_start();
do_action( 'woocommerce_after_order_notes');
$content .= ob_get_clean();
}
$content .= wp_nonce_field('do_express','sec',1,false);

$termsHTML = '';
Expand Down
9 changes: 6 additions & 3 deletions VippsCheckout.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,12 @@ function vipps_checkout_shortcode ($atts, $content) {
$out .= "<form id='vippsdata' class='" . esc_attr($classlist) . "'>";
$out .= "<input type='hidden' id='vippsorderid' name='_vippsorder' value='" . intval($current_pending) . "' />";
// And this is for the order attribution feature of Woo 8.5 IOK 2024-01-09
ob_start();
do_action( 'woocommerce_after_order_notes');
$out .= ob_get_clean();
if (WC_Gateway_Vipps::instance()->get_option('vippsorderattribution') == 'yes') {
$out .= '<input type="hidden" id="vippsorderattribution" value="1" />';
ob_start();
do_action( 'woocommerce_after_order_notes');
$out .= ob_get_clean();
}
$out .= wp_nonce_field('do_vipps_checkout','vipps_checkout_sec',1,false);
$out .= "</form>";

Expand Down
15 changes: 15 additions & 0 deletions WC_Gateway_Vipps.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,14 @@ public function init_form_fields() {
'description' => __("If you have issues with your theme, you might find a setting here that will help. Normally you do not need to change these.", 'woo-vipps')
),

'vippsorderattribution' => array(
'title' => __( 'Support WooCommerces Order Attribution API for Checkout and Express Checkout', 'woo-vipps' ),
'label' => __( 'Add support for Order Attribution', 'woo-vipps' ),
'type' => 'checkbox',
'default'=> 'no',
'description' => __('Turn this on to add support for Woos Order Attribution API for Checkout and Express Checkout. Some stores have reported problems when using this API together with Vipps, so be sure to test this if you turn it on.', 'woo-vipps'),
),

'vippsspecialpagetemplate' => array(
'title' => __( 'Override page template used for the special Vipps pages', 'woo-vipps' ),
'label' => __( 'Use specific template for Vipps', 'woo-vipps' ),
Expand Down Expand Up @@ -3036,6 +3044,13 @@ public function create_partial_order($ischeckout=false) {

// Normally done by the WC_Checkout::create_order method, so call it here too. IOK 2018-11-19
do_action('woocommerce_checkout_update_order_meta', $orderid, array());

// It isn't possible to remove the javascript or 'after order notice' actions, because these are added as closures
// before anything else is run. But we can disable the hook that saves data. IOK 2024-01-18
if (WC_Gateway_Vipps::instance()->get_option('vippsorderattribution') != 'yes') {
remove_all_filters( 'woocommerce_order_save_attribution_data');
}

// And another one. IOK 2021-11-24
do_action( 'woocommerce_checkout_order_created', $order );
} catch ( Exception $e ) {
Expand Down
11 changes: 7 additions & 4 deletions js/express-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,13 @@ jQuery(document).ready(function () {
}

// Required for the order attribution thing IOK 2024-01-16
try {
jQuery(document.body).trigger( 'init_checkout' );
} catch (error) {
console.log("Could not trigger init-checkout: %j", error);
if (jQuery('#vippsorderattribution').val() == 1) {
try {
console.log("Triggering init_checkout");
jQuery(document.body).trigger( 'init_checkout' );
} catch (error) {
console.log("Could not trigger init-checkout: %j", error);
}
}

jQuery('#do-express-checkout').prop('disabled',true);
Expand Down
18 changes: 10 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== Pay with Vipps for WooCommerce ===
Contributors: wphostingdev, iverok, perwilhelmsen, nikolaidev
Tags: woocommerce, vipps
Version: 1.14.22
Stable tag: 1.14.22
Version: 1.14.23
Stable tag: 1.14.23
Requires at least: 4.7
Tested up to: 6.4.2
Requires PHP: 5.6
Expand Down Expand Up @@ -46,7 +46,7 @@ Settings for the cart, category and product pages can be found in the WooCommerc
Shareable links and QR codes can be generated from the Vipps tab on the product page.

=== How to get started ===
* Sign up to use Vipps, adn choose your product on [Vipps Portal](https://portal.vipps.no)
* Sign up to use Vipps, adn choose your product on [Vipps Portal](https://portal.vippsmobilepay.com)
* After 1-2 days you will get an email with login details to Vipps Developer Portal, where you can get the API credentials
* Download and install the plugin
* Configure the plugin
Expand All @@ -65,7 +65,7 @@ Shareable links and QR codes can be generated from the Vipps tab on the product
4. Go the settings page for the Vipps plugin and enter your Vipps account keys. Your account keys are available in the Vipps Developer Portal (detailed info in the section below)

=== How to get Vipps account keys from Vipps Developer Portal ===
1. Sign in to the Vipps Portal at [https://portal.vipps.no/](https://portal.vipps.no/) using Bank ID
1. Sign in to the Vipps Portal at [https://portal.vippsmobilepay.com/](https://portal.vippsmobilepay.com/) using Bank ID
2. Select the "Utvikler" ("Developer") tab and choose Production Keys. Here you can find the merchant serial number (6 figures)
3. Click on "Show keys" under the API keys column to see “Client ID”, “Client Secret” and “Vipps Subscription Key”

Expand All @@ -79,9 +79,8 @@ Shareable links and QR codes can be generated from the Vipps tab on the product
This project is hosted on Github at: https://github.com/vippsas/vipps-woocommerce

== Upgrade Notice ==
Support Order Attribution in Vipps Checkout and Express Checkout
Minor fixes
Fix for regression in activate/deactivate actions
Support Order Attribution in Vipps Checkout and Express Checkout, if selected in the "Advanced" settings.
NB: There has been reports of memory-related crashes when doing this, so be sure to test!

== Frequently Asked Questions ==

Expand Down Expand Up @@ -218,6 +217,9 @@ From version 1.1.13 you can also modify the javascript using the new WP hooks li

== Changelog ==

= 2023-01-17 version 1.14.21 and 1.14.23 =
Disable support for order attribution by default - it can be added in the "Advanced" settings. Some sites got crashes due to memory use.

= 2023-01-16 version 1.14.21 and 1.14.22 =
Minor fix for 8.5.1 and express checkout

Expand Down Expand Up @@ -656,7 +658,7 @@ Added a do-action call to 'woocommerce_cart_loaded_from_session' in callbacks to

= 2019.08.06 version 1.2.0 =
* Removed separate Access Key subscription, now only one subscription key is required
* Documentation updated to reflect that the keys are now to be fetched from portal.vipps.no, and that the separate Access Key subscription is no longer necessary
* Documentation updated to reflect that the keys are now to be fetched from portal.vippsmobilepay.com, and that the separate Access Key subscription is no longer necessary


= 2019.06.24 version 1.1.18 =
Expand Down
6 changes: 3 additions & 3 deletions woo-vipps.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
Author URI: https://www.wp-hosting.no/
Text-domain: woo-vipps
Domain Path: /languages
Version: 1.14.22
Stable tag: 1.14.22
Version: 1.14.23
Stable tag: 1.14.23
Requires at least: 4.7
Tested up to: 6.4.2
Requires PHP: 5.6
Expand Down Expand Up @@ -48,7 +48,7 @@


// Report version externally
define('WOO_VIPPS_VERSION', '1.14.22');
define('WOO_VIPPS_VERSION', '1.14.23');

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
Expand Down

0 comments on commit 99204be

Please sign in to comment.