Fixed mixed tabs and spaces

This commit is contained in:
Claudio Sanches 2016-07-11 16:56:35 +02:00
parent ec1c30283f
commit 7d9d091767
60 changed files with 3401 additions and 3396 deletions

View File

@ -1,94 +1,94 @@
<div class="view">
<?php
global $wpdb;
<?php
global $wpdb;
if ( $metadata = $order->has_meta( $item_id ) ) {
echo '<table cellspacing="0" class="display_meta">';
foreach ( $metadata as $meta ) {
if ( $metadata = $order->has_meta( $item_id ) ) {
echo '<table cellspacing="0" class="display_meta">';
foreach ( $metadata as $meta ) {
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
// Get attribute data
if ( taxonomy_exists( wc_sanitize_taxonomy_name( $meta['meta_key'] ) ) ) {
$term = get_term_by( 'slug', $meta['meta_value'], wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_key'] = wc_attribute_label( wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_value'] = isset( $term->name ) ? $term->name : $meta['meta_value'];
} else {
$meta['meta_key'] = wc_attribute_label( $meta['meta_key'], $_product );
}
// Get attribute data
if ( taxonomy_exists( wc_sanitize_taxonomy_name( $meta['meta_key'] ) ) ) {
$term = get_term_by( 'slug', $meta['meta_value'], wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_key'] = wc_attribute_label( wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
$meta['meta_value'] = isset( $term->name ) ? $term->name : $meta['meta_value'];
} else {
$meta['meta_key'] = wc_attribute_label( $meta['meta_key'], $_product );
}
echo '<tr><th>' . wp_kses_post( rawurldecode( $meta['meta_key'] ) ) . ':</th><td>' . wp_kses_post( wpautop( make_clickable( rawurldecode( $meta['meta_value'] ) ) ) ) . '</td></tr>';
}
echo '</table>';
}
?>
echo '<tr><th>' . wp_kses_post( rawurldecode( $meta['meta_key'] ) ) . ':</th><td>' . wp_kses_post( wpautop( make_clickable( rawurldecode( $meta['meta_value'] ) ) ) ) . '</td></tr>';
}
echo '</table>';
}
?>
</div>
<div class="edit" style="display: none;">
<table class="meta" cellspacing="0">
<tbody class="meta_items">
<?php
if ( $metadata = $order->has_meta( $item_id )) {
foreach ( $metadata as $meta ) {
<table class="meta" cellspacing="0">
<tbody class="meta_items">
<?php
if ( $metadata = $order->has_meta( $item_id )) {
foreach ( $metadata as $meta ) {
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip hidden core fields
if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost'
) ) ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
// Skip serialised meta
if ( is_serialized( $meta['meta_value'] ) ) {
continue;
}
$meta['meta_key'] = rawurldecode( $meta['meta_key'] );
$meta['meta_value'] = esc_textarea( rawurldecode( $meta['meta_value'] ) ); // using a <textarea />
$meta['meta_id'] = absint( $meta['meta_id'] );
$meta['meta_key'] = rawurldecode( $meta['meta_key'] );
$meta['meta_value'] = esc_textarea( rawurldecode( $meta['meta_value'] ) ); // using a <textarea />
$meta['meta_id'] = absint( $meta['meta_id'] );
echo '<tr data-meta_id="' . esc_attr( $meta['meta_id'] ) . '">
<td>
<input type="text" name="meta_key[' . $meta['meta_id'] . ']" value="' . esc_attr( $meta['meta_key'] ) . '" />
<textarea name="meta_value[' . $meta['meta_id'] . ']">' . $meta['meta_value'] . '</textarea>
</td>
<td width="1%"><button class="remove_order_item_meta button">&times;</button></td>
</tr>';
}
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="4"><button class="add_order_item_meta button"><?php _e( 'Add&nbsp;meta', 'woocommerce' ); ?></button></td>
</tr>
</tfoot>
</table>
echo '<tr data-meta_id="' . esc_attr( $meta['meta_id'] ) . '">
<td>
<input type="text" name="meta_key[' . $meta['meta_id'] . ']" value="' . esc_attr( $meta['meta_key'] ) . '" />
<textarea name="meta_value[' . $meta['meta_id'] . ']">' . $meta['meta_value'] . '</textarea>
</td>
<td width="1%"><button class="remove_order_item_meta button">&times;</button></td>
</tr>';
}
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="4"><button class="add_order_item_meta button"><?php _e( 'Add&nbsp;meta', 'woocommerce' ); ?></button></td>
</tr>
</tfoot>
</table>
</div>

View File

@ -9,6 +9,6 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<div id="message" class="updated woocommerce-message">
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', $notice ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', $notice ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
<?php echo wp_kses_post( wpautop( $notice_html ) ); ?>
</div>

View File

@ -16,7 +16,7 @@ if ( current_user_can( 'install_plugins' ) ) {
}
?>
<div id="message" class="updated woocommerce-message">
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'simplify_commerce' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
<a class="woocommerce-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-hide-notice', 'simplify_commerce' ), 'woocommerce_hide_notices_nonce', '_wc_notice_nonce' ) ); ?>"><?php _e( 'Dismiss', 'woocommerce' ); ?></a>
<p><?php _e( '<strong>The Simplify Commerce payment gateway is deprecated</strong> &#8211; Please install our new free Simplify Commerce plugin from WordPress.org. Simplify Commerce will be removed from WooCommerce core in a future update.', 'woocommerce' ); ?></p>

View File

@ -326,9 +326,9 @@ class WC_Download_Handler {
header( "Content-Disposition: attachment; filename=\"" . $filename . "\";" );
header( "Content-Transfer-Encoding: binary" );
if ( $size = @filesize( $file_path ) ) {
header( "Content-Length: " . $size );
}
if ( $size = @filesize( $file_path ) ) {
header( "Content-Length: " . $size );
}
}
/**

View File

@ -24,10 +24,10 @@ class WC_Integrations {
*/
public $integrations = array();
/**
* Initialize integrations.
*/
public function __construct() {
/**
* Initialize integrations.
*/
public function __construct() {
do_action( 'woocommerce_integrations_init' );

View File

@ -49,22 +49,22 @@ class WC_Product_Grouped extends WC_Product {
*/
public function get_children() {
if ( ! is_array( $this->children ) || empty( $this->children ) ) {
$transient_name = 'wc_product_children_' . $this->id;
$transient_name = 'wc_product_children_' . $this->id;
$this->children = array_filter( array_map( 'absint', (array) get_transient( $transient_name ) ) );
if ( empty( $this->children ) ) {
if ( empty( $this->children ) ) {
$args = apply_filters( 'woocommerce_grouped_children_args', array(
'post_parent' => $this->id,
'post_type' => 'product',
'orderby' => 'menu_order',
'order' => 'ASC',
'fields' => 'ids',
'post_status' => 'publish',
'numberposts' => -1,
) );
$args = apply_filters( 'woocommerce_grouped_children_args', array(
'post_parent' => $this->id,
'post_type' => 'product',
'orderby' => 'menu_order',
'order' => 'ASC',
'fields' => 'ids',
'post_status' => 'publish',
'numberposts' => -1,
) );
$this->children = get_posts( $args );
$this->children = get_posts( $args );
set_transient( $transient_name, $this->children, DAY_IN_SECONDS * 30 );
}

View File

@ -89,10 +89,10 @@ class WC_Shipping {
}
}
/**
* Initialize shipping.
*/
public function init() {
/**
* Initialize shipping.
*/
public function init() {
do_action( 'woocommerce_shipping_init' );
}

View File

@ -79,8 +79,8 @@ class WC_Validation {
case 'US' :
$valid = (bool) preg_match( '/^([0-9]{5})(-[0-9]{4})?$/i', $postcode );
break;
case 'CA' :
// CA Postal codes cannot contain D,F,I,O,Q,U and cannot start with W or Z. https://en.wikipedia.org/wiki/Postal_codes_in_Canada#Number_of_possible_postal_codes
case 'CA' :
// CA Postal codes cannot contain D,F,I,O,Q,U and cannot start with W or Z. https://en.wikipedia.org/wiki/Postal_codes_in_Canada#Number_of_possible_postal_codes
$valid = (bool) preg_match( '/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])([\ ])?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/i', $postcode );
break;

View File

@ -49,7 +49,7 @@ class WC_Email_Failed_Order extends WC_Email {
*/
public function trigger( $order_id ) {
if ( $order_id ) {
$this->object = wc_get_order( $order_id );
$this->object = wc_get_order( $order_id );
$this->find['order-date'] = '{order_date}';
$this->find['order-number'] = '{order_number}';
$this->replace['order-date'] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );

View File

@ -17,9 +17,9 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class WC_Gateway_Cheque extends WC_Payment_Gateway {
/**
* Constructor for the gateway.
*/
/**
* Constructor for the gateway.
*/
public function __construct() {
$this->id = 'cheque';
$this->icon = apply_filters( 'woocommerce_cheque_icon', '' );
@ -38,18 +38,18 @@ class WC_Gateway_Cheque extends WC_Payment_Gateway {
// Actions
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
add_action( 'woocommerce_thankyou_cheque', array( $this, 'thankyou_page' ) );
add_action( 'woocommerce_thankyou_cheque', array( $this, 'thankyou_page' ) );
// Customer Emails
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
}
// Customer Emails
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
}
/**
* Initialise Gateway Settings Form Fields.
*/
public function init_form_fields() {
/**
* Initialise Gateway Settings Form Fields.
*/
public function init_form_fields() {
$this->form_fields = array(
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable/Disable', 'woocommerce' ),
'type' => 'checkbox',
@ -78,36 +78,36 @@ class WC_Gateway_Cheque extends WC_Payment_Gateway {
'desc_tip' => true,
),
);
}
/**
* Output for the order received page.
*/
public function thankyou_page() {
if ( $this->instructions )
echo wpautop( wptexturize( $this->instructions ) );
}
/**
* Add content to the WC emails.
*
* @access public
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
*/
/**
* Output for the order received page.
*/
public function thankyou_page() {
if ( $this->instructions )
echo wpautop( wptexturize( $this->instructions ) );
}
/**
* Add content to the WC emails.
*
* @access public
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
*/
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
if ( $this->instructions && ! $sent_to_admin && 'cheque' === $order->payment_method && $order->has_status( 'on-hold' ) ) {
if ( $this->instructions && ! $sent_to_admin && 'cheque' === $order->payment_method && $order->has_status( 'on-hold' ) ) {
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
}
}
/**
* Process the payment and return the result.
*
* @param int $order_id
* @return array
*/
/**
* Process the payment and return the result.
*
* @param int $order_id
* @return array
*/
public function process_payment( $order_id ) {
$order = wc_get_order( $order_id );

View File

@ -17,9 +17,9 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class WC_Gateway_COD extends WC_Payment_Gateway {
/**
* Constructor for the gateway.
*/
/**
* Constructor for the gateway.
*/
public function __construct() {
$this->id = 'cod';
$this->icon = apply_filters( 'woocommerce_cod_icon', '' );
@ -41,22 +41,22 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
add_action( 'woocommerce_thankyou_cod', array( $this, 'thankyou_page' ) );
// Customer Emails
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
// Customer Emails
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
}
/**
* Initialise Gateway Settings Form Fields.
*/
public function init_form_fields() {
$shipping_methods = array();
/**
* Initialise Gateway Settings Form Fields.
*/
public function init_form_fields() {
$shipping_methods = array();
if ( is_admin() )
foreach ( WC()->shipping()->load_shipping_methods() as $method ) {
$shipping_methods[ $method->id ] = $method->get_title();
}
if ( is_admin() )
foreach ( WC()->shipping()->load_shipping_methods() as $method ) {
$shipping_methods[ $method->id ] = $method->get_title();
}
$this->form_fields = array(
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable COD', 'woocommerce' ),
'label' => __( 'Enable Cash on Delivery', 'woocommerce' ),
@ -104,8 +104,8 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
'type' => 'checkbox',
'default' => 'yes'
)
);
}
);
}
/**
* Check If The Gateway Is Available For Use.
@ -189,12 +189,12 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
}
/**
* Process the payment and return the result.
*
* @param int $order_id
* @return array
*/
/**
* Process the payment and return the result.
*
* @param int $order_id
* @return array
*/
public function process_payment( $order_id ) {
$order = wc_get_order( $order_id );
@ -214,23 +214,23 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
);
}
/**
* Output for the order received page.
*/
/**
* Output for the order received page.
*/
public function thankyou_page() {
if ( $this->instructions ) {
echo wpautop( wptexturize( $this->instructions ) );
echo wpautop( wptexturize( $this->instructions ) );
}
}
/**
* Add content to the WC emails.
*
* @access public
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
*/
/**
* Add content to the WC emails.
*
* @access public
* @param WC_Order $order
* @param bool $sent_to_admin
* @param bool $plain_text
*/
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
if ( $this->instructions && ! $sent_to_admin && 'cod' === $order->payment_method ) {
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;

View File

@ -2,27 +2,27 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
@ -30,31 +30,31 @@ require_once(dirname(__FILE__) . '/Simplify/Constants.php');
class Simplify
{
/**
* @var string $publicKey public API key used to authenticate requests.
*/
public static $publicKey;
/**
* @var string $publicKey public API key used to authenticate requests.
*/
public static $publicKey;
/**
* @var string $privateKey private API key used to authenticate requests.
*/
public static $privateKey;
/**
* @var string $privateKey private API key used to authenticate requests.
*/
public static $privateKey;
/**
* @var string $apiBaseLiveUrl URL of the live API endpoint
*/
public static $apiBaseLiveUrl = Simplify_Constants::API_BASE_LIVE_URL;
/**
* @var string $apiBaseLiveUrl URL of the live API endpoint
*/
public static $apiBaseLiveUrl = Simplify_Constants::API_BASE_LIVE_URL;
/**
* @var string $apiBaseSandboxUrl URL of the sandbox API endpoint
*/
public static $apiBaseSandboxUrl = Simplify_Constants::API_BASE_SANDBOX_URL;
/**
* @var string $apiBaseSandboxUrl URL of the sandbox API endpoint
*/
public static $apiBaseSandboxUrl = Simplify_Constants::API_BASE_SANDBOX_URL;
/**
* @var string $userAgent User-agent string send with requests.
*/
public static $userAgent = null;
/**
* @var string $userAgent User-agent string send with requests.
*/
public static $userAgent = null;
}

View File

@ -2,27 +2,27 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
@ -31,93 +31,93 @@
*/
class Simplify_AccessToken extends Simplify_Object {
public function __construct($hash) {
$this->setAll($hash);
}
public function __construct($hash) {
$this->setAll($hash);
}
/**
* Creates an OAuth access token
* @param $code - the authorisation code returned from the GET on /oauth/authorize
* @param $redirect_uri = this must be the redirect_uri set in the apps configuration
* @param $authentication - Authentication information to access the API. If not value is passed the global key Simplify::$publicKey and Simplify::$privateKey are used
* @return Simplify_AccessToken
*/
public static function create($code, $redirect_uri, $authentication = null) {
/**
* Creates an OAuth access token
* @param $code - the authorisation code returned from the GET on /oauth/authorize
* @param $redirect_uri = this must be the redirect_uri set in the apps configuration
* @param $authentication - Authentication information to access the API. If not value is passed the global key Simplify::$publicKey and Simplify::$privateKey are used
* @return Simplify_AccessToken
*/
public static function create($code, $redirect_uri, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 3);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 3);
$props = 'code='.$code.'&redirect_uri='.$redirect_uri.'&grant_type=authorization_code';
$resp = Simplify_AccessToken::sendRequest($props, "token", $authentication);
$props = 'code='.$code.'&redirect_uri='.$redirect_uri.'&grant_type=authorization_code';
$resp = Simplify_AccessToken::sendRequest($props, "token", $authentication);
return new Simplify_AccessToken($resp);
}
return new Simplify_AccessToken($resp);
}
/**
* Refreshes the current token. The access_token and refresh_token values will be updated.
* @param $authentication - Authentication information to access the API. If not value is passed the global key Simplify::$publicKey and Simplify::$privateKey are used
* @return Simplify_AccessToken
* @throws InvalidArgumentException
*/
public function refresh($authentication = null) {
/**
* Refreshes the current token. The access_token and refresh_token values will be updated.
* @param $authentication - Authentication information to access the API. If not value is passed the global key Simplify::$publicKey and Simplify::$privateKey are used
* @return Simplify_AccessToken
* @throws InvalidArgumentException
*/
public function refresh($authentication = null) {
$refresh_token = $this->refresh_token;
if (empty($refresh_token)){
throw new InvalidArgumentException('Cannot refresh access token; refresh token is invalid');
}
$refresh_token = $this->refresh_token;
if (empty($refresh_token)){
throw new InvalidArgumentException('Cannot refresh access token; refresh token is invalid');
}
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$props = 'refresh_token='.$refresh_token.'&grant_type=refresh_token';
$resp = Simplify_AccessToken::sendRequest($props, "token", $authentication);
$props = 'refresh_token='.$refresh_token.'&grant_type=refresh_token';
$resp = Simplify_AccessToken::sendRequest($props, "token", $authentication);
$this->setAll($resp);
$this->setAll($resp);
return $this;
}
return $this;
}
/**
* <p>Revokes a token from further use.
* @param $authentication - Authentication information to access the API. If not value is passed the global key Simplify::$publicKey and Simplify::$privateKey are used
* @return Simplify_AccessToken
* @throws InvalidArgumentException
*/
public function revoke($authentication = null) {
/**
* <p>Revokes a token from further use.
* @param $authentication - Authentication information to access the API. If not value is passed the global key Simplify::$publicKey and Simplify::$privateKey are used
* @return Simplify_AccessToken
* @throws InvalidArgumentException
*/
public function revoke($authentication = null) {
$access_token = $this->access_token;
if (empty($access_token)){
throw new InvalidArgumentException('Cannot revoke access token; access token is invalid');
}
$access_token = $this->access_token;
if (empty($access_token)){
throw new InvalidArgumentException('Cannot revoke access token; access token is invalid');
}
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$props = 'token='.$access_token.'';
$props = 'token='.$access_token.'';
Simplify_AccessToken::sendRequest($props, "revoke", $authentication);
Simplify_AccessToken::sendRequest($props, "revoke", $authentication);
$this->access_token = null;
$this->refresh_token = null;
$this->redirect_uri = null;
$this->access_token = null;
$this->refresh_token = null;
$this->redirect_uri = null;
return $this;
}
return $this;
}
private static function sendRequest($props, $context, $authentication){
private static function sendRequest($props, $context, $authentication){
$url = Simplify_Constants::OAUTH_BASE_URL.'/'.$context;
$http = new Simplify_HTTP();
$resp = $http->oauthRequest($url, $props, $authentication);
$url = Simplify_Constants::OAUTH_BASE_URL.'/'.$context;
$http = new Simplify_HTTP();
$resp = $http->oauthRequest($url, $props, $authentication);
return $resp;
}
return $resp;
}
/**
* @ignore
*/
static public function getClazz() {
return "AccessToken";
}
/**
* @ignore
*/
static public function getClazz() {
return "AccessToken";
}
}

View File

@ -2,27 +2,27 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
@ -35,36 +35,36 @@
*/
class Simplify_Authentication {
public $privateKey;
public $publicKey;
public $accessToken;
public $privateKey;
public $publicKey;
public $accessToken;
function __construct() {
$args = func_get_args();
switch( func_num_args() ) {
case 1:
self::__construct1( $args[0] );
break;
case 2:
self::__construct2( $args[0], $args[1] );
break;
case 3:
self::__construct3( $args[0], $args[1], $args[2] );
}
}
function __construct() {
$args = func_get_args();
switch( func_num_args() ) {
case 1:
self::__construct1( $args[0] );
break;
case 2:
self::__construct2( $args[0], $args[1] );
break;
case 3:
self::__construct3( $args[0], $args[1], $args[2] );
}
}
function __construct1($accessToken) {
$this->accessToken = $accessToken;
}
function __construct1($accessToken) {
$this->accessToken = $accessToken;
}
function __construct2($publicKey, $privateKey) {
$this->publicKey = $publicKey;
$this->privateKey = $privateKey;
}
function __construct2($publicKey, $privateKey) {
$this->publicKey = $publicKey;
$this->privateKey = $privateKey;
}
function __construct3($publicKey, $privateKey, $accessToken) {
$this->publicKey = $publicKey;
$this->privateKey = $privateKey;
$this->accessToken = $accessToken;
}
}
function __construct3($publicKey, $privateKey, $accessToken) {
$this->publicKey = $publicKey;
$this->privateKey = $privateKey;
$this->accessToken = $accessToken;
}
}

View File

@ -2,137 +2,137 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Authorization extends Simplify_Object {
/**
* Creates an Simplify_Authorization object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD <strong>required </strong></dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 characters in length and only contains numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as it appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the transaction. Must match the currency associated with your account. [default: USD] <strong>required </strong></dd>
* <dt><tt>customer</tt></dt> <dd>ID of customer. If specified, card on file of customer will be used. </dd>
* <dt><tt>description</tt></dt> <dd>Free form text field to be used as a description of the payment. This field is echoed back with the payment on any find or list operations. [max length: 1024] </dd>
* <dt><tt>reference</tt></dt> <dd>Custom reference field to be used with outside systems. </dd>
* <dt><tt>replayId</tt></dt> <dd>An identifier that can be sent to uniquely identify a payment request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your payments. If supplied, we will check for a payment on your account that matches this identifier, and if one is found we will attempt to return an identical response of the original request. [max length: 50, min length: 1] </dd>
* <dt><tt>statementDescription.name</tt></dt> <dd>Merchant name <strong>required </strong></dd>
* <dt><tt>statementDescription.phoneNumber</tt></dt> <dd>Merchant contact phone number. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be used. [max length: 255] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Authorization a Authorization object.
*/
static public function createAuthorization($hash, $authentication = null) {
/**
* Creates an Simplify_Authorization object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD <strong>required </strong></dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 characters in length and only contains numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as it appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the transaction. Must match the currency associated with your account. [default: USD] <strong>required </strong></dd>
* <dt><tt>customer</tt></dt> <dd>ID of customer. If specified, card on file of customer will be used. </dd>
* <dt><tt>description</tt></dt> <dd>Free form text field to be used as a description of the payment. This field is echoed back with the payment on any find or list operations. [max length: 1024] </dd>
* <dt><tt>reference</tt></dt> <dd>Custom reference field to be used with outside systems. </dd>
* <dt><tt>replayId</tt></dt> <dd>An identifier that can be sent to uniquely identify a payment request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your payments. If supplied, we will check for a payment on your account that matches this identifier, and if one is found we will attempt to return an identical response of the original request. [max length: 50, min length: 1] </dd>
* <dt><tt>statementDescription.name</tt></dt> <dd>Merchant name <strong>required </strong></dd>
* <dt><tt>statementDescription.phoneNumber</tt></dt> <dd>Merchant contact phone number. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be used. [max length: 255] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Authorization a Authorization object.
*/
static public function createAuthorization($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Authorization();
$instance->setAll($hash);
$instance = new Simplify_Authorization();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Authorization object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteAuthorization($authentication = null) {
/**
* Deletes an Simplify_Authorization object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteAuthorization($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Authorization objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in pagination of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> id</tt><tt> description</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Authorization objects and the total
* number of Authorization objects available for the given criteria.
* @see ResourceList
*/
static public function listAuthorization($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Authorization objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in pagination of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> id</tt><tt> description</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Authorization objects and the total
* number of Authorization objects available for the given criteria.
* @see ResourceList
*/
static public function listAuthorization($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Authorization();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Authorization();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Authorization object from the API
*
* @param string id the id of the Authorization object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Authorization a Authorization object
*/
static public function findAuthorization($id, $authentication = null) {
/**
* Retrieve a Simplify_Authorization object from the API
*
* @param string id the id of the Authorization object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Authorization a Authorization object
*/
static public function findAuthorization($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Authorization();
$val->id = $id;
$val = new Simplify_Authorization();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* @ignore
*/
public function getClazz() {
return "Authorization";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Authorization";
}
}

View File

@ -2,89 +2,89 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_CardToken extends Simplify_Object {
/**
* Creates an Simplify_CardToken object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>callback</tt></dt> <dd>The URL callback for the cardtoken </dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>key</tt></dt> <dd>Key used to create the card token. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return CardToken a CardToken object.
*/
static public function createCardToken($hash, $authentication = null) {
/**
* Creates an Simplify_CardToken object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>callback</tt></dt> <dd>The URL callback for the cardtoken </dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>key</tt></dt> <dd>Key used to create the card token. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return CardToken a CardToken object.
*/
static public function createCardToken($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_CardToken();
$instance->setAll($hash);
$instance = new Simplify_CardToken();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Retrieve a Simplify_CardToken object from the API
*
* @param string id the id of the CardToken object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return CardToken a CardToken object
*/
static public function findCardToken($id, $authentication = null) {
/**
* Retrieve a Simplify_CardToken object from the API
*
* @param string id the id of the CardToken object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return CardToken a CardToken object
*/
static public function findCardToken($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_CardToken();
$val->id = $id;
$val = new Simplify_CardToken();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* @ignore
*/
public function getClazz() {
return "CardToken";
}
}
/**
* @ignore
*/
public function getClazz() {
return "CardToken";
}
}

View File

@ -2,81 +2,81 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Chargeback extends Simplify_Object {
/**
* Retrieve Simplify_Chargeback objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Chargeback objects and the total
* number of Chargeback objects available for the given criteria.
* @see ResourceList
*/
static public function listChargeback($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Chargeback objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Chargeback objects and the total
* number of Chargeback objects available for the given criteria.
* @see ResourceList
*/
static public function listChargeback($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Chargeback();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Chargeback();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Chargeback object from the API
*
* @param string id the id of the Chargeback object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Chargeback a Chargeback object
*/
static public function findChargeback($id, $authentication = null) {
/**
* Retrieve a Simplify_Chargeback object from the API
*
* @param string id the id of the Chargeback object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Chargeback a Chargeback object
*/
static public function findChargeback($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Chargeback();
$val->id = $id;
$val = new Simplify_Chargeback();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* @ignore
*/
public function getClazz() {
return "Chargeback";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Chargeback";
}
}

View File

@ -32,23 +32,23 @@
*/
class Simplify_Constants
{
/**
* @var string VERSION SDK version information.
*/
const VERSION = '1.2.0';
/**
* @var string VERSION SDK version information.
*/
const VERSION = '1.2.0';
/**
* @var string API_BASE_LIVE_URL URL for the live API endpoint
*/
const API_BASE_LIVE_URL = 'https://api.simplify.com/v1/api';
/**
* @var string API_BASE_LIVE_URL URL for the live API endpoint
*/
const API_BASE_LIVE_URL = 'https://api.simplify.com/v1/api';
/**
* @var string API_BASE_SANDBOX_URL URL for the sandbox API endpoint
*/
const API_BASE_SANDBOX_URL = 'https://sandbox.simplify.com/v1/api';
/**
* @var string API_BASE_SANDBOX_URL URL for the sandbox API endpoint
*/
const API_BASE_SANDBOX_URL = 'https://sandbox.simplify.com/v1/api';
/**
* @var string OAUTH_BASE_URL URL for the oauth enpoint
*/
const OAUTH_BASE_URL = 'https://www.simplify.com/commerce/oauth';
/**
* @var string OAUTH_BASE_URL URL for the oauth enpoint
*/
const OAUTH_BASE_URL = 'https://www.simplify.com/commerce/oauth';
}

View File

@ -2,146 +2,146 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Coupon extends Simplify_Object {
/**
* Creates an Simplify_Coupon object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amountOff</tt></dt> <dd>Amount off of the price of the product in the smallest units of the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00USD [min value: 1] </dd>
* <dt><tt>couponCode</tt></dt> <dd>Code that identifies the coupon to be used. [min length: 2] <strong>required </strong></dd>
* <dt><tt>description</tt></dt> <dd>A brief section that describes the coupon. </dd>
* <dt><tt>durationInMonths</tt></dt> <dd>DEPRECATED - Duration in months that the coupon will be applied after it has first been selected. [min value: 1, max value: 9999] </dd>
* <dt><tt>endDate</tt></dt> <dd>Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone. </dd>
* <dt><tt>maxRedemptions</tt></dt> <dd>Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1] </dd>
* <dt><tt>numTimesApplied</tt></dt> <dd>The number of times a coupon will be applied on a customer's subscription. [min value: 1, max value: 9999] </dd>
* <dt><tt>percentOff</tt></dt> <dd>Percentage off of the price of the product. While this field is optional, you must provide either amountOff or percentOff for a coupon. The percent off is a whole number. [min value: 1, max value: 100] </dd>
* <dt><tt>startDate</tt></dt> <dd>First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone. <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Coupon a Coupon object.
*/
static public function createCoupon($hash, $authentication = null) {
/**
* Creates an Simplify_Coupon object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amountOff</tt></dt> <dd>Amount off of the price of the product in the smallest units of the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00USD [min value: 1] </dd>
* <dt><tt>couponCode</tt></dt> <dd>Code that identifies the coupon to be used. [min length: 2] <strong>required </strong></dd>
* <dt><tt>description</tt></dt> <dd>A brief section that describes the coupon. </dd>
* <dt><tt>durationInMonths</tt></dt> <dd>DEPRECATED - Duration in months that the coupon will be applied after it has first been selected. [min value: 1, max value: 9999] </dd>
* <dt><tt>endDate</tt></dt> <dd>Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone. </dd>
* <dt><tt>maxRedemptions</tt></dt> <dd>Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1] </dd>
* <dt><tt>numTimesApplied</tt></dt> <dd>The number of times a coupon will be applied on a customer's subscription. [min value: 1, max value: 9999] </dd>
* <dt><tt>percentOff</tt></dt> <dd>Percentage off of the price of the product. While this field is optional, you must provide either amountOff or percentOff for a coupon. The percent off is a whole number. [min value: 1, max value: 100] </dd>
* <dt><tt>startDate</tt></dt> <dd>First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone. <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Coupon a Coupon object.
*/
static public function createCoupon($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Coupon();
$instance->setAll($hash);
$instance = new Simplify_Coupon();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Coupon object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteCoupon($authentication = null) {
/**
* Deletes an Simplify_Coupon object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteCoupon($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Coupon objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> maxRedemptions</tt><tt> timesRedeemed</tt><tt> id</tt><tt> startDate</tt><tt> endDate</tt><tt> percentOff</tt><tt> couponCode</tt><tt> durationInMonths</tt><tt> numTimesApplied</tt><tt> amountOff</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Coupon objects and the total
* number of Coupon objects available for the given criteria.
* @see ResourceList
*/
static public function listCoupon($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Coupon objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> maxRedemptions</tt><tt> timesRedeemed</tt><tt> id</tt><tt> startDate</tt><tt> endDate</tt><tt> percentOff</tt><tt> couponCode</tt><tt> durationInMonths</tt><tt> numTimesApplied</tt><tt> amountOff</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Coupon objects and the total
* number of Coupon objects available for the given criteria.
* @see ResourceList
*/
static public function listCoupon($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Coupon();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Coupon();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Coupon object from the API
*
* @param string id the id of the Coupon object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Coupon a Coupon object
*/
static public function findCoupon($id, $authentication = null) {
/**
* Retrieve a Simplify_Coupon object from the API
*
* @param string id the id of the Coupon object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Coupon a Coupon object
*/
static public function findCoupon($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Coupon();
$val->id = $id;
$val = new Simplify_Coupon();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_Coupon object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>endDate</tt></dt> <dd>The ending date in UTC millis for the coupon. This must be after the starting date of the coupon. </dd>
* <dt><tt>maxRedemptions</tt></dt> <dd>Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Coupon a Coupon object.
*/
public function updateCoupon($authentication = null) {
/**
* Updates an Simplify_Coupon object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>endDate</tt></dt> <dd>The ending date in UTC millis for the coupon. This must be after the starting date of the coupon. </dd>
* <dt><tt>maxRedemptions</tt></dt> <dd>Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Coupon a Coupon object.
*/
public function updateCoupon($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "Coupon";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Coupon";
}
}

View File

@ -2,179 +2,179 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Customer extends Simplify_Object {
/**
* Creates an Simplify_Customer object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder <strong>required </strong></dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. <strong>required </strong></dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. <strong>required </strong></dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. <strong>required </strong></dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 <strong>required </strong></dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 <strong>required </strong></dd>
* <dt><tt>card.id</tt></dt> <dd>ID of card. Unused during customer create. </dd>
* <dt><tt>card.name</tt></dt> <dd>Name as appears on the card. <strong>required </strong></dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] </dd>
* <dt><tt>email</tt></dt> <dd>Email address of the customer <strong>required </strong></dd>
* <dt><tt>name</tt></dt> <dd>Customer name [min length: 2] <strong>required </strong></dd>
* <dt><tt>reference</tt></dt> <dd>Reference field for external applications use. </dd>
* <dt><tt>subscriptions.amount</tt></dt> <dd>Amount of payment in the smallest unit of your currency. Example: 100 = $1.00USD </dd>
* <dt><tt>subscriptions.billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>subscriptions.billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>subscriptions.coupon</tt></dt> <dd>Coupon associated with the subscription for the customer. </dd>
* <dt><tt>subscriptions.currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [default: USD] </dd>
* <dt><tt>subscriptions.customer</tt></dt> <dd>The customer ID to create the subscription for. Do not supply this when creating a customer. </dd>
* <dt><tt>subscriptions.frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". </dd>
* <dt><tt>subscriptions.frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. </dd>
* <dt><tt>subscriptions.name</tt></dt> <dd>Name describing subscription </dd>
* <dt><tt>subscriptions.plan</tt></dt> <dd>The plan ID that the subscription should be created from. </dd>
* <dt><tt>subscriptions.quantity</tt></dt> <dd>Quantity of the plan for the subscription. [min value: 1] </dd>
* <dt><tt>subscriptions.renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be used </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Customer a Customer object.
*/
static public function createCustomer($hash, $authentication = null) {
/**
* Creates an Simplify_Customer object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder <strong>required </strong></dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. <strong>required </strong></dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. <strong>required </strong></dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. <strong>required </strong></dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 <strong>required </strong></dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 <strong>required </strong></dd>
* <dt><tt>card.id</tt></dt> <dd>ID of card. Unused during customer create. </dd>
* <dt><tt>card.name</tt></dt> <dd>Name as appears on the card. <strong>required </strong></dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] </dd>
* <dt><tt>email</tt></dt> <dd>Email address of the customer <strong>required </strong></dd>
* <dt><tt>name</tt></dt> <dd>Customer name [min length: 2] <strong>required </strong></dd>
* <dt><tt>reference</tt></dt> <dd>Reference field for external applications use. </dd>
* <dt><tt>subscriptions.amount</tt></dt> <dd>Amount of payment in the smallest unit of your currency. Example: 100 = $1.00USD </dd>
* <dt><tt>subscriptions.billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>subscriptions.billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>subscriptions.coupon</tt></dt> <dd>Coupon associated with the subscription for the customer. </dd>
* <dt><tt>subscriptions.currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [default: USD] </dd>
* <dt><tt>subscriptions.customer</tt></dt> <dd>The customer ID to create the subscription for. Do not supply this when creating a customer. </dd>
* <dt><tt>subscriptions.frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". </dd>
* <dt><tt>subscriptions.frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. </dd>
* <dt><tt>subscriptions.name</tt></dt> <dd>Name describing subscription </dd>
* <dt><tt>subscriptions.plan</tt></dt> <dd>The plan ID that the subscription should be created from. </dd>
* <dt><tt>subscriptions.quantity</tt></dt> <dd>Quantity of the plan for the subscription. [min value: 1] </dd>
* <dt><tt>subscriptions.renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be used </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Customer a Customer object.
*/
static public function createCustomer($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Customer();
$instance->setAll($hash);
$instance = new Simplify_Customer();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Customer object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteCustomer($authentication = null) {
/**
* Deletes an Simplify_Customer object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteCustomer($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Customer objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> id</tt><tt> name</tt><tt> email</tt><tt> reference</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Customer objects and the total
* number of Customer objects available for the given criteria.
* @see ResourceList
*/
static public function listCustomer($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Customer objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> id</tt><tt> name</tt><tt> email</tt><tt> reference</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Customer objects and the total
* number of Customer objects available for the given criteria.
* @see ResourceList
*/
static public function listCustomer($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Customer();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Customer();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Customer object from the API
*
* @param string id the id of the Customer object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Customer a Customer object
*/
static public function findCustomer($id, $authentication = null) {
/**
* Retrieve a Simplify_Customer object from the API
*
* @param string id the id of the Customer object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Customer a Customer object
*/
static public function findCustomer($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Customer();
$val->id = $id;
$val = new Simplify_Customer();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_Customer object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. <strong>required </strong></dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. <strong>required </strong></dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. <strong>required </strong></dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 <strong>required </strong></dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 <strong>required </strong></dd>
* <dt><tt>card.id</tt></dt> <dd>ID of card. If present, card details for the customer will not be updated. If not present, the customer will be updated with the supplied card details. </dd>
* <dt><tt>card.name</tt></dt> <dd>Name as appears on the card. <strong>required </strong></dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] </dd>
* <dt><tt>email</tt></dt> <dd>Email address of the customer <strong>required </strong></dd>
* <dt><tt>name</tt></dt> <dd>Customer name [min length: 2] <strong>required </strong></dd>
* <dt><tt>reference</tt></dt> <dd>Reference field for external applications use. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be added to the customer </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Customer a Customer object.
*/
public function updateCustomer($authentication = null) {
/**
* Updates an Simplify_Customer object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. <strong>required </strong></dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. <strong>required </strong></dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. <strong>required </strong></dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. <strong>required </strong></dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 <strong>required </strong></dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 <strong>required </strong></dd>
* <dt><tt>card.id</tt></dt> <dd>ID of card. If present, card details for the customer will not be updated. If not present, the customer will be updated with the supplied card details. </dd>
* <dt><tt>card.name</tt></dt> <dd>Name as appears on the card. <strong>required </strong></dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] </dd>
* <dt><tt>email</tt></dt> <dd>Email address of the customer <strong>required </strong></dd>
* <dt><tt>name</tt></dt> <dd>Customer name [min length: 2] <strong>required </strong></dd>
* <dt><tt>reference</tt></dt> <dd>Reference field for external applications use. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be added to the customer </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Customer a Customer object.
*/
public function updateCustomer($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "Customer";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Customer";
}
}

View File

@ -2,81 +2,81 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Deposit extends Simplify_Object {
/**
* Retrieve Simplify_Deposit objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> amount</tt><tt> dateCreated</tt><tt> depositDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Deposit objects and the total
* number of Deposit objects available for the given criteria.
* @see ResourceList
*/
static public function listDeposit($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Deposit objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> amount</tt><tt> dateCreated</tt><tt> depositDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Deposit objects and the total
* number of Deposit objects available for the given criteria.
* @see ResourceList
*/
static public function listDeposit($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Deposit();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Deposit();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Deposit object from the API
*
* @param string id the id of the Deposit object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Deposit a Deposit object
*/
static public function findDeposit($id, $authentication = null) {
/**
* Retrieve a Simplify_Deposit object from the API
*
* @param string id the id of the Deposit object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Deposit a Deposit object
*/
static public function findDeposit($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Deposit();
$val->id = $id;
$val = new Simplify_Deposit();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* @ignore
*/
public function getClazz() {
return "Deposit";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Deposit";
}
}

View File

@ -2,63 +2,63 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Event extends Simplify_Object {
/**
* Creates an Event object
* @param array $hash A map of parameters; valid keys are:
* <dt><code>paylod</code></dt> <dd>The raw JWS payload. </dd> <strong>required</strong>
* <dt><code>url</code></dt> <dd>The URL for the webhook. If present it must match the URL registered for the webhook.</dd>
* @param $authentication Object that contains the API public and private keys. If null the values of the static
* Simplify::$publicKey and Simplify::$privateKey will be used.
* @return Payments_Event an Event object.
* @throws InvalidArgumentException
*/
static public function createEvent($hash, $authentication = null) {
/**
* Creates an Event object
* @param array $hash A map of parameters; valid keys are:
* <dt><code>paylod</code></dt> <dd>The raw JWS payload. </dd> <strong>required</strong>
* <dt><code>url</code></dt> <dd>The URL for the webhook. If present it must match the URL registered for the webhook.</dd>
* @param $authentication Object that contains the API public and private keys. If null the values of the static
* Simplify::$publicKey and Simplify::$privateKey will be used.
* @return Payments_Event an Event object.
* @throws InvalidArgumentException
*/
static public function createEvent($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$paymentsApi = new Simplify_PaymentsApi();
$paymentsApi = new Simplify_PaymentsApi();
$jsonObject = $paymentsApi->jwsDecode($hash, $authentication);
$jsonObject = $paymentsApi->jwsDecode($hash, $authentication);
if ($jsonObject['event'] == null) {
throw new InvalidArgumentException("Incorect data in webhook event");
}
if ($jsonObject['event'] == null) {
throw new InvalidArgumentException("Incorect data in webhook event");
}
return $paymentsApi->convertFromHashToObject($jsonObject['event'], self::getClazz());
}
return $paymentsApi->convertFromHashToObject($jsonObject['event'], self::getClazz());
}
/**
* @ignore
*/
static public function getClazz() {
return "Event";
}
}
/**
* @ignore
*/
static public function getClazz() {
return "Event";
}
}

View File

@ -2,27 +2,27 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
@ -35,82 +35,82 @@
class Simplify_ApiException extends Exception
{
protected $errorData;
protected $status;
protected $errorCode;
protected $reference;
protected $errorData;
protected $status;
protected $errorCode;
protected $reference;
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message);
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message);
$this->status = $status;
$this->errorCode = null;
$this->reference = null;
$this->status = $status;
$this->errorCode = null;
$this->reference = null;
if ($errorData != null) {
$this->reference = $errorData['reference'];
$this->errorData = $errorData;
if ($errorData != null) {
$error = $errorData['error'];
if ($error != null) {
$m = $error['message'];
if ($m != null) {
$this->message = $m;
}
$this->reference = $errorData['reference'];
$this->errorData = $errorData;
$this->errorCode = $error['code'];
}
}
}
/**
* Returns a map of all error data returned by the API.
* @return array a map containing API error data.
*/
function getErrorData() {
return $this->errorData;
}
$error = $errorData['error'];
if ($error != null) {
/**
* Returns the HTTP status for the request.
* @return string HTTP status code (or null if there is no status).
*/
function getStatus() {
return $this->status;
}
/**
* Returns unique reference for the API error.
* @return string a reference (or null if there is no reference).
*/
function getReference() {
return $this->reference;
}
$m = $error['message'];
if ($m != null) {
$this->message = $m;
}
/**
* Returns an code for the API error.
* @return string the error code.
*/
function getErrorCode() {
return $this->errorCode;
}
$this->errorCode = $error['code'];
}
}
}
/**
* Returns a description of the error.
* @return string Description of the error.
*/
function describe() {
return get_class($this) . ": \""
. $this->getMessage() . "\" (status: "
. $this->getStatus() . ", error code: "
. $this->getErrorCode() . ", reference: "
. $this->getReference() . ")";
}
/**
* Returns a map of all error data returned by the API.
* @return array a map containing API error data.
*/
function getErrorData() {
return $this->errorData;
}
/**
* Returns the HTTP status for the request.
* @return string HTTP status code (or null if there is no status).
*/
function getStatus() {
return $this->status;
}
/**
* Returns unique reference for the API error.
* @return string a reference (or null if there is no reference).
*/
function getReference() {
return $this->reference;
}
/**
* Returns an code for the API error.
* @return string the error code.
*/
function getErrorCode() {
return $this->errorCode;
}
/**
* Returns a description of the error.
* @return string Description of the error.
*/
function describe() {
return get_class($this) . ": \""
. $this->getMessage() . "\" (status: "
. $this->getStatus() . ", error code: "
. $this->getErrorCode() . ", reference: "
. $this->getReference() . ")";
}
}
@ -120,12 +120,12 @@ class Simplify_ApiException extends Exception
*/
class Simplify_ApiConnectionException extends Simplify_ApiException {
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
}
/**
@ -133,12 +133,12 @@ class Simplify_ApiConnectionException extends Simplify_ApiException {
*/
class Simplify_AuthenticationException extends Simplify_ApiException {
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
}
/**
@ -146,57 +146,57 @@ class Simplify_AuthenticationException extends Simplify_ApiException {
*/
class Simplify_BadRequestException extends Simplify_ApiException {
protected $fieldErrors;
protected $fieldErrors;
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
$fieldErrors = array();
$fieldErrors = array();
if ($errorData != null) {
$error = $errorData['error'];
if ($error != null) {
$fieldErrors = $error['fieldErrors'];
if ($fieldErrors != null) {
$this->fieldErrors = array();
foreach ($fieldErrors as $fieldError) {
array_push($this->fieldErrors, new Simplify_FieldError($fieldError));
}
}
}
}
}
if ($errorData != null) {
$error = $errorData['error'];
if ($error != null) {
$fieldErrors = $error['fieldErrors'];
if ($fieldErrors != null) {
$this->fieldErrors = array();
foreach ($fieldErrors as $fieldError) {
array_push($this->fieldErrors, new Simplify_FieldError($fieldError));
}
}
}
}
}
/**
* Returns a boolean indicating whether there are any field errors.
* @return boolean true if there are field errors; false otherwise.
*/
function hasFieldErrors() {
return count($this->fieldErrors) > 0;
}
/**
* Returns a boolean indicating whether there are any field errors.
* @return boolean true if there are field errors; false otherwise.
*/
function hasFieldErrors() {
return count($this->fieldErrors) > 0;
}
/**
* Returns a list containing all field errors.
* @return array list of field errors.
*/
function getFieldErrors() {
return $this->fieldErrors;
}
/**
* Returns a list containing all field errors.
* @return array list of field errors.
*/
function getFieldErrors() {
return $this->fieldErrors;
}
/**
* Returns a description of the error.
* @return string description of the error.
*/
function describe() {
$s = parent::describe();
foreach ($this->getFieldErrors() as $fieldError) {
$s = $s . "\n" . (string) $fieldError;
}
return $s . "\n";
}
/**
* Returns a description of the error.
* @return string description of the error.
*/
function describe() {
$s = parent::describe();
foreach ($this->getFieldErrors() as $fieldError) {
$s = $s . "\n" . (string) $fieldError;
}
return $s . "\n";
}
}
@ -205,48 +205,48 @@ class Simplify_BadRequestException extends Simplify_ApiException {
*/
class Simplify_FieldError {
protected $field;
protected $code;
protected $message;
protected $field;
protected $code;
protected $message;
/**
* @ignore
*/
function __construct($errorData) {
$this->field = $errorData['field'];
$this->code = $errorData['code'];
$this->message = $errorData['message'];
}
/**
* @ignore
*/
function __construct($errorData) {
/**
* Returns the name of the field with the error.
* @return string the field name.
*/
function getFieldName() {
return $this->field;
}
$this->field = $errorData['field'];
$this->code = $errorData['code'];
$this->message = $errorData['message'];
}
/**
* Returns the code for the error.
* @return string the error code.
*/
function getErrorCode() {
return $this->code;
}
/**
* Returns the name of the field with the error.
* @return string the field name.
*/
function getFieldName() {
return $this->field;
}
/**
* Returns a description of the error.
* @return string description of the error.
*/
function getMessage() {
return $this->message;
}
/**
* Returns the code for the error.
* @return string the error code.
*/
function getErrorCode() {
return $this->code;
}
/**
* Returns a description of the error.
* @return string description of the error.
*/
function getMessage() {
return $this->message;
}
function __toString() {
return "Field error: " . $this->getFieldName() . "\"" . $this->getMessage() . "\" (" . $this->getErrorCode() . ")";
}
function __toString() {
return "Field error: " . $this->getFieldName() . "\"" . $this->getMessage() . "\" (" . $this->getErrorCode() . ")";
}
}
@ -255,12 +255,12 @@ class Simplify_FieldError {
*/
class Simplify_ObjectNotFoundException extends Simplify_ApiException {
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
}
/**
@ -268,12 +268,12 @@ class Simplify_ObjectNotFoundException extends Simplify_ApiException {
*/
class Simplify_NotAllowedException extends Simplify_ApiException {
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
}
/**
@ -281,10 +281,10 @@ class Simplify_NotAllowedException extends Simplify_ApiException {
*/
class Simplify_SystemException extends Simplify_ApiException {
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
/**
* @ignore
*/
function __construct($message, $status = null, $errorData = null) {
parent::__construct($message, $status, $errorData);
}
}

View File

@ -2,117 +2,117 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_FraudCheck extends Simplify_Object {
/**
* Creates an Simplify_FraudCheck object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the transaction to be checked for fraud (in the smallest unit of your currency). Example: 100 = $1.00USD </dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 characters in length and only contains numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as it appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the transaction to be checked for fraud. </dd>
* <dt><tt>description</tt></dt> <dd>- Description of the fraud check. </dd>
* <dt><tt>mode</tt></dt> <dd>Fraud check mode. “simple” only does an AVS and CVC check; “advanced” does a complete fraud check, running the input against the set up rules. [valid values: simple, advanced, full] <strong>required </strong></dd>
* <dt><tt>sessionId</tt></dt> <dd>Session ID usd during data collection. [max length: 255] </dd>
* <dt><tt>token</tt></dt> <dd>Description </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return FraudCheck a FraudCheck object.
*/
static public function createFraudCheck($hash, $authentication = null) {
/**
* Creates an Simplify_FraudCheck object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the transaction to be checked for fraud (in the smallest unit of your currency). Example: 100 = $1.00USD </dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 characters in length and only contains numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as it appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the transaction to be checked for fraud. </dd>
* <dt><tt>description</tt></dt> <dd>- Description of the fraud check. </dd>
* <dt><tt>mode</tt></dt> <dd>Fraud check mode. “simple” only does an AVS and CVC check; “advanced” does a complete fraud check, running the input against the set up rules. [valid values: simple, advanced, full] <strong>required </strong></dd>
* <dt><tt>sessionId</tt></dt> <dd>Session ID usd during data collection. [max length: 255] </dd>
* <dt><tt>token</tt></dt> <dd>Description </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return FraudCheck a FraudCheck object.
*/
static public function createFraudCheck($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_FraudCheck();
$instance->setAll($hash);
$instance = new Simplify_FraudCheck();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Retrieve Simplify_FraudCheck objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Allows for ascending or descending sorting of the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: .</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of FraudCheck objects and the total
* number of FraudCheck objects available for the given criteria.
* @see ResourceList
*/
static public function listFraudCheck($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_FraudCheck objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Allows for ascending or descending sorting of the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: .</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of FraudCheck objects and the total
* number of FraudCheck objects available for the given criteria.
* @see ResourceList
*/
static public function listFraudCheck($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_FraudCheck();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_FraudCheck();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_FraudCheck object from the API
*
* @param string id the id of the FraudCheck object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return FraudCheck a FraudCheck object
*/
static public function findFraudCheck($id, $authentication = null) {
/**
* Retrieve a Simplify_FraudCheck object from the API
*
* @param string id the id of the FraudCheck object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return FraudCheck a FraudCheck object
*/
static public function findFraudCheck($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_FraudCheck();
$val->id = $id;
$val = new Simplify_FraudCheck();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* @ignore
*/
public function getClazz() {
return "FraudCheck";
}
}
/**
* @ignore
*/
public function getClazz() {
return "FraudCheck";
}
}

View File

@ -29,379 +29,379 @@
class Simplify_HTTP
{
const DELETE = "DELETE";
const GET = "GET";
const POST = "POST";
const PUT = "PUT";
const HTTP_SUCCESS = 200;
const HTTP_REDIRECTED = 302;
const HTTP_UNAUTHORIZED = 401;
const HTTP_NOT_FOUND = 404;
const HTTP_NOT_ALLOWED = 405;
const HTTP_BAD_REQUEST = 400;
const JWS_NUM_HEADERS = 7;
const JWS_ALGORITHM = 'HS256';
const JWS_TYPE = 'JWS';
const JWS_HDR_UNAME = 'uname';
const JWS_HDR_URI = 'api.simplifycommerce.com/uri';
const JWS_HDR_TIMESTAMP = 'api.simplifycommerce.com/timestamp';
const JWS_HDR_NONCE = 'api.simplifycommerce.com/nonce';
const JWS_HDR_TOKEN = 'api.simplifycommerce.com/token';
const JWS_MAX_TIMESTAMP_DIFF = 300; // 5 minutes in seconds
static private $_validMethods = array(
"post" => self::POST,
"put" => self::PUT,
"get" => self::GET,
"delete" => self::DELETE);
private function request($url, $method, $authentication, $payload = '')
{
if ($authentication->publicKey == null) {
throw new InvalidArgumentException('Must have a valid public key to connect to the API');
}
if ($authentication->privateKey == null) {
throw new InvalidArgumentException('Must have a valid API key to connect to the API');
}
if (!array_key_exists(strtolower($method), self::$_validMethods)) {
throw new InvalidArgumentException('Invalid method: '.strtolower($method));
}
$method = self::$_validMethods[strtolower($method)];
$curl = curl_init();
$options = array();
$options[CURLOPT_URL] = $url;
$options[CURLOPT_CUSTOMREQUEST] = $method;
$options[CURLOPT_RETURNTRANSFER] = true;
$options[CURLOPT_FAILONERROR] = false;
$signature = $this->jwsEncode($authentication, $url, $payload, $method == self::POST || $method == self::PUT);
if ($method == self::POST || $method == self::PUT) {
$headers = array(
'Content-type: application/json'
);
$options[CURLOPT_POSTFIELDS] = $signature;
} else {
$headers = array(
'Authorization: JWS ' . $signature
);
}
array_push($headers, 'Accept: application/json');
$user_agent = 'PHP-SDK/' . Simplify_Constants::VERSION;
if (Simplify::$userAgent != null) {
$user_agent = $user_agent . ' ' . Simplify::$userAgent;
}
array_push($headers, 'User-Agent: ' . $user_agent);
$options[CURLOPT_HTTPHEADER] = $headers;
curl_setopt_array($curl, $options);
$data = curl_exec($curl);
$errno = curl_errno($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($data == false || $errno != CURLE_OK) {
throw new Simplify_ApiConnectionException(curl_error($curl));
}
$object = json_decode($data, true);
//'typ' => self::JWS_TYPE,
$response = array('status' => $status, 'object' => $object);
return $response;
curl_close($curl);
}
/**
* Handles Simplify API requests
*
* @param $url
* @param $method
* @param $authentication
* @param string $payload
* @return mixed
* @throws Simplify_AuthenticationException
* @throws Simplify_ObjectNotFoundException
* @throws Simplify_BadRequestException
* @throws Simplify_NotAllowedException
* @throws Simplify_SystemException
*/
public function apiRequest($url, $method, $authentication, $payload = ''){
$response = $this->request($url, $method, $authentication, $payload);
$status = $response['status'];
$object = $response['object'];
if ($status == self::HTTP_SUCCESS) {
return $object;
}
if ($status == self::HTTP_REDIRECTED) {
throw new Simplify_BadRequestException("Unexpected response code returned from the API, have you got the correct URL?", $status, $object);
} else if ($status == self::HTTP_BAD_REQUEST) {
throw new Simplify_BadRequestException("Bad request", $status, $object);
} else if ($status == self::HTTP_UNAUTHORIZED) {
throw new Simplify_AuthenticationException("You are not authorized to make this request. Are you using the correct API keys?", $status, $object);
} else if ($status == self::HTTP_NOT_FOUND) {
throw new Simplify_ObjectNotFoundException("Object not found", $status, $object);
} else if ($status == self::HTTP_NOT_ALLOWED) {
throw new Simplify_NotAllowedException("Operation not allowed", $status, $object);
} else if ($status < 500) {
throw new Simplify_BadRequestException("Bad request", $status, $object);
}
throw new Simplify_SystemException("An unexpected error has been raised. Looks like there's something wrong at our end." , $status, $object);
}
/**
* Handles Simplify OAuth requests
*
* @param $url
* @param $payload
* @param $authentication
* @return mixed
* @throws Simplify_AuthenticationException
* @throws Simplify_ObjectNotFoundException
* @throws Simplify_BadRequestException
* @throws Simplify_NotAllowedException
* @throws Simplify_SystemException
*/
public function oauthRequest($url, $payload, $authentication){
$response = $this->request($url, Simplify_HTTP::POST, $authentication, $payload);
$status = $response['status'];
$object = $response['object'];
if ($status == self::HTTP_SUCCESS) {
return $object;
}
$error = $object['error'];
$error_description = $object['error_description'];
if ($status == self::HTTP_REDIRECTED) {
throw new Simplify_BadRequestException("Unexpected response code returned from the API, have you got the correct URL?", $status, $object);
} else if ($status == self::HTTP_BAD_REQUEST) {
if ( $error == 'invalid_request'){
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Error during OAuth request', $error, $error_description));
}else if ($error == 'unsupported_grant_type'){
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Unsupported grant type in OAuth request', $error, $error_description));
}else if ($error == 'invalid_scope'){
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Invalid scope in OAuth request', $error, $error_description));
}else{
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Unknown OAuth error', $error, $error_description));
}
//TODO: build BadRequestException error JSON
} else if ($status == self::HTTP_UNAUTHORIZED){
if ($error == 'access_denied'){
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Access denied for OAuth request', $error, $error_description));
}else if ($error == 'invalid_client'){
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Invalid client ID in OAuth request', $error, $error_description));
}else if ($error == 'unauthorized_client'){
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Unauthorized client in OAuth request', $error, $error_description));
}else{
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Unknown authentication error', $error, $error_description));
}
} else if ($status < 500) {
throw new Simplify_BadRequestException("Bad request", $status, $object);
}
throw new Simplify_SystemException("An unexpected error has been raised. Looks like there's something wrong at our end." , $status, $object);
}
public function jwsDecode($authentication, $hash)
{
if ($authentication->publicKey == null) {
throw new InvalidArgumentException('Must have a valid public key to connect to the API');
}
if ($authentication->privateKey == null) {
throw new InvalidArgumentException('Must have a valid API key to connect to the API');
}
if (!isset($hash['payload'])) {
throw new InvalidArgumentException('Event data is Missing payload');
}
$payload = trim($hash['payload']);
try {
$parts = explode('.', $payload);
if (count($parts) != 3) {
$this->jwsAuthError("Incorrectly formatted JWS message");
}
$headerStr = $this->jwsUrlSafeDecode64($parts[0]);
$bodyStr = $this->jwsUrlSafeDecode64($parts[1]);
$sigStr = $parts[2];
$url = null;
if (isset($hash['url'])) {
$url = $hash['url'];
}
$this->jwsVerifyHeader($headerStr, $url, $authentication->publicKey);
$msg = $parts[0] . "." . $parts[1];
if (!$this->jwsVerifySignature($authentication->privateKey, $msg, $sigStr)) {
$this->jwsAuthError("JWS signature does not match");
}
return $bodyStr;
} catch (ApiException $e) {
throw $e;
} catch (Exception $e) {
$this->jwsAuthError("Exception during JWS decoding: " . $e);
}
}
private function jwsEncode($authentication, $url, $payload, $hasPayload)
{
// TODO - better seeding of RNG
$jws_hdr = array('typ' => self::JWS_TYPE,
'alg' => self::JWS_ALGORITHM,
'kid' => $authentication->publicKey,
self::JWS_HDR_URI => $url,
self::JWS_HDR_TIMESTAMP => sprintf("%u000", round(microtime(true))),
self::JWS_HDR_NONCE => sprintf("%u", mt_rand()),
);
// add oauth token if provided
if ( !empty($authentication->accessToken) ){
$jws_hdr[self::JWS_HDR_TOKEN] = $authentication->accessToken;
}
$header = $this->jwsUrlSafeEncode64(json_encode($jws_hdr));
if ($hasPayload) {
$payload = $this->jwsUrlSafeEncode64($payload);
} else {
$payload = '';
}
$msg = $header . "." . $payload;
return $msg . "." . $this->jwsSign($authentication->privateKey, $msg);
}
private function jwsSign($privateKey, $msg) {
$decodedPrivateKey = $this->jwsUrlSafeDecode64($privateKey);
$sig = hash_hmac('sha256', $msg, $decodedPrivateKey, true);
return $this->jwsUrlSafeEncode64($sig);
}
private function jwsVerifyHeader($header, $url, $publicKey) {
$hdr = json_decode($header, true);
if (count($hdr) != self::JWS_NUM_HEADERS) {
$this->jwsAuthError("Incorrect number of JWS header parameters - found " . count($hdr) . " required " . self::JWS_NUM_HEADERS);
}
if ($hdr['alg'] != self::JWS_ALGORITHM) {
$this->jwsAuthError("Incorrect algorithm - found " . $hdr['alg'] . " required " . self::WS_ALGORITHM);
}
if ($hdr['typ'] != self::JWS_TYPE) {
$this->jwsAuthError("Incorrect type - found " . $hdr['typ'] . " required " . self::JWS_TYPE);
}
if ($hdr['kid'] == null) {
$this->jwsAuthError("Missing Key ID");
}
if ($hdr['kid'] != $publicKey) {
if ($this->isLiveKey($publicKey)) {
$this->jwsAuthError("Invalid Key ID");
}
}
if ($hdr[self::JWS_HDR_URI] == null) {
$this->jwsAuthError("Missing URI");
}
if ($url != null && $hdr[self::JWS_HDR_URI] != $url) {
$this->jwsAuthError("Incorrect URL - found " . $hdr[self::JWS_HDR_URI] . " required " . $url);
}
if ($hdr[self::JWS_HDR_TIMESTAMP] == null) {
$this->jwsAuthError("Missing timestamp");
}
if (!$this->jwsVerifyTimestamp($hdr[self::JWS_HDR_TIMESTAMP])) {
$this->jwsAuthError("Invalid timestamp");
}
if ($hdr[self::JWS_HDR_NONCE] == null) {
$this->jwsAuthError("Missing nonce");
}
if ($hdr[self::JWS_HDR_UNAME] == null) {
$this->jwsAuthError("Missing username");
}
}
private function jwsVerifySignature($privateKey, $msg, $expectedSig) {
return $this->jwsSign($privateKey, $msg) == $expectedSig;
}
private function jwsAuthError($reason) {
throw new Simplify_AuthenticationException("JWS authentication failure: " . $reason);
}
private function jwsVerifyTimestamp($ts) {
$now = round(microtime(true)); // Seconds
return abs($now - $ts / 1000) < self::JWS_MAX_TIMESTAMP_DIFF;
}
private function isLiveKey($k) {
return strpos($k, "lvpb") === 0;
}
private function jwsUrlSafeEncode64($s) {
return str_replace(array('+', '/', '='),
array('-', '_', ''),
base64_encode($s));
}
const DELETE = "DELETE";
const GET = "GET";
const POST = "POST";
const PUT = "PUT";
const HTTP_SUCCESS = 200;
const HTTP_REDIRECTED = 302;
const HTTP_UNAUTHORIZED = 401;
const HTTP_NOT_FOUND = 404;
const HTTP_NOT_ALLOWED = 405;
const HTTP_BAD_REQUEST = 400;
const JWS_NUM_HEADERS = 7;
const JWS_ALGORITHM = 'HS256';
const JWS_TYPE = 'JWS';
const JWS_HDR_UNAME = 'uname';
const JWS_HDR_URI = 'api.simplifycommerce.com/uri';
const JWS_HDR_TIMESTAMP = 'api.simplifycommerce.com/timestamp';
const JWS_HDR_NONCE = 'api.simplifycommerce.com/nonce';
const JWS_HDR_TOKEN = 'api.simplifycommerce.com/token';
const JWS_MAX_TIMESTAMP_DIFF = 300; // 5 minutes in seconds
static private $_validMethods = array(
"post" => self::POST,
"put" => self::PUT,
"get" => self::GET,
"delete" => self::DELETE);
private function request($url, $method, $authentication, $payload = '')
{
if ($authentication->publicKey == null) {
throw new InvalidArgumentException('Must have a valid public key to connect to the API');
}
if ($authentication->privateKey == null) {
throw new InvalidArgumentException('Must have a valid API key to connect to the API');
}
if (!array_key_exists(strtolower($method), self::$_validMethods)) {
throw new InvalidArgumentException('Invalid method: '.strtolower($method));
}
$method = self::$_validMethods[strtolower($method)];
$curl = curl_init();
$options = array();
$options[CURLOPT_URL] = $url;
$options[CURLOPT_CUSTOMREQUEST] = $method;
$options[CURLOPT_RETURNTRANSFER] = true;
$options[CURLOPT_FAILONERROR] = false;
$signature = $this->jwsEncode($authentication, $url, $payload, $method == self::POST || $method == self::PUT);
if ($method == self::POST || $method == self::PUT) {
$headers = array(
'Content-type: application/json'
);
$options[CURLOPT_POSTFIELDS] = $signature;
} else {
$headers = array(
'Authorization: JWS ' . $signature
);
}
array_push($headers, 'Accept: application/json');
$user_agent = 'PHP-SDK/' . Simplify_Constants::VERSION;
if (Simplify::$userAgent != null) {
$user_agent = $user_agent . ' ' . Simplify::$userAgent;
}
array_push($headers, 'User-Agent: ' . $user_agent);
$options[CURLOPT_HTTPHEADER] = $headers;
curl_setopt_array($curl, $options);
$data = curl_exec($curl);
$errno = curl_errno($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($data == false || $errno != CURLE_OK) {
throw new Simplify_ApiConnectionException(curl_error($curl));
}
$object = json_decode($data, true);
//'typ' => self::JWS_TYPE,
$response = array('status' => $status, 'object' => $object);
return $response;
curl_close($curl);
}
/**
* Handles Simplify API requests
*
* @param $url
* @param $method
* @param $authentication
* @param string $payload
* @return mixed
* @throws Simplify_AuthenticationException
* @throws Simplify_ObjectNotFoundException
* @throws Simplify_BadRequestException
* @throws Simplify_NotAllowedException
* @throws Simplify_SystemException
*/
public function apiRequest($url, $method, $authentication, $payload = ''){
$response = $this->request($url, $method, $authentication, $payload);
$status = $response['status'];
$object = $response['object'];
if ($status == self::HTTP_SUCCESS) {
return $object;
}
if ($status == self::HTTP_REDIRECTED) {
throw new Simplify_BadRequestException("Unexpected response code returned from the API, have you got the correct URL?", $status, $object);
} else if ($status == self::HTTP_BAD_REQUEST) {
throw new Simplify_BadRequestException("Bad request", $status, $object);
} else if ($status == self::HTTP_UNAUTHORIZED) {
throw new Simplify_AuthenticationException("You are not authorized to make this request. Are you using the correct API keys?", $status, $object);
} else if ($status == self::HTTP_NOT_FOUND) {
throw new Simplify_ObjectNotFoundException("Object not found", $status, $object);
} else if ($status == self::HTTP_NOT_ALLOWED) {
throw new Simplify_NotAllowedException("Operation not allowed", $status, $object);
} else if ($status < 500) {
throw new Simplify_BadRequestException("Bad request", $status, $object);
}
throw new Simplify_SystemException("An unexpected error has been raised. Looks like there's something wrong at our end." , $status, $object);
}
/**
* Handles Simplify OAuth requests
*
* @param $url
* @param $payload
* @param $authentication
* @return mixed
* @throws Simplify_AuthenticationException
* @throws Simplify_ObjectNotFoundException
* @throws Simplify_BadRequestException
* @throws Simplify_NotAllowedException
* @throws Simplify_SystemException
*/
public function oauthRequest($url, $payload, $authentication){
$response = $this->request($url, Simplify_HTTP::POST, $authentication, $payload);
$status = $response['status'];
$object = $response['object'];
if ($status == self::HTTP_SUCCESS) {
return $object;
}
$error = $object['error'];
$error_description = $object['error_description'];
if ($status == self::HTTP_REDIRECTED) {
throw new Simplify_BadRequestException("Unexpected response code returned from the API, have you got the correct URL?", $status, $object);
} else if ($status == self::HTTP_BAD_REQUEST) {
if ( $error == 'invalid_request'){
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Error during OAuth request', $error, $error_description));
}else if ($error == 'unsupported_grant_type'){
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Unsupported grant type in OAuth request', $error, $error_description));
}else if ($error == 'invalid_scope'){
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Invalid scope in OAuth request', $error, $error_description));
}else{
throw new Simplify_BadRequestException("", $status, $this->buildOauthError('Unknown OAuth error', $error, $error_description));
}
//TODO: build BadRequestException error JSON
} else if ($status == self::HTTP_UNAUTHORIZED){
if ($error == 'access_denied'){
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Access denied for OAuth request', $error, $error_description));
}else if ($error == 'invalid_client'){
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Invalid client ID in OAuth request', $error, $error_description));
}else if ($error == 'unauthorized_client'){
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Unauthorized client in OAuth request', $error, $error_description));
}else{
throw new Simplify_AuthenticationException("", $status, $this->buildOauthError('Unknown authentication error', $error, $error_description));
}
} else if ($status < 500) {
throw new Simplify_BadRequestException("Bad request", $status, $object);
}
throw new Simplify_SystemException("An unexpected error has been raised. Looks like there's something wrong at our end." , $status, $object);
}
public function jwsDecode($authentication, $hash)
{
if ($authentication->publicKey == null) {
throw new InvalidArgumentException('Must have a valid public key to connect to the API');
}
if ($authentication->privateKey == null) {
throw new InvalidArgumentException('Must have a valid API key to connect to the API');
}
if (!isset($hash['payload'])) {
throw new InvalidArgumentException('Event data is Missing payload');
}
$payload = trim($hash['payload']);
try {
$parts = explode('.', $payload);
if (count($parts) != 3) {
$this->jwsAuthError("Incorrectly formatted JWS message");
}
$headerStr = $this->jwsUrlSafeDecode64($parts[0]);
$bodyStr = $this->jwsUrlSafeDecode64($parts[1]);
$sigStr = $parts[2];
$url = null;
if (isset($hash['url'])) {
$url = $hash['url'];
}
$this->jwsVerifyHeader($headerStr, $url, $authentication->publicKey);
$msg = $parts[0] . "." . $parts[1];
if (!$this->jwsVerifySignature($authentication->privateKey, $msg, $sigStr)) {
$this->jwsAuthError("JWS signature does not match");
}
return $bodyStr;
} catch (ApiException $e) {
throw $e;
} catch (Exception $e) {
$this->jwsAuthError("Exception during JWS decoding: " . $e);
}
}
private function jwsEncode($authentication, $url, $payload, $hasPayload)
{
// TODO - better seeding of RNG
$jws_hdr = array('typ' => self::JWS_TYPE,
'alg' => self::JWS_ALGORITHM,
'kid' => $authentication->publicKey,
self::JWS_HDR_URI => $url,
self::JWS_HDR_TIMESTAMP => sprintf("%u000", round(microtime(true))),
self::JWS_HDR_NONCE => sprintf("%u", mt_rand()),
);
// add oauth token if provided
if ( !empty($authentication->accessToken) ){
$jws_hdr[self::JWS_HDR_TOKEN] = $authentication->accessToken;
}
$header = $this->jwsUrlSafeEncode64(json_encode($jws_hdr));
if ($hasPayload) {
$payload = $this->jwsUrlSafeEncode64($payload);
} else {
$payload = '';
}
$msg = $header . "." . $payload;
return $msg . "." . $this->jwsSign($authentication->privateKey, $msg);
}
private function jwsSign($privateKey, $msg) {
$decodedPrivateKey = $this->jwsUrlSafeDecode64($privateKey);
$sig = hash_hmac('sha256', $msg, $decodedPrivateKey, true);
return $this->jwsUrlSafeEncode64($sig);
}
private function jwsVerifyHeader($header, $url, $publicKey) {
$hdr = json_decode($header, true);
if (count($hdr) != self::JWS_NUM_HEADERS) {
$this->jwsAuthError("Incorrect number of JWS header parameters - found " . count($hdr) . " required " . self::JWS_NUM_HEADERS);
}
if ($hdr['alg'] != self::JWS_ALGORITHM) {
$this->jwsAuthError("Incorrect algorithm - found " . $hdr['alg'] . " required " . self::WS_ALGORITHM);
}
if ($hdr['typ'] != self::JWS_TYPE) {
$this->jwsAuthError("Incorrect type - found " . $hdr['typ'] . " required " . self::JWS_TYPE);
}
if ($hdr['kid'] == null) {
$this->jwsAuthError("Missing Key ID");
}
if ($hdr['kid'] != $publicKey) {
if ($this->isLiveKey($publicKey)) {
$this->jwsAuthError("Invalid Key ID");
}
}
if ($hdr[self::JWS_HDR_URI] == null) {
$this->jwsAuthError("Missing URI");
}
if ($url != null && $hdr[self::JWS_HDR_URI] != $url) {
$this->jwsAuthError("Incorrect URL - found " . $hdr[self::JWS_HDR_URI] . " required " . $url);
}
if ($hdr[self::JWS_HDR_TIMESTAMP] == null) {
$this->jwsAuthError("Missing timestamp");
}
if (!$this->jwsVerifyTimestamp($hdr[self::JWS_HDR_TIMESTAMP])) {
$this->jwsAuthError("Invalid timestamp");
}
if ($hdr[self::JWS_HDR_NONCE] == null) {
$this->jwsAuthError("Missing nonce");
}
if ($hdr[self::JWS_HDR_UNAME] == null) {
$this->jwsAuthError("Missing username");
}
}
private function jwsVerifySignature($privateKey, $msg, $expectedSig) {
return $this->jwsSign($privateKey, $msg) == $expectedSig;
}
private function jwsAuthError($reason) {
throw new Simplify_AuthenticationException("JWS authentication failure: " . $reason);
}
private function jwsVerifyTimestamp($ts) {
$now = round(microtime(true)); // Seconds
return abs($now - $ts / 1000) < self::JWS_MAX_TIMESTAMP_DIFF;
}
private function isLiveKey($k) {
return strpos($k, "lvpb") === 0;
}
private function jwsUrlSafeEncode64($s) {
return str_replace(array('+', '/', '='),
array('-', '_', ''),
base64_encode($s));
}
private function jwsUrlSafeDecode64($s) {
switch (strlen($s) % 4) {
case 0: break;
case 2: $s = $s . "==";
break;
case 3: $s = $s . "=";
break;
default: throw new InvalidArgumentException('incorrecly formatted JWS payload');
}
return base64_decode(str_replace(array('-', '_'), array('+', '/'), $s));
}
private function jwsUrlSafeDecode64($s) {
switch (strlen($s) % 4) {
case 0: break;
case 2: $s = $s . "==";
break;
case 3: $s = $s . "=";
break;
default: throw new InvalidArgumentException('incorrecly formatted JWS payload');
}
return base64_decode(str_replace(array('-', '_'), array('+', '/'), $s));
}
private function buildOauthError($msg, $error, $error_description){
return array(
'error' => array(
'code' => 'oauth_error',
'message' => $msg.', error code: '.$error.', description: '.$error_description.''
)
);
}
private function buildOauthError($msg, $error, $error_description){
return array(
'error' => array(
'code' => 'oauth_error',
'message' => $msg.', error code: '.$error.', description: '.$error_description.''
)
);
}
}

View File

@ -2,223 +2,223 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Invoice extends Simplify_Object {
/**
* Creates an Simplify_Invoice object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>billingAddress.city</tt></dt> <dd>Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>billingAddress.country</tt></dt> <dd>Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>billingAddress.line1</tt></dt> <dd>Billing address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.line2</tt></dt> <dd>Billing address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.name</tt></dt> <dd>Billing address name of the location where the goods or services were supplied. Will use the customer name if not provided. [max length: 255] </dd>
* <dt><tt>billingAddress.state</tt></dt> <dd>Billing address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.zip</tt></dt> <dd>Billing address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>businessAddress.city</tt></dt> <dd>Address city of the business that is sending the invoice. [max length: 255, min length: 2] </dd>
* <dt><tt>businessAddress.country</tt></dt> <dd>Address country of the business that is sending the invoice. [max length: 2, min length: 2] </dd>
* <dt><tt>businessAddress.line1</tt></dt> <dd>Address line 1 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.line2</tt></dt> <dd>Address line 2 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.name</tt></dt> <dd>The name of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.state</tt></dt> <dd>Address state of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.zip</tt></dt> <dd>Address zip of the business that is sending the invoice. [max length: 32] </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3, default: USD] </dd>
* <dt><tt>customer</tt></dt> <dd>The customer ID of the customer we are invoicing. This is optional if invoiceToCopy or a name and email are provided </dd>
* <dt><tt>customerTaxNo</tt></dt> <dd>The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>discountRate</tt></dt> <dd>The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6] </dd>
* <dt><tt>dueDate</tt></dt> <dd>The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past. </dd>
* <dt><tt>email</tt></dt> <dd>The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. </dd>
* <dt><tt>invoiceId</tt></dt> <dd>User defined invoice id. If not provided the system will generate a numeric id. [max length: 255] </dd>
* <dt><tt>invoiceToCopy</tt></dt> <dd>The id of an existing invoice to be copied. This is optional if customer or a name and email are provided </dd>
* <dt><tt>items.amount</tt></dt> <dd>Amount of the invoice item (the smallest unit of your currency). Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd>
* <dt><tt>items.description</tt></dt> <dd>The description of the invoice item. [max length: 1024] </dd>
* <dt><tt>items.invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd>
* <dt><tt>items.product</tt></dt> <dd>The product this invoice item refers to. </dd>
* <dt><tt>items.quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd>
* <dt><tt>items.reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>items.tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd>
* <dt><tt>lateFee</tt></dt> <dd>The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD [max value: 9999900] </dd>
* <dt><tt>memo</tt></dt> <dd>A memo that is displayed to the customer on the invoice payment screen. [max length: 4000] </dd>
* <dt><tt>name</tt></dt> <dd>The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2] </dd>
* <dt><tt>note</tt></dt> <dd>This field can be used to store a note that is not displayed to the customer. [max length: 4000] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>shippingAddress.city</tt></dt> <dd>Address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>shippingAddress.country</tt></dt> <dd>Address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>shippingAddress.line1</tt></dt> <dd>Address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.line2</tt></dt> <dd>Address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.name</tt></dt> <dd>Address name of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.state</tt></dt> <dd>Address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.zip</tt></dt> <dd>Address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>suppliedDate</tt></dt> <dd>The date on which the goods or services were supplied. </dd>
* <dt><tt>taxNo</tt></dt> <dd>The tax number or VAT id of the person who supplied the goods or services. [max length: 255] </dd>
* <dt><tt>type</tt></dt> <dd>The type of invoice. One of WEB or MOBILE. [valid values: WEB, MOBILE, default: WEB] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Invoice a Invoice object.
*/
static public function createInvoice($hash, $authentication = null) {
/**
* Creates an Simplify_Invoice object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>billingAddress.city</tt></dt> <dd>Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>billingAddress.country</tt></dt> <dd>Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>billingAddress.line1</tt></dt> <dd>Billing address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.line2</tt></dt> <dd>Billing address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.name</tt></dt> <dd>Billing address name of the location where the goods or services were supplied. Will use the customer name if not provided. [max length: 255] </dd>
* <dt><tt>billingAddress.state</tt></dt> <dd>Billing address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.zip</tt></dt> <dd>Billing address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>businessAddress.city</tt></dt> <dd>Address city of the business that is sending the invoice. [max length: 255, min length: 2] </dd>
* <dt><tt>businessAddress.country</tt></dt> <dd>Address country of the business that is sending the invoice. [max length: 2, min length: 2] </dd>
* <dt><tt>businessAddress.line1</tt></dt> <dd>Address line 1 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.line2</tt></dt> <dd>Address line 2 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.name</tt></dt> <dd>The name of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.state</tt></dt> <dd>Address state of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.zip</tt></dt> <dd>Address zip of the business that is sending the invoice. [max length: 32] </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3, default: USD] </dd>
* <dt><tt>customer</tt></dt> <dd>The customer ID of the customer we are invoicing. This is optional if invoiceToCopy or a name and email are provided </dd>
* <dt><tt>customerTaxNo</tt></dt> <dd>The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>discountRate</tt></dt> <dd>The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6] </dd>
* <dt><tt>dueDate</tt></dt> <dd>The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past. </dd>
* <dt><tt>email</tt></dt> <dd>The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. </dd>
* <dt><tt>invoiceId</tt></dt> <dd>User defined invoice id. If not provided the system will generate a numeric id. [max length: 255] </dd>
* <dt><tt>invoiceToCopy</tt></dt> <dd>The id of an existing invoice to be copied. This is optional if customer or a name and email are provided </dd>
* <dt><tt>items.amount</tt></dt> <dd>Amount of the invoice item (the smallest unit of your currency). Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd>
* <dt><tt>items.description</tt></dt> <dd>The description of the invoice item. [max length: 1024] </dd>
* <dt><tt>items.invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd>
* <dt><tt>items.product</tt></dt> <dd>The product this invoice item refers to. </dd>
* <dt><tt>items.quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd>
* <dt><tt>items.reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>items.tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd>
* <dt><tt>lateFee</tt></dt> <dd>The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD [max value: 9999900] </dd>
* <dt><tt>memo</tt></dt> <dd>A memo that is displayed to the customer on the invoice payment screen. [max length: 4000] </dd>
* <dt><tt>name</tt></dt> <dd>The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2] </dd>
* <dt><tt>note</tt></dt> <dd>This field can be used to store a note that is not displayed to the customer. [max length: 4000] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>shippingAddress.city</tt></dt> <dd>Address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>shippingAddress.country</tt></dt> <dd>Address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>shippingAddress.line1</tt></dt> <dd>Address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.line2</tt></dt> <dd>Address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.name</tt></dt> <dd>Address name of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.state</tt></dt> <dd>Address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.zip</tt></dt> <dd>Address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>suppliedDate</tt></dt> <dd>The date on which the goods or services were supplied. </dd>
* <dt><tt>taxNo</tt></dt> <dd>The tax number or VAT id of the person who supplied the goods or services. [max length: 255] </dd>
* <dt><tt>type</tt></dt> <dd>The type of invoice. One of WEB or MOBILE. [valid values: WEB, MOBILE, default: WEB] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Invoice a Invoice object.
*/
static public function createInvoice($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Invoice();
$instance->setAll($hash);
$instance = new Simplify_Invoice();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Invoice object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteInvoice($authentication = null) {
/**
* Deletes an Simplify_Invoice object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteInvoice($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Invoice objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> invoiceDate</tt><tt> dueDate</tt><tt> datePaid</tt><tt> customer</tt><tt> status</tt><tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Invoice objects and the total
* number of Invoice objects available for the given criteria.
* @see ResourceList
*/
static public function listInvoice($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Invoice objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> invoiceDate</tt><tt> dueDate</tt><tt> datePaid</tt><tt> customer</tt><tt> status</tt><tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Invoice objects and the total
* number of Invoice objects available for the given criteria.
* @see ResourceList
*/
static public function listInvoice($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Invoice();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Invoice();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Invoice object from the API
*
* @param string id the id of the Invoice object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Invoice a Invoice object
*/
static public function findInvoice($id, $authentication = null) {
/**
* Retrieve a Simplify_Invoice object from the API
*
* @param string id the id of the Invoice object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Invoice a Invoice object
*/
static public function findInvoice($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Invoice();
$val->id = $id;
$val = new Simplify_Invoice();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_Invoice object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>billingAddress.city</tt></dt> <dd>Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>billingAddress.country</tt></dt> <dd>Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>billingAddress.line1</tt></dt> <dd>Billing address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.line2</tt></dt> <dd>Billing address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.name</tt></dt> <dd>Billing address name of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.state</tt></dt> <dd>Billing address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.zip</tt></dt> <dd>Billing address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>businessAddress.city</tt></dt> <dd>Business address city of the business that is sending the invoice. [max length: 255, min length: 2] </dd>
* <dt><tt>businessAddress.country</tt></dt> <dd>Business address country of the business that is sending the invoice. [max length: 2, min length: 2] </dd>
* <dt><tt>businessAddress.line1</tt></dt> <dd>Business address line 1 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.line2</tt></dt> <dd>Business address line 2 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.name</tt></dt> <dd>Business address name of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.state</tt></dt> <dd>Business address state of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.zip</tt></dt> <dd>Business address zip of the business that is sending the invoice. [max length: 32] </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3] </dd>
* <dt><tt>customerTaxNo</tt></dt> <dd>The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>datePaid</tt></dt> <dd>This is the date the invoice was PAID in UTC millis. </dd>
* <dt><tt>discountRate</tt></dt> <dd>The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6] </dd>
* <dt><tt>dueDate</tt></dt> <dd>The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past. </dd>
* <dt><tt>email</tt></dt> <dd>The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. </dd>
* <dt><tt>invoiceId</tt></dt> <dd>User defined invoice id. If not provided the system will generate a numeric id. [max length: 255] </dd>
* <dt><tt>items.amount</tt></dt> <dd>Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd>
* <dt><tt>items.description</tt></dt> <dd>The description of the invoice item. [max length: 1024] </dd>
* <dt><tt>items.invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd>
* <dt><tt>items.product</tt></dt> <dd>The Id of the product this item refers to. </dd>
* <dt><tt>items.quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd>
* <dt><tt>items.reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>items.tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd>
* <dt><tt>lateFee</tt></dt> <dd>The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD [max value: 9999900] </dd>
* <dt><tt>memo</tt></dt> <dd>A memo that is displayed to the customer on the invoice payment screen. [max length: 4000] </dd>
* <dt><tt>name</tt></dt> <dd>The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2] </dd>
* <dt><tt>note</tt></dt> <dd>This field can be used to store a note that is not displayed to the customer. [max length: 4000] </dd>
* <dt><tt>payment</tt></dt> <dd>The ID of the payment. Use this ID to query the /payment API. [max length: 255] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>shippingAddress.city</tt></dt> <dd>Address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>shippingAddress.country</tt></dt> <dd>Address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>shippingAddress.line1</tt></dt> <dd>Address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.line2</tt></dt> <dd>Address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.name</tt></dt> <dd>Address name of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.state</tt></dt> <dd>Address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.zip</tt></dt> <dd>Address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>status</tt></dt> <dd>New status of the invoice. </dd>
* <dt><tt>suppliedDate</tt></dt> <dd>The date on which the goods or services were supplied. </dd>
* <dt><tt>taxNo</tt></dt> <dd>The tax number or VAT id of the person who supplied the goods or services. [max length: 255] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Invoice a Invoice object.
*/
public function updateInvoice($authentication = null) {
/**
* Updates an Simplify_Invoice object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>billingAddress.city</tt></dt> <dd>Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>billingAddress.country</tt></dt> <dd>Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>billingAddress.line1</tt></dt> <dd>Billing address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.line2</tt></dt> <dd>Billing address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.name</tt></dt> <dd>Billing address name of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.state</tt></dt> <dd>Billing address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>billingAddress.zip</tt></dt> <dd>Billing address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>businessAddress.city</tt></dt> <dd>Business address city of the business that is sending the invoice. [max length: 255, min length: 2] </dd>
* <dt><tt>businessAddress.country</tt></dt> <dd>Business address country of the business that is sending the invoice. [max length: 2, min length: 2] </dd>
* <dt><tt>businessAddress.line1</tt></dt> <dd>Business address line 1 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.line2</tt></dt> <dd>Business address line 2 of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.name</tt></dt> <dd>Business address name of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.state</tt></dt> <dd>Business address state of the business that is sending the invoice. [max length: 255] </dd>
* <dt><tt>businessAddress.zip</tt></dt> <dd>Business address zip of the business that is sending the invoice. [max length: 32] </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3] </dd>
* <dt><tt>customerTaxNo</tt></dt> <dd>The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>datePaid</tt></dt> <dd>This is the date the invoice was PAID in UTC millis. </dd>
* <dt><tt>discountRate</tt></dt> <dd>The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6] </dd>
* <dt><tt>dueDate</tt></dt> <dd>The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past. </dd>
* <dt><tt>email</tt></dt> <dd>The email of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. </dd>
* <dt><tt>invoiceId</tt></dt> <dd>User defined invoice id. If not provided the system will generate a numeric id. [max length: 255] </dd>
* <dt><tt>items.amount</tt></dt> <dd>Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd>
* <dt><tt>items.description</tt></dt> <dd>The description of the invoice item. [max length: 1024] </dd>
* <dt><tt>items.invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd>
* <dt><tt>items.product</tt></dt> <dd>The Id of the product this item refers to. </dd>
* <dt><tt>items.quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd>
* <dt><tt>items.reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>items.tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd>
* <dt><tt>lateFee</tt></dt> <dd>The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD [max value: 9999900] </dd>
* <dt><tt>memo</tt></dt> <dd>A memo that is displayed to the customer on the invoice payment screen. [max length: 4000] </dd>
* <dt><tt>name</tt></dt> <dd>The name of the customer we are invoicing. This is optional if customer or invoiceToCopy is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2] </dd>
* <dt><tt>note</tt></dt> <dd>This field can be used to store a note that is not displayed to the customer. [max length: 4000] </dd>
* <dt><tt>payment</tt></dt> <dd>The ID of the payment. Use this ID to query the /payment API. [max length: 255] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>shippingAddress.city</tt></dt> <dd>Address city of the location where the goods or services were supplied. [max length: 255, min length: 2] </dd>
* <dt><tt>shippingAddress.country</tt></dt> <dd>Address country of the location where the goods or services were supplied. [max length: 2, min length: 2] </dd>
* <dt><tt>shippingAddress.line1</tt></dt> <dd>Address line 1 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.line2</tt></dt> <dd>Address line 2 of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.name</tt></dt> <dd>Address name of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.state</tt></dt> <dd>Address state of the location where the goods or services were supplied. [max length: 255] </dd>
* <dt><tt>shippingAddress.zip</tt></dt> <dd>Address zip of the location where the goods or services were supplied. [max length: 32] </dd>
* <dt><tt>status</tt></dt> <dd>New status of the invoice. </dd>
* <dt><tt>suppliedDate</tt></dt> <dd>The date on which the goods or services were supplied. </dd>
* <dt><tt>taxNo</tt></dt> <dd>The tax number or VAT id of the person who supplied the goods or services. [max length: 255] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Invoice a Invoice object.
*/
public function updateInvoice($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "Invoice";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Invoice";
}
}

View File

@ -2,123 +2,123 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_InvoiceItem extends Simplify_Object {
/**
* Creates an Simplify_InvoiceItem object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd>
* <dt><tt>description</tt></dt> <dd>Individual items of an invoice [max length: 1024] </dd>
* <dt><tt>invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd>
* <dt><tt>product</tt></dt> <dd>Product ID this item relates to. </dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return InvoiceItem a InvoiceItem object.
*/
static public function createInvoiceItem($hash, $authentication = null) {
/**
* Creates an Simplify_InvoiceItem object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: -9999900, max value: 9999900] <strong>required </strong></dd>
* <dt><tt>description</tt></dt> <dd>Individual items of an invoice [max length: 1024] </dd>
* <dt><tt>invoice</tt></dt> <dd>The ID of the invoice this item belongs to. </dd>
* <dt><tt>product</tt></dt> <dd>Product ID this item relates to. </dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. [max length: 255] </dd>
* <dt><tt>tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return InvoiceItem a InvoiceItem object.
*/
static public function createInvoiceItem($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_InvoiceItem();
$instance->setAll($hash);
$instance = new Simplify_InvoiceItem();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_InvoiceItem object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteInvoiceItem($authentication = null) {
/**
* Deletes an Simplify_InvoiceItem object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteInvoiceItem($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve a Simplify_InvoiceItem object from the API
*
* @param string id the id of the InvoiceItem object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return InvoiceItem a InvoiceItem object
*/
static public function findInvoiceItem($id, $authentication = null) {
/**
* Retrieve a Simplify_InvoiceItem object from the API
*
* @param string id the id of the InvoiceItem object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return InvoiceItem a InvoiceItem object
*/
static public function findInvoiceItem($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_InvoiceItem();
$val->id = $id;
$val = new Simplify_InvoiceItem();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_InvoiceItem object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: 1] </dd>
* <dt><tt>description</tt></dt> <dd>Individual items of an invoice </dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. </dd>
* <dt><tt>tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return InvoiceItem a InvoiceItem object.
*/
public function updateInvoiceItem($authentication = null) {
/**
* Updates an Simplify_InvoiceItem object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: 1] </dd>
* <dt><tt>description</tt></dt> <dd>Individual items of an invoice </dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999] </dd>
* <dt><tt>reference</tt></dt> <dd>User defined reference field. </dd>
* <dt><tt>tax</tt></dt> <dd>The tax ID of the tax charge in the invoice item. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return InvoiceItem a InvoiceItem object.
*/
public function updateInvoiceItem($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "InvoiceItem";
}
}
/**
* @ignore
*/
public function getClazz() {
return "InvoiceItem";
}
}

View File

@ -2,27 +2,27 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
@ -32,48 +32,48 @@
*/
class Simplify_Object {
private $properties = array();
private $properties = array();
/**
* @ignore
*/
public function __get($key) {
if (array_key_exists($key, $this->properties)) {
return $this->properties[$key];
} else {
return null;
}
}
/**
* @ignore
*/
public function __get($key) {
if (array_key_exists($key, $this->properties)) {
return $this->properties[$key];
} else {
return null;
}
}
/**
* @ignore
*/
public function __set($key, $value) {
$this->properties[$key] = $value;
}
/**
* @ignore
*/
public function __set($key, $value) {
$this->properties[$key] = $value;
}
/**
* Updates the object's properties with the values in the specified map.
* @param $hash array Map of values to set.
*/
public function setAll($hash) {
foreach ($hash as $key => $value) {
$this->$key = $value;
}
}
/**
* Updates the object's properties with the values in the specified map.
* @param $hash array Map of values to set.
*/
public function setAll($hash) {
foreach ($hash as $key => $value) {
$this->$key = $value;
}
}
/**
* @ignore
*/
public function __toString() {
return json_encode($this->properties);
}
/**
* @ignore
*/
public function __toString() {
return json_encode($this->properties);
}
/**
* Returns the object's properties as a map.
* @return array map of properties.
*/
public function getProperties() {
return $this->properties;
}
}
/**
* Returns the object's properties as a map.
* @return array map of properties.
*/
public function getProperties() {
return $this->properties;
}
}

View File

@ -2,140 +2,140 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Payment extends Simplify_Object {
/**
* Creates an Simplify_Payment object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD </dd>
* <dt><tt>authorization</tt></dt> <dd>The ID of the authorization being used to capture the payment. </dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as it appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the transaction. Must match the currency associated with your account. [default: USD] <strong>required </strong></dd>
* <dt><tt>customer</tt></dt> <dd>ID of customer. If specified, card on file of customer will be used. </dd>
* <dt><tt>description</tt></dt> <dd>Free form text field to be used as a description of the payment. This field is echoed back with the payment on any find or list operations. [max length: 1024] </dd>
* <dt><tt>invoice</tt></dt> <dd>ID of invoice for which this payment is being made. </dd>
* <dt><tt>reference</tt></dt> <dd>Custom reference field to be used with outside systems. </dd>
* <dt><tt>replayId</tt></dt> <dd>An identifier that can be sent to uniquely identify a payment request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your payments. If supplied, we will check for a payment on your account that matches this identifier. If found will attempt to return an identical response of the original request. [max length: 50, min length: 1] </dd>
* <dt><tt>statementDescription.name</tt></dt> <dd>Merchant name. <strong>required </strong></dd>
* <dt><tt>statementDescription.phoneNumber</tt></dt> <dd>Merchant contact phone number. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be used. [max length: 255] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Payment a Payment object.
*/
static public function createPayment($hash, $authentication = null) {
/**
* Creates an Simplify_Payment object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD </dd>
* <dt><tt>authorization</tt></dt> <dd>The ID of the authorization being used to capture the payment. </dd>
* <dt><tt>card.addressCity</tt></dt> <dd>City of the cardholder. [max length: 50, min length: 2] </dd>
* <dt><tt>card.addressCountry</tt></dt> <dd>Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2] </dd>
* <dt><tt>card.addressLine1</tt></dt> <dd>Address of the cardholder. [max length: 255] </dd>
* <dt><tt>card.addressLine2</tt></dt> <dd>Address of the cardholder if needed. [max length: 255] </dd>
* <dt><tt>card.addressState</tt></dt> <dd>State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255, min length: 2] </dd>
* <dt><tt>card.addressZip</tt></dt> <dd>Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length: 9, min length: 3] </dd>
* <dt><tt>card.cvc</tt></dt> <dd>CVC security code of the card. This is the code on the back of the card. Example: 123 </dd>
* <dt><tt>card.expMonth</tt></dt> <dd>Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <strong>required </strong></dd>
* <dt><tt>card.expYear</tt></dt> <dd>Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <strong>required </strong></dd>
* <dt><tt>card.name</tt></dt> <dd>Name as it appears on the card. [max length: 50, min length: 2] </dd>
* <dt><tt>card.number</tt></dt> <dd>Card number as it appears on the card. [max length: 19, min length: 13] <strong>required </strong></dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the transaction. Must match the currency associated with your account. [default: USD] <strong>required </strong></dd>
* <dt><tt>customer</tt></dt> <dd>ID of customer. If specified, card on file of customer will be used. </dd>
* <dt><tt>description</tt></dt> <dd>Free form text field to be used as a description of the payment. This field is echoed back with the payment on any find or list operations. [max length: 1024] </dd>
* <dt><tt>invoice</tt></dt> <dd>ID of invoice for which this payment is being made. </dd>
* <dt><tt>reference</tt></dt> <dd>Custom reference field to be used with outside systems. </dd>
* <dt><tt>replayId</tt></dt> <dd>An identifier that can be sent to uniquely identify a payment request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your payments. If supplied, we will check for a payment on your account that matches this identifier. If found will attempt to return an identical response of the original request. [max length: 50, min length: 1] </dd>
* <dt><tt>statementDescription.name</tt></dt> <dd>Merchant name. <strong>required </strong></dd>
* <dt><tt>statementDescription.phoneNumber</tt></dt> <dd>Merchant contact phone number. </dd>
* <dt><tt>token</tt></dt> <dd>If specified, card associated with card token will be used. [max length: 255] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Payment a Payment object.
*/
static public function createPayment($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Payment();
$instance->setAll($hash);
$instance = new Simplify_Payment();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Retrieve Simplify_Payment objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> createdBy</tt><tt> amount</tt><tt> id</tt><tt> description</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Payment objects and the total
* number of Payment objects available for the given criteria.
* @see ResourceList
*/
static public function listPayment($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Payment objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> createdBy</tt><tt> amount</tt><tt> id</tt><tt> description</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Payment objects and the total
* number of Payment objects available for the given criteria.
* @see ResourceList
*/
static public function listPayment($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Payment();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Payment();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Payment object from the API
*
* @param string id the id of the Payment object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Payment a Payment object
*/
static public function findPayment($id, $authentication = null) {
/**
* Retrieve a Simplify_Payment object from the API
*
* @param string id the id of the Payment object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Payment a Payment object
*/
static public function findPayment($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Payment();
$val->id = $id;
$val = new Simplify_Payment();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_Payment object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;"></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Payment a Payment object.
*/
public function updatePayment($authentication = null) {
/**
* Updates an Simplify_Payment object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;"></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Payment a Payment object.
*/
public function updatePayment($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "Payment";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Payment";
}
}

View File

@ -2,27 +2,27 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
@ -30,261 +30,261 @@
class Simplify_PaymentsApi
{
/**
* @ignore
*/
public static $methodMap = array(
'create' => 'POST',
'delete' => 'DELETE',
'list' => 'GET',
'show' => 'GET',
'update' => 'PUT'
);
/**
* @ignore
*/
public static $methodMap = array(
'create' => 'POST',
'delete' => 'DELETE',
'list' => 'GET',
'show' => 'GET',
'update' => 'PUT'
);
/**
* @ignore
*/
static public function createObject($object, $authentication = null)
{
$paymentsApi = new Simplify_PaymentsApi();
/**
* @ignore
*/
static public function createObject($object, $authentication = null)
{
$paymentsApi = new Simplify_PaymentsApi();
$jsonObject = $paymentsApi->execute("create", $object, $authentication);
$jsonObject = $paymentsApi->execute("create", $object, $authentication);
$o = $paymentsApi->convertFromHashToObject($jsonObject, $object->getClazz());
$o = $paymentsApi->convertFromHashToObject($jsonObject, $object->getClazz());
return $o;
}
return $o;
}
/**
* @ignore
*/
static public function findObject($object, $authentication = null)
{
$paymentsApi = new Simplify_PaymentsApi();
/**
* @ignore
*/
static public function findObject($object, $authentication = null)
{
$paymentsApi = new Simplify_PaymentsApi();
$jsonObject = $paymentsApi->execute("show", $object, $authentication);
$o = $paymentsApi->convertFromHashToObject($jsonObject, $object->getClazz());
$jsonObject = $paymentsApi->execute("show", $object, $authentication);
$o = $paymentsApi->convertFromHashToObject($jsonObject, $object->getClazz());
return $o;
}
return $o;
}
/**
* @ignore
*/
static public function updateObject($object, $authentication = null) {
$paymentsApi = new Simplify_PaymentsApi();
/**
* @ignore
*/
static public function updateObject($object, $authentication = null) {
$paymentsApi = new Simplify_PaymentsApi();
$jsonObject = $paymentsApi->execute("update", $object, $authentication);
$o = $paymentsApi->convertFromHashToObject($jsonObject, $object->getClazz());
$jsonObject = $paymentsApi->execute("update", $object, $authentication);
$o = $paymentsApi->convertFromHashToObject($jsonObject, $object->getClazz());
return $o;
}
return $o;
}
/**
* @ignore
*/
static public function deleteObject($object, $authentication = null) {
$paymentsApi = new Simplify_PaymentsApi();
/**
* @ignore
*/
static public function deleteObject($object, $authentication = null) {
$paymentsApi = new Simplify_PaymentsApi();
$jsonObject = $paymentsApi->execute("delete", $object, $authentication);
$jsonObject = $paymentsApi->execute("delete", $object, $authentication);
return $jsonObject;
}
return $jsonObject;
}
/**
* @ignore
*/
static public function listObject($object, $criteria = null, $authentication =null) {
if ($criteria != null) {
if (isset($criteria['max'])) {
$object->max = $criteria['max'];
}
if (isset($criteria['offset'])) {
$object->offset = $criteria['offset'];
}
if (isset($criteria['sorting'])) {
$object->sorting = $criteria['sorting'];
}
if (isset($criteria['filter'])) {
$object->filter = $criteria['filter'];
}
}
/**
* @ignore
*/
static public function listObject($object, $criteria = null, $authentication =null) {
if ($criteria != null) {
if (isset($criteria['max'])) {
$object->max = $criteria['max'];
}
if (isset($criteria['offset'])) {
$object->offset = $criteria['offset'];
}
if (isset($criteria['sorting'])) {
$object->sorting = $criteria['sorting'];
}
if (isset($criteria['filter'])) {
$object->filter = $criteria['filter'];
}
}
$paymentsApi = new Simplify_PaymentsApi();
$jsonObject = $paymentsApi->execute("list", $object, $authentication);
$paymentsApi = new Simplify_PaymentsApi();
$jsonObject = $paymentsApi->execute("list", $object, $authentication);
$ret = new Simplify_ResourceList();
if (array_key_exists('list', $jsonObject) & is_array($jsonObject['list'])) {
foreach ($jsonObject['list'] as $obj) {
array_push($ret->list, $paymentsApi->convertFromHashToObject($obj, $object->getClazz()));
}
$ret->total = $jsonObject['total'];
}
$ret = new Simplify_ResourceList();
if (array_key_exists('list', $jsonObject) & is_array($jsonObject['list'])) {
foreach ($jsonObject['list'] as $obj) {
array_push($ret->list, $paymentsApi->convertFromHashToObject($obj, $object->getClazz()));
}
$ret->total = $jsonObject['total'];
}
return $ret;
}
return $ret;
}
/**
* @ignore
*/
public function convertFromHashToObject($from, $toClazz)
{
$clazz = 'stdClass';
$toClazz = "Simplify_" . $toClazz;
if ("stdClass" != $toClazz && class_exists("{$toClazz}", false)) {
$clazz = "{$toClazz}";
}
$object = new $clazz();
/**
* @ignore
*/
public function convertFromHashToObject($from, $toClazz)
{
$clazz = 'stdClass';
$toClazz = "Simplify_" . $toClazz;
if ("stdClass" != $toClazz && class_exists("{$toClazz}", false)) {
$clazz = "{$toClazz}";
}
$object = new $clazz();
foreach ($from as $key => $value) {
if (is_array($value) && count(array_keys($value))) {
$newClazz = "Simplify_" . ucfirst($key);
if (!class_exists($newClazz, false)) {
$newClazz = 'stdClass';
}
foreach ($from as $key => $value) {
if (is_array($value) && count(array_keys($value))) {
$newClazz = "Simplify_" . ucfirst($key);
if (!class_exists($newClazz, false)) {
$newClazz = 'stdClass';
}
$object->$key = $this->convertFromHashToObject($value, $newClazz);
} else {
$object->$key = $value;
}
}
$object->$key = $this->convertFromHashToObject($value, $newClazz);
} else {
$object->$key = $value;
}
}
return $object;
}
return $object;
}
/**
* @ignore
*/
public function getUrl($publicKey, $action, $object)
{
$url = $this->fixUrl(Simplify::$apiBaseSandboxUrl);
if ($this->isLiveKey($publicKey)) {
$url = $this->fixUrl(Simplify::$apiBaseLiveUrl);
}
$url = $this->fixUrl($url) . urlencode(lcfirst($object->getClazz())) . '/';
/**
* @ignore
*/
public function getUrl($publicKey, $action, $object)
{
$url = $this->fixUrl(Simplify::$apiBaseSandboxUrl);
if ($this->isLiveKey($publicKey)) {
$url = $this->fixUrl(Simplify::$apiBaseLiveUrl);
}
$url = $this->fixUrl($url) . urlencode(lcfirst($object->getClazz())) . '/';
$queryParams = array();
if ($action == "show") {
$url .= urlencode($object->id);
} elseif ($action == "list") {
$queryParams = array_merge($queryParams, array('max' => $object->max, 'offset' => $object->offset));
if (is_array($object->filter) && count(array_keys($object->filter))) {
foreach ($object->filter as $key => $value) {
$queryParams["filter[$key]"] = $value;
}
}
if (is_array($object->sorting) && count(array_keys($object->sorting))) {
foreach ($object->sorting as $key => $value) {
$queryParams["sorting[$key]"] = $value;
}
}
$query = http_build_query($queryParams);
if ($query != '') {
if (strpos($url, '?', strlen($url)) === false) $url .= '?';
$url .= $query;
}
$queryParams = array();
if ($action == "show") {
$url .= urlencode($object->id);
} elseif ($action == "list") {
$queryParams = array_merge($queryParams, array('max' => $object->max, 'offset' => $object->offset));
if (is_array($object->filter) && count(array_keys($object->filter))) {
foreach ($object->filter as $key => $value) {
$queryParams["filter[$key]"] = $value;
}
}
if (is_array($object->sorting) && count(array_keys($object->sorting))) {
foreach ($object->sorting as $key => $value) {
$queryParams["sorting[$key]"] = $value;
}
}
$query = http_build_query($queryParams);
if ($query != '') {
if (strpos($url, '?', strlen($url)) === false) $url .= '?';
$url .= $query;
}
} elseif ($action == "delete") {
$url .= urlencode($object->id);
} elseif ($action == "update") {
$url .= urlencode($object->id);
} elseif ($action == "create") {
}
return $url;
}
} elseif ($action == "delete") {
$url .= urlencode($object->id);
} elseif ($action == "update") {
$url .= urlencode($object->id);
} elseif ($action == "create") {
}
return $url;
}
/**
* @ignore
*/
public function getMethod($action)
{
if (array_key_exists(strtolower($action), self::$methodMap)) {
return self::$methodMap[strtolower($action)];
}
return 'GET';
}
/**
* @ignore
*/
public function getMethod($action)
{
if (array_key_exists(strtolower($action), self::$methodMap)) {
return self::$methodMap[strtolower($action)];
}
return 'GET';
}
/**
* @ignore
*/
private function execute($action, $object, $authentication)
{
$http = new Simplify_HTTP();
/**
* @ignore
*/
private function execute($action, $object, $authentication)
{
$http = new Simplify_HTTP();
return $http->apiRequest($this->getUrl($authentication->publicKey, $action, $object), $this->getMethod($action),
$authentication, json_encode($object->getProperties()));
}
return $http->apiRequest($this->getUrl($authentication->publicKey, $action, $object), $this->getMethod($action),
$authentication, json_encode($object->getProperties()));
}
/**
* @ignore
*/
public function jwsDecode($hash, $authentication)
{
$http = new Simplify_HTTP();
/**
* @ignore
*/
public function jwsDecode($hash, $authentication)
{
$http = new Simplify_HTTP();
$data = $http->jwsDecode($authentication, $hash);
$data = $http->jwsDecode($authentication, $hash);
return json_decode($data, true);
}
return json_decode($data, true);
}
/**
* @ignore
*/
private function fixUrl($url)
{
if ($this->endsWith($url, '/')) {
return $url;
}
return $url . '/';
}
/**
* @ignore
*/
private function fixUrl($url)
{
if ($this->endsWith($url, '/')) {
return $url;
}
return $url . '/';
}
/**
* @ignore
*/
private function isLiveKey($k) {
return strpos($k, "lvpb") === 0;
}
/**
* @ignore
*/
private function isLiveKey($k) {
return strpos($k, "lvpb") === 0;
}
/**
* @ignore
*/
private function endsWith($s, $c)
{
return substr($s, -strlen($c)) == $c;
}
/**
* @ignore
*/
private function endsWith($s, $c)
{
return substr($s, -strlen($c)) == $c;
}
/**
* Helper function to build the Authentication object for backwards compatibility.
* An array of all the arguments passed to one of the API functions is checked against what
* we expect to received. If it's greater, then we're assuming that the user is using the older way of
* passing the keys. i.e as two separate strings. We take those two string and create the Authentication object
*
* @ignore
* @param $authentication
* @param $args
* @param $expectedArgCount
* @return Simplify_Authentication
*/
static function buildAuthenticationObject($authentication = null, $args, $expectedArgCount){
/**
* Helper function to build the Authentication object for backwards compatibility.
* An array of all the arguments passed to one of the API functions is checked against what
* we expect to received. If it's greater, then we're assuming that the user is using the older way of
* passing the keys. i.e as two separate strings. We take those two string and create the Authentication object
*
* @ignore
* @param $authentication
* @param $args
* @param $expectedArgCount
* @return Simplify_Authentication
*/
static function buildAuthenticationObject($authentication = null, $args, $expectedArgCount){
if(sizeof($args) > $expectedArgCount) {
$authentication = new Simplify_Authentication($args[$expectedArgCount-1], $args[$expectedArgCount]);
}
if(sizeof($args) > $expectedArgCount) {
$authentication = new Simplify_Authentication($args[$expectedArgCount-1], $args[$expectedArgCount]);
}
if ($authentication == null){
$authentication = new Simplify_Authentication();
}
if ($authentication == null){
$authentication = new Simplify_Authentication();
}
// check that the keys have been set, if not use the global keys
if ( empty($authentication->publicKey)){
$authentication->publicKey = Simplify::$publicKey;
}
if ( empty($authentication->privateKey)){
$authentication->privateKey = Simplify::$privateKey;
}
// check that the keys have been set, if not use the global keys
if ( empty($authentication->publicKey)){
$authentication->publicKey = Simplify::$publicKey;
}
if ( empty($authentication->privateKey)){
$authentication->privateKey = Simplify::$privateKey;
}
return $authentication;
}
return $authentication;
}
}

View File

@ -2,146 +2,146 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Plan extends Simplify_Object {
/**
* Creates an Simplify_Plan object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00USD <strong>required </strong></dd>
* <dt><tt>billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the plan. Must match the currency associated with your account. [default: USD] <strong>required </strong></dd>
* <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". [default: MONTHLY] <strong>required </strong></dd>
* <dt><tt>frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1, default: 1] <strong>required </strong></dd>
* <dt><tt>name</tt></dt> <dd>Name of the plan [max length: 50, min length: 2] <strong>required </strong></dd>
* <dt><tt>renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. </dd>
* <dt><tt>trialPeriod</tt></dt> <dd>Plan free trial period selection. Must be Days, Weeks, or Month [default: NONE] <strong>required </strong></dd>
* <dt><tt>trialPeriodQuantity</tt></dt> <dd>Quantity of the trial period. Must be greater than 0 and a whole number. [min value: 1] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Plan a Plan object.
*/
static public function createPlan($hash, $authentication = null) {
/**
* Creates an Simplify_Plan object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00USD <strong>required </strong></dd>
* <dt><tt>billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217) for the plan. Must match the currency associated with your account. [default: USD] <strong>required </strong></dd>
* <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". [default: MONTHLY] <strong>required </strong></dd>
* <dt><tt>frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1, default: 1] <strong>required </strong></dd>
* <dt><tt>name</tt></dt> <dd>Name of the plan [max length: 50, min length: 2] <strong>required </strong></dd>
* <dt><tt>renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. </dd>
* <dt><tt>trialPeriod</tt></dt> <dd>Plan free trial period selection. Must be Days, Weeks, or Month [default: NONE] <strong>required </strong></dd>
* <dt><tt>trialPeriodQuantity</tt></dt> <dd>Quantity of the trial period. Must be greater than 0 and a whole number. [min value: 1] </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Plan a Plan object.
*/
static public function createPlan($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Plan();
$instance->setAll($hash);
$instance = new Simplify_Plan();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Plan object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deletePlan($authentication = null) {
/**
* Deletes an Simplify_Plan object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deletePlan($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Plan objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> frequency</tt><tt> name</tt><tt> id</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Plan objects and the total
* number of Plan objects available for the given criteria.
* @see ResourceList
*/
static public function listPlan($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Plan objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> amount</tt><tt> frequency</tt><tt> name</tt><tt> id</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Plan objects and the total
* number of Plan objects available for the given criteria.
* @see ResourceList
*/
static public function listPlan($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Plan();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Plan();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Plan object from the API
*
* @param string id the id of the Plan object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Plan a Plan object
*/
static public function findPlan($id, $authentication = null) {
/**
* Retrieve a Simplify_Plan object from the API
*
* @param string id the id of the Plan object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Plan a Plan object
*/
static public function findPlan($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Plan();
$val->id = $id;
$val = new Simplify_Plan();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_Plan object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>name</tt></dt> <dd>Name of the plan. [min length: 2] <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Plan a Plan object.
*/
public function updatePlan($authentication = null) {
/**
* Updates an Simplify_Plan object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>name</tt></dt> <dd>Name of the plan. [min length: 2] <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Plan a Plan object.
*/
public function updatePlan($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "Plan";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Plan";
}
}

View File

@ -2,107 +2,107 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Refund extends Simplify_Object {
/**
* Creates an Simplify_Refund object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00USD [min value: 1] <strong>required </strong></dd>
* <dt><tt>payment</tt></dt> <dd>ID of the payment for the refund <strong>required </strong></dd>
* <dt><tt>reason</tt></dt> <dd>Reason for the refund </dd>
* <dt><tt>reference</tt></dt> <dd>Custom reference field to be used with outside systems. </dd>
* <dt><tt>replayId</tt></dt> <dd>An identifier that can be sent to uniquely identify a refund request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your refunds. If supplied, we will check for a refund on your account that matches this identifier. If found we will return an identical response to that of the original request. [max length: 50, min length: 1] </dd>
* <dt><tt>statementDescription.name</tt></dt> <dd>Merchant name. <strong>required </strong></dd>
* <dt><tt>statementDescription.phoneNumber</tt></dt> <dd>Merchant contact phone number. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Refund a Refund object.
*/
static public function createRefund($hash, $authentication = null) {
/**
* Creates an Simplify_Refund object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00USD [min value: 1] <strong>required </strong></dd>
* <dt><tt>payment</tt></dt> <dd>ID of the payment for the refund <strong>required </strong></dd>
* <dt><tt>reason</tt></dt> <dd>Reason for the refund </dd>
* <dt><tt>reference</tt></dt> <dd>Custom reference field to be used with outside systems. </dd>
* <dt><tt>replayId</tt></dt> <dd>An identifier that can be sent to uniquely identify a refund request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your refunds. If supplied, we will check for a refund on your account that matches this identifier. If found we will return an identical response to that of the original request. [max length: 50, min length: 1] </dd>
* <dt><tt>statementDescription.name</tt></dt> <dd>Merchant name. <strong>required </strong></dd>
* <dt><tt>statementDescription.phoneNumber</tt></dt> <dd>Merchant contact phone number. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Refund a Refund object.
*/
static public function createRefund($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Refund();
$instance->setAll($hash);
$instance = new Simplify_Refund();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Retrieve Simplify_Refund objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Refund objects and the total
* number of Refund objects available for the given criteria.
* @see ResourceList
*/
static public function listRefund($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Refund objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> amount</tt><tt> description</tt><tt> dateCreated</tt><tt> paymentDate</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Refund objects and the total
* number of Refund objects available for the given criteria.
* @see ResourceList
*/
static public function listRefund($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Refund();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Refund();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Refund object from the API
*
* @param string id the id of the Refund object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Refund a Refund object
*/
static public function findRefund($id, $authentication = null) {
/**
* Retrieve a Simplify_Refund object from the API
*
* @param string id the id of the Refund object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Refund a Refund object
*/
static public function findRefund($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Refund();
$val->id = $id;
$val = new Simplify_Refund();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* @ignore
*/
public function getClazz() {
return "Refund";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Refund";
}
}

View File

@ -2,27 +2,27 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
@ -32,13 +32,13 @@
*/
class Simplify_ResourceList {
/**
* @var array $list the list of domain objects.
*/
public $list = array();
/**
* @var array $list the list of domain objects.
*/
public $list = array();
/**
* @var int $total the total number of object available.
*/
public $total = 0;
}
/**
* @var int $total the total number of object available.
*/
public $total = 0;
}

View File

@ -2,159 +2,159 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Subscription extends Simplify_Object {
/**
* Creates an Simplify_Subscription object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD </dd>
* <dt><tt>billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>coupon</tt></dt> <dd>Coupon ID associated with the subscription </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [default: USD] </dd>
* <dt><tt>customer</tt></dt> <dd>Customer that is enrolling in the subscription. </dd>
* <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". </dd>
* <dt><tt>frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. </dd>
* <dt><tt>name</tt></dt> <dd>Name describing subscription </dd>
* <dt><tt>plan</tt></dt> <dd>The ID of the plan that should be used for the subscription. </dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the plan for the subscription. [min value: 1] </dd>
* <dt><tt>renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Subscription a Subscription object.
*/
static public function createSubscription($hash, $authentication = null) {
/**
* Creates an Simplify_Subscription object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD </dd>
* <dt><tt>billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>coupon</tt></dt> <dd>Coupon ID associated with the subscription </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [default: USD] </dd>
* <dt><tt>customer</tt></dt> <dd>Customer that is enrolling in the subscription. </dd>
* <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". </dd>
* <dt><tt>frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. </dd>
* <dt><tt>name</tt></dt> <dd>Name describing subscription </dd>
* <dt><tt>plan</tt></dt> <dd>The ID of the plan that should be used for the subscription. </dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the plan for the subscription. [min value: 1] </dd>
* <dt><tt>renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Subscription a Subscription object.
*/
static public function createSubscription($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Subscription();
$instance->setAll($hash);
$instance = new Simplify_Subscription();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Subscription object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteSubscription($authentication = null) {
/**
* Deletes an Simplify_Subscription object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteSubscription($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Subscription objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> plan</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Subscription objects and the total
* number of Subscription objects available for the given criteria.
* @see ResourceList
*/
static public function listSubscription($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Subscription objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> plan</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Subscription objects and the total
* number of Subscription objects available for the given criteria.
* @see ResourceList
*/
static public function listSubscription($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Subscription();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Subscription();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Subscription object from the API
*
* @param string id the id of the Subscription object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Subscription a Subscription object
*/
static public function findSubscription($id, $authentication = null) {
/**
* Retrieve a Simplify_Subscription object from the API
*
* @param string id the id of the Subscription object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Subscription a Subscription object
*/
static public function findSubscription($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Subscription();
$val->id = $id;
$val = new Simplify_Subscription();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_Subscription object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD </dd>
* <dt><tt>billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>coupon</tt></dt> <dd>Coupon being assigned to this subscription </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [default: USD] </dd>
* <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". </dd>
* <dt><tt>frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1] </dd>
* <dt><tt>name</tt></dt> <dd>Name describing subscription </dd>
* <dt><tt>plan</tt></dt> <dd>Plan that should be used for the subscription. </dd>
* <dt><tt>prorate</tt></dt> <dd>Whether to prorate existing subscription. [default: true] <strong>required </strong></dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the plan for the subscription. [min value: 1] </dd>
* <dt><tt>renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null or 0, no emails are sent. Minimum value is 7 if set. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Subscription a Subscription object.
*/
public function updateSubscription($authentication = null) {
/**
* Updates an Simplify_Subscription object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>amount</tt></dt> <dd>Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD </dd>
* <dt><tt>billingCycle</tt></dt> <dd>How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO] </dd>
* <dt><tt>billingCycleLimit</tt></dt> <dd>The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 </dd>
* <dt><tt>coupon</tt></dt> <dd>Coupon being assigned to this subscription </dd>
* <dt><tt>currency</tt></dt> <dd>Currency code (ISO-4217). Must match the currency associated with your account. [default: USD] </dd>
* <dt><tt>frequency</tt></dt> <dd>Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". </dd>
* <dt><tt>frequencyPeriod</tt></dt> <dd>Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1] </dd>
* <dt><tt>name</tt></dt> <dd>Name describing subscription </dd>
* <dt><tt>plan</tt></dt> <dd>Plan that should be used for the subscription. </dd>
* <dt><tt>prorate</tt></dt> <dd>Whether to prorate existing subscription. [default: true] <strong>required </strong></dd>
* <dt><tt>quantity</tt></dt> <dd>Quantity of the plan for the subscription. [min value: 1] </dd>
* <dt><tt>renewalReminderLeadDays</tt></dt> <dd>If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null or 0, no emails are sent. Minimum value is 7 if set. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Subscription a Subscription object.
*/
public function updateSubscription($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "Subscription";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Subscription";
}
}

View File

@ -2,119 +2,119 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Tax extends Simplify_Object {
/**
* Creates an Simplify_Tax object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>label</tt></dt> <dd>The label of the tax object. [max length: 255] <strong>required </strong></dd>
* <dt><tt>rate</tt></dt> <dd>The tax rate. Decimal value up three decimal places. e.g 12.501. [max length: 6] <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Tax a Tax object.
*/
static public function createTax($hash, $authentication = null) {
/**
* Creates an Simplify_Tax object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>label</tt></dt> <dd>The label of the tax object. [max length: 255] <strong>required </strong></dd>
* <dt><tt>rate</tt></dt> <dd>The tax rate. Decimal value up three decimal places. e.g 12.501. [max length: 6] <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Tax a Tax object.
*/
static public function createTax($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Tax();
$instance->setAll($hash);
$instance = new Simplify_Tax();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Tax object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteTax($authentication = null) {
/**
* Deletes an Simplify_Tax object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteTax($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Tax objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> label</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Tax objects and the total
* number of Tax objects available for the given criteria.
* @see ResourceList
*/
static public function listTax($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Tax objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> id</tt><tt> label</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Tax objects and the total
* number of Tax objects available for the given criteria.
* @see ResourceList
*/
static public function listTax($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Tax();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Tax();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Tax object from the API
*
* @param string id the id of the Tax object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Tax a Tax object
*/
static public function findTax($id, $authentication = null) {
/**
* Retrieve a Simplify_Tax object from the API
*
* @param string id the id of the Tax object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Tax a Tax object
*/
static public function findTax($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Tax();
$val->id = $id;
$val = new Simplify_Tax();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* @ignore
*/
public function getClazz() {
return "Tax";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Tax";
}
}

View File

@ -2,136 +2,136 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_TransactionReview extends Simplify_Object {
/**
* Creates an Simplify_TransactionReview object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;"></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return TransactionReview a TransactionReview object.
*/
static public function createTransactionReview($hash, $authentication = null) {
/**
* Creates an Simplify_TransactionReview object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;"></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return TransactionReview a TransactionReview object.
*/
static public function createTransactionReview($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_TransactionReview();
$instance->setAll($hash);
$instance = new Simplify_TransactionReview();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_TransactionReview object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteTransactionReview($authentication = null) {
/**
* Deletes an Simplify_TransactionReview object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteTransactionReview($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_TransactionReview objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Allows for ascending or descending sorting of the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Filters to apply to the list. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> status</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of TransactionReview objects and the total
* number of TransactionReview objects available for the given criteria.
* @see ResourceList
*/
static public function listTransactionReview($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_TransactionReview objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Allows for ascending or descending sorting of the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Filters to apply to the list. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt><tt> status</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of TransactionReview objects and the total
* number of TransactionReview objects available for the given criteria.
* @see ResourceList
*/
static public function listTransactionReview($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_TransactionReview();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_TransactionReview();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_TransactionReview object from the API
*
* @param string id the id of the TransactionReview object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return TransactionReview a TransactionReview object
*/
static public function findTransactionReview($id, $authentication = null) {
/**
* Retrieve a Simplify_TransactionReview object from the API
*
* @param string id the id of the TransactionReview object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return TransactionReview a TransactionReview object
*/
static public function findTransactionReview($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_TransactionReview();
$val->id = $id;
$val = new Simplify_TransactionReview();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_TransactionReview object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>status</tt></dt> <dd>Status of the transaction review. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return TransactionReview a TransactionReview object.
*/
public function updateTransactionReview($authentication = null) {
/**
* Updates an Simplify_TransactionReview object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>status</tt></dt> <dd>Status of the transaction review. </dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return TransactionReview a TransactionReview object.
*/
public function updateTransactionReview($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "TransactionReview";
}
}
/**
* @ignore
*/
public function getClazz() {
return "TransactionReview";
}
}

View File

@ -2,137 +2,137 @@
/*
* Copyright (c) 2013 - 2015 MasterCard International Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
class Simplify_Webhook extends Simplify_Object {
/**
* Creates an Simplify_Webhook object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>url</tt></dt> <dd>Endpoint URL <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Webhook a Webhook object.
*/
static public function createWebhook($hash, $authentication = null) {
/**
* Creates an Simplify_Webhook object
* @param array $hash a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>url</tt></dt> <dd>Endpoint URL <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.<i/>
* @return Webhook a Webhook object.
*/
static public function createWebhook($hash, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$instance = new Simplify_Webhook();
$instance->setAll($hash);
$instance = new Simplify_Webhook();
$instance->setAll($hash);
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::createObject($instance, $authentication);
return $object;
}
/**
* Deletes an Simplify_Webhook object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteWebhook($authentication = null) {
/**
* Deletes an Simplify_Webhook object.
*
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
*/
public function deleteWebhook($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
$obj = Simplify_PaymentsApi::deleteObject($this, $authentication);
$this->properties = null;
return true;
}
/**
* Retrieve Simplify_Webhook objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Webhook objects and the total
* number of Webhook objects available for the given criteria.
* @see ResourceList
*/
static public function listWebhook($criteria = null, $authentication = null) {
/**
* Retrieve Simplify_Webhook objects.
* @param array criteria a map of parameters; valid keys are:<dl style="padding-left:10px;">
* <dt><tt>filter</tt></dt> <dd>Filters to apply to the list. </dd>
* <dt><tt>max</tt></dt> <dd>Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] </dd>
* <dt><tt>offset</tt></dt> <dd>Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0] </dd>
* <dt><tt>sorting</tt></dt> <dd>Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <tt>asc</tt> for ascending or <tt>desc</tt> for descending). Sortable properties are: <tt> dateCreated</tt>.</dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return ResourceList a ResourceList object that holds the list of Webhook objects and the total
* number of Webhook objects available for the given criteria.
* @see ResourceList
*/
static public function listWebhook($criteria = null, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Webhook();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
$val = new Simplify_Webhook();
$list = Simplify_PaymentsApi::listObject($val, $criteria, $authentication);
return $list;
}
return $list;
}
/**
* Retrieve a Simplify_Webhook object from the API
*
* @param string id the id of the Webhook object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Webhook a Webhook object
*/
static public function findWebhook($id, $authentication = null) {
/**
* Retrieve a Simplify_Webhook object from the API
*
* @param string id the id of the Webhook object to retrieve
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Webhook a Webhook object
*/
static public function findWebhook($id, $authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 2);
$val = new Simplify_Webhook();
$val->id = $id;
$val = new Simplify_Webhook();
$val->id = $id;
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
$obj = Simplify_PaymentsApi::findObject($val, $authentication);
return $obj;
}
return $obj;
}
/**
* Updates an Simplify_Webhook object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>url</tt></dt> <dd>Endpoint URL <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Webhook a Webhook object.
*/
public function updateWebhook($authentication = null) {
/**
* Updates an Simplify_Webhook object.
*
* The properties that can be updated:
* <dl style="padding-left:10px;">
* <dt><tt>url</tt></dt> <dd>Endpoint URL <strong>required </strong></dd></dl>
* @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. <i>For backwards compatibility the public and private keys may be passed instead of the authentication object.</i>
* @return Webhook a Webhook object.
*/
public function updateWebhook($authentication = null) {
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$args = func_get_args();
$authentication = Simplify_PaymentsApi::buildAuthenticationObject($authentication, $args, 1);
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
$object = Simplify_PaymentsApi::updateObject($this, $authentication);
return $object;
}
/**
* @ignore
*/
public function getClazz() {
return "Webhook";
}
}
/**
* @ignore
*/
public function getClazz() {
return "Webhook";
}
}

View File

@ -37,7 +37,7 @@ class WC_Shipping_Legacy_Local_Delivery extends WC_Shipping_Local_Pickup {
exit;
}
}
/**
* Return the name of the option in the WP DB.
* @since 2.6.0
@ -87,7 +87,7 @@ class WC_Shipping_Legacy_Local_Delivery extends WC_Shipping_Local_Pickup {
foreach ( $package['contents'] as $item_id => $values ) {
if ( $values['quantity'] > 0 && $values['data']->needs_shipping() ) {
$shipping_total += $this->fee * $values['quantity'];
}
}
}
break;
}

View File

@ -70,13 +70,13 @@ function wc_get_raw_referer() {
return wp_get_raw_referer();
}
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
return wp_unslash( $_REQUEST['_wp_http_referer'] );
} else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
return wp_unslash( $_SERVER['HTTP_REFERER'] );
}
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
return wp_unslash( $_REQUEST['_wp_http_referer'] );
} elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
return wp_unslash( $_SERVER['HTTP_REFERER'] );
}
return false;
return false;
}
/**

View File

@ -308,7 +308,7 @@ function wc_sanitize_tooltip( $var ) {
'li' => array(),
'ol' => array(),
'p' => array(),
) ) );
) ) );
}
/**

View File

@ -129,7 +129,7 @@ function wc_nav_menu_items( $items ) {
}
}
return $items;
return $items;
}
add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_items', 10 );
@ -195,16 +195,21 @@ add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_item_classes', 2 );
* @return string
*/
function wc_list_pages( $pages ) {
if (is_woocommerce()) {
$pages = str_replace( 'current_page_parent', '', $pages); // remove current_page_parent class from any item
$shop_page = 'page-item-' . wc_get_page_id('shop'); // find shop_page_id through woocommerce options
if ( is_woocommerce() ) {
// Remove current_page_parent class from any item.
$pages = str_replace( 'current_page_parent', '', $pages );
// Find shop_page_id through woocommerce options.
$shop_page = 'page-item-' . wc_get_page_id( 'shop' );
if (is_shop()) :
$pages = str_replace($shop_page, $shop_page . ' current_page_item', $pages); // add current_page_item class to shop page
else :
$pages = str_replace($shop_page, $shop_page . ' current_page_parent', $pages); // add current_page_parent class to shop page
endif;
}
return $pages;
if ( is_shop() ) {
// Add current_page_item class to shop page.
$pages = str_replace( $shop_page, $shop_page . ' current_page_item', $pages );
} else {
// Add current_page_parent class to shop page.
$pages = str_replace( $shop_page, $shop_page . ' current_page_parent', $pages );
}
}
return $pages;
}
add_filter( 'wp_list_pages', 'wc_list_pages' );

View File

@ -484,9 +484,9 @@ if ( ! function_exists( 'woocommerce_page_title' ) ) {
$page_title = apply_filters( 'woocommerce_page_title', $page_title );
if ( $echo )
echo $page_title;
else
return $page_title;
echo $page_title;
else
return $page_title;
}
}
@ -1151,8 +1151,8 @@ if ( ! function_exists( 'woocommerce_sort_product_tabs' ) ) {
if ( ! function_exists( '_sort_priority_callback' ) ) {
function _sort_priority_callback( $a, $b ) {
if ( $a['priority'] === $b['priority'] )
return 0;
return ( $a['priority'] < $b['priority'] ) ? -1 : 1;
return 0;
return ( $a['priority'] < $b['priority'] ) ? -1 : 1;
}
}

View File

@ -317,7 +317,7 @@ function wc_modify_editable_roles( $roles ){
if ( ! current_user_can( 'administrator' ) ) {
unset( $roles[ 'administrator' ] );
}
return $roles;
return $roles;
}
add_filter( 'editable_roles', 'wc_modify_editable_roles' );

View File

@ -63,11 +63,11 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
$number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : $this->settings['number']['std'];
$query_args = array( 'posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'rand' );
$query_args = array( 'posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'rand' );
$query_args['meta_query'] = array();
$query_args['meta_query'][] = WC()->query->stock_status_meta_query();
$query_args['meta_query'] = array_filter( $query_args['meta_query'] );
$query_args['meta_query'][] = WC()->query->stock_status_meta_query();
$query_args['meta_query'] = array_filter( $query_args['meta_query'] );
$r = new WP_Query( $query_args );

View File

@ -25,8 +25,8 @@ if ( ! wc_coupons_enabled() ) {
}
if ( empty( WC()->cart->applied_coupons ) ) {
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>' );
wc_print_notice( $info_message, 'notice' );
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>' );
wc_print_notice( $info_message, 'notice' );
}
?>

View File

@ -12,10 +12,10 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) : ?>
<?php do_action( 'woocommerce_checkout_before_terms_and_conditions' ); ?>
<p class="form-row terms wc-terms-and-conditions">
<p class="form-row terms wc-terms-and-conditions">
<input type="checkbox" class="input-checkbox" name="terms" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) ), true ); ?> id="terms" />
<label for="terms" class="checkbox"><?php printf( __( 'I&rsquo;ve read and accept the <a href="%s" target="_blank">terms &amp; conditions</a>', 'woocommerce' ), esc_url( wc_get_page_permalink( 'terms' ) ) ); ?> <span class="required">*</span></label>
<input type="hidden" name="terms-field" value="1" />
</p>
<label for="terms" class="checkbox"><?php printf( __( 'I&rsquo;ve read and accept the <a href="%s" target="_blank">terms &amp; conditions</a>', 'woocommerce' ), esc_url( wc_get_page_permalink( 'terms' ) ) ); ?> <span class="required">*</span></label>
<input type="hidden" name="terms-field" value="1" />
</p>
<?php do_action( 'woocommerce_checkout_after_terms_and_conditions' ); ?>
<?php endif; ?>

View File

@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<p><?php _e( 'If this was a mistake, just ignore this email and nothing will happen.', 'woocommerce' ); ?></p>
<p><?php _e( 'To reset your password, visit the following address:', 'woocommerce' ); ?></p>
<p>
<a class="link" href="<?php echo esc_url( add_query_arg( array( 'key' => $reset_key, 'login' => rawurlencode( $user_login ) ), wc_get_endpoint_url( 'lost-password', '', wc_get_page_permalink( 'myaccount' ) ) ) ); ?>">
<a class="link" href="<?php echo esc_url( add_query_arg( array( 'key' => $reset_key, 'login' => rawurlencode( $user_login ) ), wc_get_endpoint_url( 'lost-password', '', wc_get_page_permalink( 'myaccount' ) ) ) ); ?>">
<?php _e( 'Click here to reset your password', 'woocommerce' ); ?></a>
</p>
<p></p>

View File

@ -23,38 +23,38 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
</div>
</td>
</tr>
</table>
<!-- End Content -->
</td>
</tr>
</table>
<!-- End Body -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- Footer -->
<table border="0" cellpadding="10" cellspacing="0" width="600" id="template_footer">
<tr>
<td valign="top">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td colspan="2" valign="middle" id="credit">
<?php echo wpautop( wp_kses_post( wptexturize( apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ) ) ) ); ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- End Footer -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</tr>
</table>
<!-- End Content -->
</td>
</tr>
</table>
<!-- End Body -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- Footer -->
<table border="0" cellpadding="10" cellspacing="0" width="600" id="template_footer">
<tr>
<td valign="top">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td colspan="2" valign="middle" id="credit">
<?php echo wpautop( wp_kses_post( wptexturize( apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ) ) ) ); ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- End Footer -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -23,44 +23,44 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
<!DOCTYPE html>
<html dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
<title><?php echo get_bloginfo( 'name', 'display' ); ?></title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
<title><?php echo get_bloginfo( 'name', 'display' ); ?></title>
</head>
<body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr>
<td align="center" valign="top">
<body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr>
<td align="center" valign="top">
<div id="template_header_image">
<?php
if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>';
}
?>
<?php
if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>';
}
?>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container">
<tr>
<td align="center" valign="top">
<!-- Header -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_header">
<tr>
<td id="header_wrapper">
<h1><?php echo $email_heading; ?></h1>
</td>
</tr>
</table>
<!-- End Header -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- Body -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_body">
<tr>
<td valign="top" id="body_content">
<!-- Content -->
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td valign="top">
<div id="body_content_inner">
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container">
<tr>
<td align="center" valign="top">
<!-- Header -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_header">
<tr>
<td id="header_wrapper">
<h1><?php echo $email_heading; ?></h1>
</td>
</tr>
</table>
<!-- End Header -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- Body -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_body">
<tr>
<td valign="top" id="body_content">
<!-- Content -->
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td valign="top">
<div id="body_content_inner">

View File

@ -34,146 +34,146 @@ $text_lighter_20 = wc_hex_lighter( $text, 20 );
// !important; is a gmail hack to prevent styles being stripped if it doesn't like something.
?>
#wrapper {
background-color: <?php echo esc_attr( $bg ); ?>;
margin: 0;
padding: 70px 0 70px 0;
-webkit-text-size-adjust: none !important;
width: 100%;
background-color: <?php echo esc_attr( $bg ); ?>;
margin: 0;
padding: 70px 0 70px 0;
-webkit-text-size-adjust: none !important;
width: 100%;
}
#template_container {
box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important;
background-color: <?php echo esc_attr( $body ); ?>;
border: 1px solid <?php echo esc_attr( $bg_darker_10 ); ?>;
border-radius: 3px !important;
box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important;
background-color: <?php echo esc_attr( $body ); ?>;
border: 1px solid <?php echo esc_attr( $bg_darker_10 ); ?>;
border-radius: 3px !important;
}
#template_header {
background-color: <?php echo esc_attr( $base ); ?>;
border-radius: 3px 3px 0 0 !important;
color: <?php echo esc_attr( $base_text ); ?>;
border-bottom: 0;
font-weight: bold;
line-height: 100%;
vertical-align: middle;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
background-color: <?php echo esc_attr( $base ); ?>;
border-radius: 3px 3px 0 0 !important;
color: <?php echo esc_attr( $base_text ); ?>;
border-bottom: 0;
font-weight: bold;
line-height: 100%;
vertical-align: middle;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
#template_header h1 {
color: <?php echo esc_attr( $base_text ); ?>;
color: <?php echo esc_attr( $base_text ); ?>;
}
#template_footer td {
padding: 0;
-webkit-border-radius: 6px;
padding: 0;
-webkit-border-radius: 6px;
}
#template_footer #credit {
border:0;
color: <?php echo esc_attr( $base_lighter_40 ); ?>;
font-family: Arial;
font-size:12px;
line-height:125%;
text-align:center;
padding: 0 48px 48px 48px;
border:0;
color: <?php echo esc_attr( $base_lighter_40 ); ?>;
font-family: Arial;
font-size:12px;
line-height:125%;
text-align:center;
padding: 0 48px 48px 48px;
}
#body_content {
background-color: <?php echo esc_attr( $body ); ?>;
background-color: <?php echo esc_attr( $body ); ?>;
}
#body_content table td {
padding: 48px;
padding: 48px;
}
#body_content table td td {
padding: 12px;
padding: 12px;
}
#body_content table td th {
padding: 12px;
padding: 12px;
}
#body_content p {
margin: 0 0 16px;
margin: 0 0 16px;
}
#body_content_inner {
color: <?php echo esc_attr( $text_lighter_20 ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 14px;
line-height: 150%;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
color: <?php echo esc_attr( $text_lighter_20 ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 14px;
line-height: 150%;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
}
.td {
color: <?php echo esc_attr( $text_lighter_20 ); ?>;
border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>;
color: <?php echo esc_attr( $text_lighter_20 ); ?>;
border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>;
}
.text {
color: <?php echo esc_attr( $text ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
color: <?php echo esc_attr( $text ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.link {
color: <?php echo esc_attr( $base ); ?>;
color: <?php echo esc_attr( $base ); ?>;
}
#header_wrapper {
padding: 36px 48px;
display: block;
padding: 36px 48px;
display: block;
}
h1 {
color: <?php echo esc_attr( $base ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 30px;
font-weight: 300;
line-height: 150%;
margin: 0;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>;
-webkit-font-smoothing: antialiased;
color: <?php echo esc_attr( $base ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 30px;
font-weight: 300;
line-height: 150%;
margin: 0;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>;
-webkit-font-smoothing: antialiased;
}
h2 {
color: <?php echo esc_attr( $base ); ?>;
display: block;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 18px;
font-weight: bold;
line-height: 130%;
margin: 16px 0 8px;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
color: <?php echo esc_attr( $base ); ?>;
display: block;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 18px;
font-weight: bold;
line-height: 130%;
margin: 16px 0 8px;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
}
h3 {
color: <?php echo esc_attr( $base ); ?>;
display: block;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 16px;
font-weight: bold;
line-height: 130%;
margin: 16px 0 8px;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
color: <?php echo esc_attr( $base ); ?>;
display: block;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 16px;
font-weight: bold;
line-height: 130%;
margin: 16px 0 8px;
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
}
a {
color: <?php echo esc_attr( $base ); ?>;
font-weight: normal;
text-decoration: underline;
color: <?php echo esc_attr( $base ); ?>;
font-weight: normal;
text-decoration: underline;
}
img {
border: none;
display: inline;
font-size: 14px;
font-weight: bold;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
text-transform: capitalize;
border: none;
display: inline;
font-size: 14px;
font-weight: bold;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
text-transform: capitalize;
}
<?php

View File

@ -12,9 +12,9 @@
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woothemes.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Emails/Plain
* @see https://docs.woothemes.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Emails/Plain
* @version 2.5.0
*/
@ -25,5 +25,5 @@ if ( ! defined( 'ABSPATH' ) ) {
echo strtoupper( __( 'Customer details', 'woocommerce' ) ) . "\n\n";
foreach ( $fields as $field ) {
echo wp_kses_post( $field['label'] ) . ': ' . wp_kses_post( $field['value'] ) . "\n";
echo wp_kses_post( $field['label'] ) . ': ' . wp_kses_post( $field['value'] ) . "\n";
}

View File

@ -40,7 +40,7 @@ if ( $totals = $order->get_order_item_totals() ) {
}
if ( $sent_to_admin ) {
echo "\n" . sprintf( __( 'View order: %s', 'woocommerce'), admin_url( 'post.php?post=' . $order->id . '&action=edit' ) ) . "\n";
echo "\n" . sprintf( __( 'View order: %s', 'woocommerce'), admin_url( 'post.php?post=' . $order->id . '&action=edit' ) ) . "\n";
}
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email );

View File

@ -71,9 +71,9 @@ if ( ! comments_open() ) {
'comment_notes_after' => '',
'fields' => array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" required /></p>',
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" required /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'woocommerce' ) . ' <span class="required">*</span></label> ' .
'<input id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" aria-required="true" required /></p>',
'<input id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" aria-required="true" required /></p>',
),
'label_submit' => __( 'Submit', 'woocommerce' ),
'logged_in_as' => '',

View File

@ -44,7 +44,7 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
?>
</td>
</tr>
<?php endforeach;?>
<?php endforeach;?>
</tbody>
</table>

View File

@ -15,18 +15,18 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
<script type="text/template" id="tmpl-variation-template">
<div class="woocommerce-variation-description">
{{{ data.variation.variation_description }}}
</div>
<div class="woocommerce-variation-description">
{{{ data.variation.variation_description }}}
</div>
<div class="woocommerce-variation-price">
{{{ data.variation.price_html }}}
</div>
<div class="woocommerce-variation-price">
{{{ data.variation.price_html }}}
</div>
<div class="woocommerce-variation-availability">
{{{ data.variation.availability_html }}}
</div>
<div class="woocommerce-variation-availability">
{{{ data.variation.availability_html }}}
</div>
</script>
<script type="text/template" id="tmpl-unavailable-variation-template">
<p><?php _e( 'Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce' ); ?></p>
<p><?php _e( 'Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce' ); ?></p>
</script>

View File

@ -16,11 +16,11 @@ WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
download() {
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi
if [ `which curl` ]; then
curl -s "$1" > "$2";
elif [ `which wget` ]; then
wget -nv -O "$2" "$1"
fi
}
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
@ -110,4 +110,4 @@ install_db() {
install_wp
install_test_suite
install_db
install_db

View File

@ -7,50 +7,50 @@
*/
class WC_Helper_Shipping_Zones {
/**
* Create some mock shipping zones to test against
*/
public static function create_mock_zones() {
self::remove_mock_zones();
// Local zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'Local' );
$zone->set_zone_order( 1 );
$zone->add_location( 'GB', 'country' );
$zone->add_location( 'CB*', 'postcode' );
$zone->save();
/**
* Create some mock shipping zones to test against
*/
public static function create_mock_zones() {
self::remove_mock_zones();
// Europe zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'Europe' );
$zone->set_zone_order( 2 );
$zone->add_location( 'EU', 'continent' );
$zone->save();
// Local zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'Local' );
$zone->set_zone_order( 1 );
$zone->add_location( 'GB', 'country' );
$zone->add_location( 'CB*', 'postcode' );
$zone->save();
// US california zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'California' );
$zone->set_zone_order( 3 );
$zone->add_location( 'US:CA', 'state' );
$zone->save();
// Europe zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'Europe' );
$zone->set_zone_order( 2 );
$zone->add_location( 'EU', 'continent' );
$zone->save();
// US zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'US' );
$zone->set_zone_order( 4 );
$zone->add_location( 'US', 'country' );
$zone->save();
}
// US california zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'California' );
$zone->set_zone_order( 3 );
$zone->add_location( 'US:CA', 'state' );
$zone->save();
/**
* Remove all zones
*/
public static function remove_mock_zones() {
global $wpdb;
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_shipping_zone_methods;" );
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_shipping_zone_locations;" );
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_shipping_zones;" );
// US zone
$zone = new WC_Shipping_Zone();
$zone->set_zone_name( 'US' );
$zone->set_zone_order( 4 );
$zone->add_location( 'US', 'country' );
$zone->save();
}
/**
* Remove all zones
*/
public static function remove_mock_zones() {
global $wpdb;
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_shipping_zone_methods;" );
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_shipping_zone_locations;" );
$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_shipping_zones;" );
WC_Cache_Helper::incr_cache_prefix( 'shipping_zones' );
}
}
}

View File

@ -10,246 +10,246 @@ class WC_Tests_Shipping_Zone extends WC_Unit_Test_Case {
* Test: WC_Shipping_Zone::get_data
*/
public function test_get_data() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$data = $zone->get_data();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$data = $zone->get_data();
// Assert
$this->assertTrue( is_array( $data ) );
// Assert
$this->assertTrue( is_array( $data ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_zone_id
*/
public function test_get_zone_id() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_zone_id() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertEquals( $zone->get_zone_id(), 1 );
// Assert
$this->assertEquals( $zone->get_zone_id(), 1 );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_zone_name
*/
public function test_get_zone_name() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_zone_name() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertEquals( $zone->get_zone_name(), 'Local' );
// Assert
$this->assertEquals( $zone->get_zone_name(), 'Local' );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_zone_order
*/
public function test_get_zone_order() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_zone_order() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertEquals( $zone->get_zone_order(), 1 );
// Assert
$this->assertEquals( $zone->get_zone_order(), 1 );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_zone_locations
*/
public function test_get_zone_locations() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_zone_locations() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertTrue( is_array( $zone->get_zone_locations() ) );
$this->assertTrue( 2 === sizeof( $zone->get_zone_locations() ) );
// Assert
$this->assertTrue( is_array( $zone->get_zone_locations() ) );
$this->assertTrue( 2 === sizeof( $zone->get_zone_locations() ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_formatted_location
*/
public function test_get_formatted_location() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_formatted_location() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'United Kingdom (UK), CB*' );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'United Kingdom (UK), CB*' );
// Test
$zone = WC_Shipping_Zones::get_zone( 2 );
// Test
$zone = WC_Shipping_Zones::get_zone( 2 );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'Europe' );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'Europe' );
// Test
$zone = WC_Shipping_Zones::get_zone( 3 );
// Test
$zone = WC_Shipping_Zones::get_zone( 3 );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'California' );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'California' );
// Test
$zone = WC_Shipping_Zones::get_zone( 4 );
// Test
$zone = WC_Shipping_Zones::get_zone( 4 );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'United States (US)' );
// Assert
$this->assertEquals( $zone->get_formatted_location(), 'United States (US)' );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::get_shipping_methods
*/
public function test_get_shipping_methods() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone->add_shipping_method( 'flat_rate' );
$methods = $zone->get_shipping_methods();
// Assert
$this->assertTrue( 1 === sizeof( $methods ) );
// Assert
$this->assertTrue( 1 === sizeof( $methods ) );
$this->assertInstanceOf( 'WC_Shipping_Method', current( $methods ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::set_zone_name
*/
public function test_set_zone_name() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone->set_zone_name( 'I am a fish' );
// Assert
$this->assertEquals( $zone->get_zone_name(), 'I am a fish' );
// Assert
$this->assertEquals( $zone->get_zone_name(), 'I am a fish' );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::set_zone_order
*/
public function test_set_zone_order() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone->set_zone_order( 100 );
// Assert
$this->assertEquals( $zone->get_zone_order(), 100 );
// Assert
$this->assertEquals( $zone->get_zone_order(), 100 );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::is_valid_location_type
*/
public function test_is_valid_location_type() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertEquals( $zone->get_zone_order(), 1 );
// Assert
$this->assertEquals( $zone->get_zone_order(), 1 );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::add_location
*/
public function test_add_location() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertTrue( $zone->is_valid_location_type( 'state' ) );
// Assert
$this->assertTrue( $zone->is_valid_location_type( 'state' ) );
$this->assertTrue( $zone->is_valid_location_type( 'country' ) );
$this->assertTrue( $zone->is_valid_location_type( 'continent' ) );
$this->assertTrue( $zone->is_valid_location_type( 'postcode' ) );
$this->assertFalse( $zone->is_valid_location_type( 'poop' ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::clear_locations
*/
public function test_clear_locations() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone->clear_locations();
// Assert
$zone_locations = $zone->get_zone_locations();
$this->assertTrue( empty( $zone_locations ) );
// Assert
$zone_locations = $zone->get_zone_locations();
$this->assertTrue( empty( $zone_locations ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::set_locations
*/
public function test_set_locations() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone->clear_locations();
$zone->set_locations( array(
array(
@ -262,8 +262,8 @@ class WC_Tests_Shipping_Zone extends WC_Unit_Test_Case {
)
) );
// Assert
$this->assertEquals( $zone->get_zone_locations(), array(
// Assert
$this->assertEquals( $zone->get_zone_locations(), array(
2 => (object) array(
'code' => 'US',
'type' => 'country'
@ -274,50 +274,50 @@ class WC_Tests_Shipping_Zone extends WC_Unit_Test_Case {
)
) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::save
*/
public function test_save() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone->set_zone_name( 'I am a fish' );
$zone->save();
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert
$this->assertEquals( $zone->get_zone_name(), 'I am a fish' );
// Assert
$this->assertEquals( $zone->get_zone_name(), 'I am a fish' );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zone::add_shipping_method
*/
public function test_add_shipping_method() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
$zone->add_shipping_method( 'flat_rate' );
$zone->add_shipping_method( 'free_shipping' );
// Assert
// Assert
$methods = $zone->get_shipping_methods();
// Assert
$this->assertTrue( 2 === sizeof( $methods ) );
$this->assertInstanceOf( 'WC_Shipping_Method', current( $methods ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
}

View File

@ -10,146 +10,146 @@ class WC_Tests_Shipping_Zones extends WC_Unit_Test_Case {
* Test: WC_Shipping_Zones::get_zones
*/
public function test_get_zones() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zones = WC_Shipping_Zones::get_zones();
// Test
$zones = WC_Shipping_Zones::get_zones();
// Assert
$this->assertTrue( is_array( $zones ) );
$this->assertTrue( 4 === sizeof( $zones ) );
// Assert
$this->assertTrue( is_array( $zones ) );
$this->assertTrue( 4 === sizeof( $zones ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_zone
*/
public function test_get_zone() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_zone() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Test
$zone = WC_Shipping_Zones::get_zone( 1 );
// Assert that the first zone is our local zone
$this->assertInstanceOf( 'WC_Shipping_Zone', $zone );
$this->assertEquals( $zone->get_zone_name(), 'Local' );
// Assert that the first zone is our local zone
$this->assertInstanceOf( 'WC_Shipping_Zone', $zone );
$this->assertEquals( $zone->get_zone_name(), 'Local' );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_zone_by
*/
public function test_get_zone_by() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_zone_by() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone_by( 'zone_id', 2 );
// Test
$zone = WC_Shipping_Zones::get_zone_by( 'zone_id', 2 );
// Assert
$this->assertInstanceOf( 'WC_Shipping_Zone', $zone );
$this->assertEquals( $zone->get_zone_name(), 'Europe' );
// Assert
$this->assertInstanceOf( 'WC_Shipping_Zone', $zone );
$this->assertEquals( $zone->get_zone_name(), 'Europe' );
// Test instance_id
$instance_id = $zone->add_shipping_method( 'flat_rate' );
// Test instance_id
$instance_id = $zone->add_shipping_method( 'flat_rate' );
$zone = WC_Shipping_Zones::get_zone_by( 'instance_id', $instance_id );
$zone = WC_Shipping_Zones::get_zone_by( 'instance_id', $instance_id );
// Assert
$this->assertInstanceOf( 'WC_Shipping_Zone', $zone );
$this->assertEquals( $zone->get_zone_name(), 'Europe' );
// Assert
$this->assertInstanceOf( 'WC_Shipping_Zone', $zone );
$this->assertEquals( $zone->get_zone_name(), 'Europe' );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_shipping_method
*/
public function test_get_shipping_method() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_shipping_method() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone = WC_Shipping_Zones::get_zone_by( 'zone_id', 1 );
$instance_id = $zone->add_shipping_method( 'flat_rate' );
$shipping_method = WC_Shipping_Zones::get_shipping_method( $instance_id );
// Test
$zone = WC_Shipping_Zones::get_zone_by( 'zone_id', 1 );
$instance_id = $zone->add_shipping_method( 'flat_rate' );
$shipping_method = WC_Shipping_Zones::get_shipping_method( $instance_id );
// Assert
$this->assertInstanceOf( 'WC_Shipping_Flat_Rate', $shipping_method );
// Assert
$this->assertInstanceOf( 'WC_Shipping_Flat_Rate', $shipping_method );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::delete_zone
*/
public function test_delete_zone() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_delete_zone() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
WC_Shipping_Zones::delete_zone( 1 );
$zones = WC_Shipping_Zones::get_zones();
// Test
WC_Shipping_Zones::delete_zone( 1 );
$zones = WC_Shipping_Zones::get_zones();
// Assert
$this->assertTrue( 3 === sizeof( $zones ) );
// Assert
$this->assertTrue( 3 === sizeof( $zones ) );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
/**
/**
* Test: WC_Shipping_Zones::get_zone_matching_package
*/
public function test_get_zone_matching_package() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
public function test_get_zone_matching_package() {
// Setup
WC_Helper_Shipping_Zones::create_mock_zones();
// Test
$zone1 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'GB',
'state' => 'Cambs',
'postcode' => 'CB23 1GG',
)
) );
$zone2 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'GB',
'state' => 'Cambs',
'postcode' => 'PE12 1BG',
)
) );
$zone3 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'US',
'state' => 'CA',
'postcode' => '90210',
)
) );
$zone4 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'US',
'state' => 'AL',
'postcode' => '12345',
)
) );
// Test
$zone1 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'GB',
'state' => 'Cambs',
'postcode' => 'CB23 1GG',
)
) );
$zone2 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'GB',
'state' => 'Cambs',
'postcode' => 'PE12 1BG',
)
) );
$zone3 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'US',
'state' => 'CA',
'postcode' => '90210',
)
) );
$zone4 = WC_Shipping_Zones::get_zone_matching_package( array(
'destination' => array(
'country' => 'US',
'state' => 'AL',
'postcode' => '12345',
)
) );
// Assert
$this->assertEquals( 'Local', $zone1->get_zone_name() );
$this->assertEquals( 'Europe', $zone2->get_zone_name() );
$this->assertEquals( 'California', $zone3->get_zone_name() );
$this->assertEquals( 'US', $zone4->get_zone_name() );
// Assert
$this->assertEquals( 'Local', $zone1->get_zone_name() );
$this->assertEquals( 'Europe', $zone2->get_zone_name() );
$this->assertEquals( 'California', $zone3->get_zone_name() );
$this->assertEquals( 'US', $zone4->get_zone_name() );
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
// Clean
WC_Helper_Shipping_Zones::remove_mock_zones();
}
}

View File

@ -82,15 +82,15 @@ class WC_Tests_Validation extends WC_Unit_Test_Case {
array( false, WC_Validation::is_postcode( '99999-ABC', 'BR' ) )
);
$ca = array(
array( true, WC_Validation::is_postcode( 'A9A 9A9', 'CA' ) ),
$ca = array(
array( true, WC_Validation::is_postcode( 'A9A 9A9', 'CA' ) ),
array( true, WC_Validation::is_postcode( 'A9A9A9', 'CA' ) ),
array( true, WC_Validation::is_postcode( 'a9a9a9', 'CA' ) ),
array( true, WC_Validation::is_postcode( 'a9a9a9', 'CA' ) ),
array( false, WC_Validation::is_postcode( 'D0A 9A9', 'CA' ) ),
array( false, WC_Validation::is_postcode( '99999', 'CA' ) ),
array( false, WC_Validation::is_postcode( 'ABC999', 'CA' ) ),
array( false, WC_Validation::is_postcode( '99999', 'CA' ) ),
array( false, WC_Validation::is_postcode( 'ABC999', 'CA' ) ),
array( false, WC_Validation::is_postcode( '0A0A0A', 'CA' ) )
);
);
return array_merge( $generic, $gb, $us, $ch, $br, $ca );
}