Skip to content

Commit

Permalink
Merge pull request #25 from omise/release/1.2.1
Browse files Browse the repository at this point in the history
Release 1.2.1
  • Loading branch information
nimid authored Aug 8, 2016
2 parents bc29a72 + 227a732 commit 6a502df
Show file tree
Hide file tree
Showing 19 changed files with 750 additions and 227 deletions.
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
**1. Objective reason**

Explain in non-technical terms why this PR is required.
E.g.: What feature it adds, what problem it solves, ...

This section is used in the release notes.

Related ticket: [Issue ID](https://git.omise.co/omise/omise-woocommerce/issues/)

**2. Description of change**

A description of WHAT changed in the codebase. Additionally add the reasoning if it's complex or abstract. But not the diff, that's what 'git diff' is for.

**3. Users affected by the change**

All, None or Specific Developer(s).

**4. Impact of the change**

List the steps that must be taken for this PR to work.
E.g.: `rake yak:shave`, `Add "yak_key" to environment variables, ...`

Be sure to include all systems that needs to be changed or which system is affected by
the change (Ex: Requires Elastic search to be installed and configured in `secrets.yml`).

**5. Priority of change**

Normal, High or Immediate.

**6. Alternate solution (if any)**

Could we have done this any other way?
30 changes: 13 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
Change Log
==========
# Change Log

[1.2.0] 2016-06-01
------------
## [1.2.1] 2016-08-05
- *`Added`* Configuration for card brand logo display
- *`Added`* List of transfers
- *`Fixed`* Changing page by specify the page number which is not functional

## [1.2.0] 2016-06-01
- *`Added`* manual capture feature
- *`Added`* supported JPY currency
- *`Added`* shortcut menu to Omise's setting page
Expand All @@ -14,27 +17,20 @@ Change Log
- *`Improved`* Revised PHP code to following the WordPress Coding Standards.
- *`Improved`* Fixed/Improved various things.

[1.1.1] 2015-11-16
------------
## [1.1.1] 2015-11-16
- *`Added`* Added Omise-Version into the cURL request header.

[1.1.0] 2015-09-24
--------------------
## [1.1.0] 2015-09-24
- *`Added`* Adds support for 3-D Secure.

[1.0.2] 2015-03-23
--------------------
## [1.0.2] 2015-03-23
- *`Fixed`* Fix create token issue.

[1.0.1] 2015-03-10
--------------------
## [1.0.1] 2015-03-10
- *`Added`* Support fund transfers.

[1.0.0] 2015-01-20
--------------------
## [1.0.0] 2015-01-20
- *`Added`* First version supports.
- Charge a card
- Save a card
- Delete a card


- Delete a card
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
Omise-WooCommerce
=================
# Omise-WooCommerce

Omise WooCommerce Gateway Plugin is a wordpress plugin designed specifically for WooCommerce. The plugin adds support for Omise Payment Gateway payment method to WooCommerce.

Requirement
===========
## Requirement

The plugin was built and tested with Wordpress 4.0.1 and WooCommerce 2.2.8.
The plugin was built and tested with Wordpress 4.5.3 and WooCommerce 2.6.4.
The plugin dependencies are jQuery and [Omise.js](https://cdn.omise.co/omise.js) library.

How it works
============
## How it works

The plugin allows WooCommerce user to checkout with Omise Payment Gateway (Now only available in Thailand). The supported currency is Thai Bath (THB). User can checkout by input credit card information or if they are logged in to wordpress they can save the card for further charge without having to fill out the card information everytime.

Installation
============
## Installation

Please refer to our full documentation [page](https://www.omise.co/woocommerce-plugin)

Documentation
=============
## Documentation

Developer Documentation [here](https://www.omise.co/docs/)


Installation Guide
=============
## Installation Guide

1. Download the latest release packed as zip format from Releases page: https://github.com/omise/omise-woocommerce/releases
( latest: https://github.com/omise/omise-woocommerce/archive/v1.2.0.zip )
( latest: https://github.com/omise/omise-woocommerce/archive/v1.2.1.zip )

2. Install plugin in wordpress using Plugin Upload method, i.e. https://yourwebsite.com/wp-admin/plugin-install.php?tab=upload
and upload omise-woocommerce-1.2.0.zip
and upload omise-woocommerce-1.2.1.zip

3. Activate Omise plugin

Expand All @@ -56,8 +52,7 @@ Add your API Keys



Other Libraries
=============
## Other Libraries

* [Omise Ruby Library](https://github.com/omise/omise-ruby)
* [Omise Card.js](https://github.com/omise/card.js)
Expand Down
Binary file modified assets/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
198 changes: 198 additions & 0 deletions includes/classes/class-omise-card-image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
<?php
defined( 'ABSPATH' ) or die( "No direct script access allowed." );

if ( ! class_exists( 'Omise_Card_Image' ) ) {
class Omise_Card_Image {
/**
* Compose the given parameters into the string of HTML &lt;img&gt; element
*
* @param string $file Image file name with extension such as image.jpg
* @param string $alternate_text Alternate text for the image
* @return string HTML &lt;img&gt; element
*/
private static function get_image( $file, $alternate_text ) {
$url = WC_HTTPS::force_https_url( WC()->plugin_url() . '/assets/images/icons/credit-cards/' );
return "<img src='$url/$file' width='38px' alt='$alternate_text' />";
}

/**
* Return the default setting of display the American Express logo
*
* @return string
*/
public static function get_amex_default_display() {
return 'no';
}

/**
* Return the HTML &lt;img&gt; element of American Express logo
*
* @return string
*/
public static function get_amex_image() {
return self::get_image( 'amex.svg', 'American Express' );
}

/**
* Return the CSS used to format the image to be displayed vertical center align with checkbox
* at the back-end setting page
*
* @return string
*/
public static function get_css() {
return 'vertical-align: 5px;';
}

/**
* Return the default setting of display the Diners Club logo
*
* @return string
*/
public static function get_diners_default_display() {
return 'no';
}

/**
* Return the HTML &lt;img&gt; element of Diners Club logo
*
* @return string
*/
public static function get_diners_image() {
return self::get_image( 'diners.svg', 'Diners Club' );
}

/**
* Return the default setting of display the JCB logo
*
* @return string
*/
public static function get_jcb_default_display() {
return 'no';
}

/**
* Return the HTML &lt;img&gt; element of JCB logo
*
* @return string
*/
public static function get_jcb_image() {
return self::get_image( 'jcb.svg', 'JCB' );
}

/**
* Return the default setting of display the MasterCard logo
*
* @return string
*/
public static function get_mastercard_default_display() {
return 'yes';
}

/**
* Return the HTML &lt;img&gt; element of MasterCard logo
*
* @return string
*/
public static function get_mastercard_image() {
return self::get_image( 'mastercard.svg', 'MasterCard' );
}

/**
* Return the default setting of display the Visa logo
*
* @return string
*/
public static function get_visa_default_display() {
return 'yes';
}

/**
* Return the HTML &lt;img&gt; element of Visa logo
*
* @return string
*/
public static function get_visa_image() {
return self::get_image( 'visa.svg', 'Visa' );
}

/**
* Check whether the setting for American Express logo is configured and it was set to display or not display
*
* @param mixed $setting The array that contains key for checking the flag
* @return boolean
*/
public static function is_amex_enabled( $setting ) {
if ( isset( $setting['accept_amex'] ) && $setting['accept_amex'] == 'yes' ) {
return true;
}

return false;
}

/**
* Check whether the setting for Diners Club logo is configured and it was set to display or not display
*
* @param mixed $setting The array that contains key for checking the flag
* @return boolean
*/
public static function is_diners_enabled( $setting ) {
if ( isset( $setting['accept_diners'] ) && $setting['accept_diners'] == 'yes' ) {
return true;
}

return false;
}

/**
* Check whether the setting for JCB logo is configured and it was set to display or not display
*
* @param mixed $setting The array that contains key for checking the flag
* @return boolean
*/
public static function is_jcb_enabled( $setting ) {
if ( isset( $setting['accept_jcb'] ) && $setting['accept_jcb'] == 'yes' ) {
return true;
}

return false;
}

/**
* Check whether the setting for MasterCard logo is configured and it was set to display or not display
*
* @param mixed $setting The array that contains key for checking the flag
* @return boolean
*/
public static function is_mastercard_enabled( $setting ) {
// Make it backward compatible. If the setting is not configured, the MasterCard logo is display by default.
if ( ! isset( $setting['accept_mastercard'] ) ) {
return self::get_mastercard_default_display();
}

if ( $setting['accept_mastercard'] == 'yes' ) {
return true;
}

return false;
}

/**
* Check whether the setting for Visa logo is configured and it was set to display or not display
*
* @param mixed $setting The array that contains key for checking the flag
* @return boolean
*/
public static function is_visa_enabled( $setting ) {
// Make it backward compatible. If the setting is not configured, the Visa logo is display by default.
if ( ! isset( $setting['accept_visa'] ) ) {
return self::get_visa_default_display();
}

if ( $setting['accept_visa'] == 'yes' ) {
return true;
}

return false;
}
}
}
23 changes: 22 additions & 1 deletion includes/classes/class-omise-charge.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
defined( 'ABSPATH' ) or die ( "No direct script access allowed." );
defined( 'ABSPATH' ) or die( "No direct script access allowed." );

if ( ! class_exists( 'Omise_Charge' ) ) {
class Omise_Charge {
Expand Down Expand Up @@ -95,5 +95,26 @@ public static function get_error_message( $charge ) {

return '';
}

/**
* Retrieve the charge information by Omise secret key
*
* @param string $private_key The Omise secret key
* @return object OmisCharge
*/
public static function list_charges( $private_key ) {
$paged = isset( $_GET['paged'] ) ? $_GET['paged'] : 1;
$limit = 10;
$offset = $paged > 1 ? ( $paged - 1 ) * $limit : 0;
$order = 'reverse_chronological';

$filters = '?' . http_build_query( array(
'limit' => $limit,
'offset' => $offset,
'order' => $order
) );

return OmiseCharge::retrieve( $filters, '', $private_key );
}
}
}
Loading

0 comments on commit 6a502df

Please sign in to comment.