Skip to content

Commit

Permalink
Merge pull request #39 from WordPoints/develop
Browse files Browse the repository at this point in the history
1.2.1
  • Loading branch information
JDGrimes authored Oct 16, 2017
2 parents 717cd48 + 239b662 commit 0ea3ac0
Show file tree
Hide file tree
Showing 35 changed files with 337 additions and 208 deletions.
76 changes: 47 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,74 @@
# Travis CI configuration file for a WordPoints module.
# Travis CI configuration file for a WordPoints extension.

language: php

# 5.3 runs first so that we can fail fast on the codesniff pass (see below).
php:
- 5.3
- 5.2
- 5.4
- 5.5
- 5.6
- 7.0
- 7.2
- 7.1
- 7.0
- 5.6
- 5.5
- 5.4

env:
- TRAVISCI_RUN=codesniff
- TRAVISCI_RUN=phpunit WP_VERSION=develop WORDPOINTS_VERSION=develop WC_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=develop WORDPOINTS_VERSION=master WC_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=4.7 WORDPOINTS_VERSION=develop WC_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=4.7 WORDPOINTS_VERSION=master WC_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=4.6 WORDPOINTS_VERSION=develop WC_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=4.6 WORDPOINTS_VERSION=master WC_VERSION=master
- TRAVISCI_RUN=phpunit WP_VERSION=develop WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
- TRAVISCI_RUN=phpunit WP_VERSION=4.8 WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
- TRAVISCI_RUN=phpunit WP_VERSION=4.7 WORDPOINTS_VERSION=develop WC_VERSION=release/3.2

dist: trusty

sudo: false

addons:
apt:
packages:
# Needed for `xmllint`.
- libxml2-utils

matrix:
include:
# Use Ubuntu Precise because Trusty doesn't support PHP 5.2 or 5.3.
- php: 5.3
dist: precise
env: TRAVISCI_RUN=phpunit WP_VERSION=develop WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
- php: 5.3
dist: precise
env: TRAVISCI_RUN=phpunit WP_VERSION=4.8 WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
- php: 5.3
dist: precise
env: TRAVISCI_RUN=phpunit WP_VERSION=4.7 WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
- php: 5.2
dist: precise
env: TRAVISCI_RUN=phpunit WP_VERSION=develop WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
- php: 5.2
dist: precise
env: TRAVISCI_RUN=phpunit WP_VERSION=4.8 WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
- php: 5.2
dist: precise
env: TRAVISCI_RUN=phpunit WP_VERSION=4.7 WORDPOINTS_VERSION=develop WC_VERSION=release/3.2
# Only run nightly against trunk.
- php: nightly
env: TRAVISCI_RUN=phpunit WP_VERSION=develop WC_VERSION=master
exclude:
# The codesniff pass only needs to be run once, I chose PHP 5.3, since WPCS requires it.
- php: 5.2
env: TRAVISCI_RUN=codesniff
- php: 5.4
# The codesniff pass only needs to be run once.
- php: 7.2
env: TRAVISCI_RUN=codesniff
- php: 5.5
- php: 7.0
env: TRAVISCI_RUN=codesniff
- php: 5.6
env: TRAVISCI_RUN=codesniff
- php: 7.0
- php: 5.5
env: TRAVISCI_RUN=codesniff
- php: 7.1
- php: 5.4
env: TRAVISCI_RUN=codesniff
- php: 7.1
env: TRAVISCI_RUN=phpunit WP_VERSION=4.6 WORDPOINTS_VERSION=develop WC_VERSION=master
- php: 7.1
env: TRAVISCI_RUN=phpunit WP_VERSION=4.6 WORDPOINTS_VERSION=master WC_VERSION=master
allow_failures:
- php: nightly
- php: 7.2
fast_finish: true

before_script:
- export WORDPOINTS_PROJECT_TYPE=module
- export WORDPOINTS_PROJECT_TYPE=extension
- export DEV_LIB_PATH=dev-lib
- if [ -e .wordpoints-dev-lib-config.sh ]; then source .wordpoints-dev-lib-config.sh; fi
- source $DEV_LIB_PATH/travis/before_script.sh
Expand All @@ -61,6 +78,7 @@ script:
- codesniff-php-autoloaders
- codesniff-phpcs
- codesniff-strings
- codesniff-dittography
- codesniff-jshint
- codesniff-l10n
- codesniff-xmllint
Expand All @@ -72,9 +90,9 @@ script:
- phpunit-uninstall
- phpunit-ms-uninstall
- phpunit-ms-network-uninstall
- WORDPOINTS_ONLY_UNINSTALL_MODULE=1 phpunit-uninstall
- WORDPOINTS_ONLY_UNINSTALL_MODULE=1 phpunit-ms-uninstall
- WORDPOINTS_ONLY_UNINSTALL_MODULE=1 phpunit-ms-network-uninstall
- WORDPOINTS_ONLY_UNINSTALL_EXTENSION=1 phpunit-uninstall
- WORDPOINTS_ONLY_UNINSTALL_EXTENSION=1 phpunit-ms-uninstall
- WORDPOINTS_ONLY_UNINSTALL_EXTENSION=1 phpunit-ms-network-uninstall
- phpunit-ajax
- phpunit-ms-ajax
- phpunit-ms-network-ajax
Expand Down
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Change Log for WooCommerce Module
# Change Log for WooCommerce Extension

All notable changes to this project will be documented in this file.

Expand All @@ -8,7 +8,19 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a CH

Nothing documented right now.

## [1.2.0] - 2017-04-24
## [1.2.1] - 2017-10-16

### Requires

- WordPoints: 2.4+

### Fixed

- Deprecated notices from `Channel`, `Module Name`, and `Module URI` extension headers.
- Deprecated notices from the un/installer, by using the new installables API.
- Gateway settings not being deleted on uninstall.

## [1.2.0] - 2017-05-24

### Changed

Expand Down Expand Up @@ -84,9 +96,11 @@ Nothing documented right now.

- Payment gateway that uses points as currency.
- The admin sets which points type to use.
- How many points to charge for the monetary amount can be set to 1 to 1 or 1 to 100.
- How many points to charge for the monetary amount can be set to 1-to-1 or 1-to-100.

[unreleased]: https://github.com/WordPoints/woocommerce/compare/master...HEAD
[1.2.1]: https://github.com/WordPoints/woocommerce/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/WordPoints/woocommerce/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/WordPoints/woocommerce/compare/1.0.2...1.1.0
[1.0.2]: https://github.com/WordPoints/woocommerce/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/WordPoints/woocommerce/compare/1.0.0...1.0.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# WooCommerce [![Build Status](https://travis-ci.org/WordPoints/woocommerce.svg?branch=develop)](https://travis-ci.org/WordPoints/woocommerce) [![codecov](https://codecov.io/gh/WordPoints/woocommerce/branch/master/graph/badge.svg)](https://codecov.io/gh/WordPoints/woocommerce) [![HackerOne Bug Bounty Program](https://img.shields.io/badge/security-HackerOne-blue.svg)](https://hackerone.com/wordpoints)

Hello! This is where we develop the premium WooCommerce integration module that you can [purchase on WordPoints.org](https://wordpoints.org/modules/woocommerce/). The source code of the module is made available here in good faith, to make it easier for developers to integrate with it, contribute bugfixes and security patches, and follow the development of new features. You can also feel free to use this source code to try the module out before you buy it. However, if you decide to use the module on a production site, we ask that you [purchase a license for it](https://wordpoints.org/modules/woocommerce/), so that we can continue to provide updates and support for WordPoints and all of its great modules. Thank you!
Hello! This is where we develop the premium WooCommerce integration extension that you can [purchase on WordPoints.org](https://wordpoints.org/extensions/woocommerce/). The source code of the extension is made available here in good faith, to make it easier for developers to integrate with it, contribute bugfixes and security patches, and follow the development of new features. You can also feel free to use this source code to try the extension out before you buy it. However, if you decide to use the extension on a production site, we ask that you [purchase a license for it](https://wordpoints.org/extensions/woocommerce/), so that we can continue to provide updates and support for WordPoints and all of its great extensions. Thank you!
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"php": ">=5.2.0"
},
"require-dev": {
"jdgrimes/wpppb": "^0.2",
"jdgrimes/wpppb": "^0.3.0",
"xrstf/composer-php52": "^1.0"
},
"scripts": {
Expand Down
15 changes: 7 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev-lib
Submodule dev-lib updated 100 files
2 changes: 1 addition & 1 deletion phpunit.uninstall.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<phpunit
bootstrap="dev-lib/phpunit/module-bootstrap.php"
bootstrap="dev-lib/phpunit/extension-bootstrap.php"
backupGlobals="false"
colors="true"
>
Expand Down
6 changes: 2 additions & 4 deletions src/classes/entity/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ class WordPoints_WooCommerce_Entity_Order extends WordPoints_Entity_Post {
protected $human_id_field = 'ID';

/**
* @since 1.1.0
* @since 1.2.1
*/
public function get_title() {
return _x( 'Order', 'entity title', 'wordpoints-woocommerce' );
}
protected $post_type = 'shop_order';

/**
* @since 1.1.0
Expand Down
2 changes: 2 additions & 0 deletions src/classes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
'wordpoints_woocommerce_hook_event_order_complete' => 'hook/event/order/complete.php',
'wordpoints_woocommerce_hook_event_product_publish' => 'hook/event/product/publish.php',
'wordpoints_woocommerce_hook_event_product_review_leave' => 'hook/event/product/review/leave.php',
'wordpoints_woocommerce_installable' => 'installable.php',
'wordpoints_woocommerce_updater_1_2_0_gateway' => 'updater/1/2/0/gateway.php',
// }
);

Expand Down
50 changes: 50 additions & 0 deletions src/classes/installable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/**
* Installable class.
*
* @package WordPoints_WooCommerce
* @since 1.2.1
*/

/**
* Installable object for the extension.
*
* @since 1.2.1
*/
class WordPoints_WooCommerce_Installable extends WordPoints_Installable_Extension {

/**
* @since 1.2.1
*/
public function get_update_routine_factories() {

$factories = parent::get_update_routine_factories();

// v1.2.0.
$factories[] = new WordPoints_Updater_Factory(
'1.2.0'
, array(
'local' => array( 'WordPoints_WooCommerce_Updater_1_2_0_Gateway' ),
)
);

return $factories;
}

/**
* @since 1.2.1
*/
protected function get_uninstall_routine_factories() {

$factories = parent::get_uninstall_routine_factories();

$factories[] = new WordPoints_Uninstaller_Factory_Options(
array( 'woocommerce_wordpoints_points_settings' )
);

return $factories;
}
}

// EOF
38 changes: 38 additions & 0 deletions src/classes/updater/1/2/0/gateway.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* Gateway 1.2.0 updater class.
*
* @package WordPoints_WooCommerce
* @since 1.2.1
*/

/**
* Updates the gateway settings for 1.2.0.
*
* @since 1.2.1
*/
class WordPoints_WooCommerce_Updater_1_2_0_Gateway implements WordPoints_RoutineI {

/**
* @since 1.2.1
*/
public function run() {

$gateway = new WordPoints_WooCommerce_Gateway_Points();

$settings = $gateway->settings;

if ( ! isset( $settings['points_type'], $settings['conversion_rate'] ) ) {
return;
}

$settings[ "conversion_rate-{$settings['points_type']}" ] = $settings['conversion_rate'];

unset( $settings['points_type'], $settings['conversion_rate'] );

update_option( $gateway->get_option_key(), $settings );
}
}

// EOF
2 changes: 1 addition & 1 deletion src/components/points/includes/actions.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Hooks up the points-related actions and filters used by the module.
* Hooks up the points-related actions and filters used by the extension.
*
* @package WordPoints_WooCommerce\Points
* @since 1.1.0
Expand Down
18 changes: 9 additions & 9 deletions src/components/points/includes/gateways/points.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class WordPoints_WooCommerce_Gateway_Points extends WC_Payment_Gateway {
*/
public function __construct() {

$this->id = 'wordpoints_points';
$this->icon = '';
$this->has_fields = count( $this->get_points_types_for_checkout() ) > 1;
$this->method_title = _x( 'WordPoints', 'gateway title', 'wordpoints-woocommerce' );
$this->id = 'wordpoints_points';
$this->icon = '';
$this->has_fields = count( $this->get_points_types_for_checkout() ) > 1;
$this->supports = array( 'products', 'refunds' );
$this->method_title = _x( 'WordPoints', 'gateway title', 'wordpoints-woocommerce' );
/* translators: gateway description. */
$this->method_description = __( 'WordPoints works by letting the user pay with points.', 'wordpoints-woocommerce' );
$this->supports = array( 'products', 'refunds' );
$this->method_description = __( 'WordPoints works by letting the user pay with points.', 'wordpoints-woocommerce' );

// Load the settings.
$this->init_form_fields();
Expand Down Expand Up @@ -198,7 +198,7 @@ public function points_type_field() {
?>

<p class="form-row form-row-first">
<label for="<?php echo esc_attr( $this->id ) ?>-points-type"><?php echo esc_html__( 'Points Type', 'wordpoints-woocommerce' ) ?> <span class="required">*</span></label>
<label for="<?php echo esc_attr( $this->id ); ?>-points-type"><?php echo esc_html__( 'Points Type', 'wordpoints-woocommerce' ); ?> <span class="required">*</span></label>
<?php

$dropdown = new WordPoints_Dropdown_Builder(
Expand Down Expand Up @@ -337,8 +337,8 @@ public function process_payment( $order_id ) {
WC()->cart->empty_cart();

return array(
'result' => 'success',
'redirect' => $this->get_return_url( $order ),
'result' => 'success',
'redirect' => $this->get_return_url( $order ),
);
}

Expand Down
Loading

0 comments on commit 0ea3ac0

Please sign in to comment.