Commit Graph

690 Commits

Author SHA1 Message Date
Justin Shreve fb124232cf Update Payment Tokens to follow the same pattern for custom data as other object types.
Payment tokens was introduced in 2.6 and was updated to use the new CRUD code while some of the CRUD system was still in flux.

While most things were correct, the prop handling for custom fields (like a card's last 4 digits) were directly calling meta functions, instead of delegating to the data store/parent.

This PR moves these props to `extra_data` and follows the same pattern as product types or order items. It also updates some version tags to 3.0.0. Finally, it adds an additional test for saving meta after a create which looks like it was lacking.

To Test:
* Run `phpunit`.
* Go to the "My Account" tab and add a new payment method. You need a payment gateway that supports this, like Simplify.
* Test the add a payment method flow.
* Make a test purchase using the saved payment method.
2017-03-14 12:33:35 -07:00
Mike Jolley cbe6934f61 Try in sh file so 5.2 does not break 2017-03-14 17:17:35 +00:00
Mike Jolley 0aad398144 Add to travis yml 2017-03-14 17:11:02 +00:00
Mike Jolley 178888fbdb Travis script 2017-03-14 16:59:40 +00:00
Mike Jolley a3cc5cc9bb has_meta -> meta_exists
#13590

Avoid has_meta conflict with old method.

#13581
2017-03-14 16:49:13 +00:00
Mike Jolley 1740f1e3e8 Merge pull request #13590 from woocommerce/fix-13581
Add a has_meta method to WC_Data
2017-03-14 16:42:40 +00:00
Mike Jolley ed09c20715 Trying to fix travis tests 2017-03-14 12:50:54 +00:00
Mike Jolley 08c6cfdea8 composer version 2017-03-14 12:28:48 +00:00
Mike Jolley 6826dcbfe1 Tests for has_meta 2017-03-14 12:08:39 +00:00
Mike Jolley 38afff0031 Merge pull request #13516 from woocommerce/fix-13505
Make increase_usage_count work correctly on concurrent checkout
2017-03-10 19:07:57 +00:00
Mike Jolley 90b588be18 Merge branch 'master' into tests-13533 2017-03-10 12:01:41 +00:00
Mike Jolley e2552c0a8c Unit tests 2017-03-10 12:01:40 +00:00
Justin Shreve 9724b67ab8 Fix order item meta functions cache busting.
The cache busting currently in `wc_add_order_item_meta`, `wc_update_order_item_meta`, and `wc_delete_order_item_meta` doesn't actually bust anything. The cache line looks like it is from 2.6. The relevent cache to bust is actually in the `order-items` group and has a different key/prefix.
This bug allows your meta to get out of sync if you use these functions and then try to access a value from a CRUD object.

You can see this in the `test_wc_order_item_meta_functions` test I've added. If you keep your `wc-order-item-functions.php` as is, the asserts against `$item->get_meta` will fail.

To test:
* `phpunit --filter=test_wc_order_item_meta_functions`.
* Try before applying the `wc-order-item-functions.php` changes and after.
2017-03-09 13:36:23 -08:00
Justin Shreve cd92351dd7 Fix direct property access for coupon amount.
In 2.6, you could access the amount via $coupon->coupon_amount. Or legacy code incorrectly handles $coupon->amount instead. 7778583340/includes/class-wc-coupon.php (L102)

This PR handles both since the RCs and betas allowed `->amount` and I don't want to break anything that may be accessing it that way..

To Test:
* `phpunit --filter=test_coupon_backwards_compat_props_use_correct_getters`
2017-03-09 10:34:45 -08:00
Claudiu Lodromanean e36ee46dea Make increase_usage_count work correctly on concurrent checkoutt 2017-03-08 15:27:37 -08:00
Claudiu Lodromanean b645fc5513 Docblocks 2017-03-08 12:02:14 -08:00
Claudiu Lodromanean 3b8eb75c93 Better handling of nested arrays in apply_changes 2017-03-08 11:51:38 -08:00
Claudiu Lodromanean d0f47a7980 Revert to original behavior 2017-03-07 13:17:36 -08:00
Claudiu Lodromanean 955a75bf30 Fix changes and more tests 2017-03-07 11:58:02 -08:00
Claudiu Lodromanean 2436541fff Fix individual use coupon handling 2017-03-07 11:31:20 -08:00
Claudio Sanches e97c21c1cc Fixed unit tests 2017-03-03 16:36:53 -03:00
Claudiu Lodromanean d5fd1e46ee get_meta should return empty array sometimes 2017-03-02 11:16:49 -08:00
Claudiu Lodromanean 1eafb487d7 Allow invalid data store exceptions to bubble 2017-03-01 09:24:30 -08:00
Claudio Sanches 1eccb65d85 Fixed coding standards 2017-02-24 17:30:41 -03:00
Claudio Sanches e0cffc0934 Merge pull request #13329 from woocommerce/fix-13320
Delete cached object when updating stock
2017-02-23 18:20:40 -03:00
Claudiu Lodromanean 07a021760a 13320 Delete cached object when updating stock 2017-02-23 12:56:34 -08:00
Claudiu Lodromanean 252c08b943 Map legacy tax array keys to CRUD 2017-02-23 11:14:42 -08:00
Mike Jolley 4b4597524b Added unit tests for wc_product_force_unique_sku 2017-02-23 10:05:46 +00:00
Claudio Sanches 486a81bf12 Fixed coding standards 2017-02-17 16:10:15 -02:00
Claudio Sanches 8f38924fe0 Removed filter unit tests 2017-02-17 13:43:53 -02:00
Claudio Sanches 9c15ca936b Merge pull request #13206 from woocommerce/rest-api-v2
REST API v2
2017-02-16 12:53:46 -02:00
Claudio Sanches f08c10d068 Fixed and improved the variations endpoint 2017-02-16 03:07:51 -02:00
Claudio Sanches 1d82fbd8bf Fixed products tests 2017-02-16 01:52:10 -02:00
Claudiu Lodromanean ba2b767006 Modify tests for PHP 5.2 compat 2017-02-15 13:50:25 -08:00
Claudiu Lodromanean fd9d52a3f7 Modify test for PHP <5.4 compatibility 2017-02-15 12:07:35 -08:00
Claudiu Lodromanean e8579c649c Deprecated hook handler unit tests 2017-02-15 11:34:14 -08:00
Claudiu Lodromanean 469210b02b Minor formatting cleanup 2017-02-13 11:47:28 -08:00
Claudiu Lodromanean a8b491b55b Handle product titles with no attributes 2017-02-13 11:45:25 -08:00
Claudiu Lodromanean b6b3f0c217 Modify product title logic 2017-02-10 10:19:05 -08:00
Claudio Sanches 193fab24af Fixed REST API coupons endpoint tests 2017-02-09 20:13:02 -02:00
Claudiu Lodromanean a3f9207839 Add logic to variation title generation 2017-02-09 14:03:00 -08:00
Claudio Sanches 9ac1ebe748 Updated unit tests for REST API 2017-02-09 18:21:52 -02:00
Claudio Sanches 9e1e9783d2 Fixed unit tests in PHP 5.2 2017-02-09 11:33:18 -02:00
Mike Jolley b17932f4e3 Fix test due to invalid amount and caching 2017-02-09 12:04:44 +00:00
Claudio Sanches 9b0a4e6c92 Merge pull request #13109 from woocommerce/fix-regressed-tests
Fix failing tests and array_merge error
2017-02-08 16:18:08 -02:00
Claudiu Lodromanean 8ce5356943 13106 Dont round values in get_on_sale_products 2017-02-07 13:46:00 -08:00
Claudiu Lodromanean 173c09dd04 Fix failing tests and array_merge error 2017-02-07 10:46:03 -08:00
Claudio Sanches 1fe705547f Fixed REST API batch tests 2017-02-02 19:20:07 +01:00
Mike Jolley 40e9eabf9f Merge pull request #12983 from woocommerce/get_tax_classes
WC_Tax::get_tax_class_slugs()
2017-01-26 14:10:04 +00:00
Mike Jolley 9eaffcde42 Merge pull request #12980 from woocommerce/fix/payment-token-update-props
When updating payment tokens, only update the props that have changed & fire off a hook of the changed props.
2017-01-26 14:06:44 +00:00