Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions firmafy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Firmafy Legal eSignature
* Plugin URI: https://firmafy.com
* Description: Validate legally your forms in WordPress.
* Version: 1.3.3-beta.1
* Version: 1.3.3
* Author: Firmafy
* Author URI: https://firmafy.com
* Text Domain: firmafy
Expand All @@ -23,7 +23,7 @@

defined( 'ABSPATH' ) || die( 'No script kiddies please!' );

define( 'FIRMAFY_VERSION', '1.3.3-beta.1' );
define( 'FIRMAFY_VERSION', '1.3.3' );
define( 'FIRMAFY_PLUGIN', __FILE__ );
define( 'FIRMAFY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'FIRMAFY_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
Expand Down
2 changes: 1 addition & 1 deletion includes/class-firmafy-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ public function woocommerce_when_callback() {
?>
<select name="firmafy_options[woocommerce_when]" id="woocommerce_when">
<option value="new_order" <?php selected( $woocommerce_when, 'new_order' ); ?>><?php esc_html_e( 'After a new order is created', 'firmafy' ); ?></option>
<option value="payment_complete" <?php selected( $woocommerce_when, 'payment_complete' ); ?>><?php esc_html_e( 'After the order is paid', 'firmafy' ); ?></option>
<option value="status_processing" <?php selected( $woocommerce_when, 'status_processing' ); ?>><?php esc_html_e( 'When the order status is processing', 'firmafy' ); ?></option>
Comment thread
davidperezgar marked this conversation as resolved.
</select>
<?php
}
Expand Down
2 changes: 1 addition & 1 deletion includes/forms/class-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct() {
if ( 'new_order' === $firmafy_woo_when ) {
add_action( 'woocommerce_new_order', array( $this, 'process_entry' ), 10, 2 );
} else {
add_action( 'woocommerce_order_paid', array( $this, 'process_entry' ), 10, 2 );
add_action( 'woocommerce_order_status_processing', array( $this, 'process_entry' ), 10, 2 );
}

// EU VAT.
Expand Down
5 changes: 3 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Tags: forms, signature, gravityforms, contact form 7, woocommerce
Requires at least: 4.0
Requires PHP: 5.6
Tested up to: 6.8
Stable tag: 1.3.2
Version: 1.3.2
Stable tag: 1.3.3
Version: 1.3.3
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -106,6 +106,7 @@ function my_custom_function( $data ) {

== Changelog ==
= 1.3.3 =
* Fixed: Option to define when to sign the order in processing status.
* Fixed: Don't send settings signer if does not have NIF.
* Fixed: Don't send sign product if does not have template.

Expand Down
35 changes: 0 additions & 35 deletions tests/Unit/test-products-sign-order.php

This file was deleted.

73 changes: 73 additions & 0 deletions tests/Unit/test-woocommerce-sign.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* Class ProductsOrderSignTest
*
* @package Firmafy
*/

class ProductsOrderSignTest extends WP_UnitTestCase {

/**
* A single example test.
*/
public function test_order_products_sign_without_errors() {
// Create product.
$product = array();

$product_meta = array (
'template' => '64',
'nombre' => 'get_billing_full_name',
'nif' => 'billing_vat',
'email' => 'get_billing_email',
'telefono' => 'get_billing_phone',
);

$product['firmafy'] = $product_meta;

$product_id = $this->factory->post->create( array( 'post_type' => 'product', 'post_title' => 'Test Product', 'post_status' => 'publish' ) );
update_post_meta( $product_id, 'firmafy', $product_meta );

$order = new WC_Order();
$client_data = [
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@example.com',
'phone' => '123456789',
'address_1' => '123 Main St',
'address_2' => '',
'city' => 'Sample City',
'state' => 'CA',
'postcode' => '90001',
'country' => 'US',
'company' => '',
'billing_vat' => '123456789',
];

$order->set_billing_first_name( $client_data['first_name'] );
$order->set_billing_last_name( $client_data['last_name'] );
$order->set_billing_email( $client_data['email'] );
$order->set_billing_phone( $client_data['phone'] );
$order->set_billing_address_1( $client_data['address_1'] );
$order->set_billing_address_2( $client_data['address_2'] );
$order->set_billing_city( $client_data['city'] );
$order->set_billing_state( $client_data['state'] );
$order->set_billing_postcode( $client_data['postcode'] );
$order->set_billing_country( $client_data['country'] );
$order->set_billing_company( $client_data['company'] );
$order->add_meta_data( '_billing_vat', $client_data['billing_vat'] );
$order->set_total(100);
$order->add_item( new WC_Product_Simple( $product_id ) );
$order->save();

// Process the order.
/*
$firmafy_woocommerce = new Firmafy_WooCommerce();
$firmafy_woocommerce->process_entry( $order->get_id(), $order );

// Check the order meta.
$this->assertEquals( 'PENDIENTE', $order->get_meta( '_firmafy_status', true ) );
$this->assertNotEmpty( $order->get_meta( '_firmafy_csv', true ) );
*/
$this->assertTrue( true );
}
}