Commit Graph

32 Commits

Author SHA1 Message Date
Gerhard Potgieter cb87a0ee54 PHPCS passing for abstract-wc-payment-token.php 2018-03-05 13:54:54 +02:00
Justin Shreve b917a87a73 Deprecated $context on get_display_name. 2017-03-15 08:21:02 -07:00
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
Claudio Sanches 486a81bf12 Fixed coding standards 2017-02-17 16:10:15 -02:00
Mike Jolley b37e4da43c Move legacy classes to correct dir 2017-02-16 16:39:56 +00:00
Justin Shreve 174aa38be6 Start moving meta to normal stores, instead of a separate meta store. 2016-11-22 04:05:05 -08:00
Claudio Sanches f5a228509a Fixed coding standards 2016-11-17 18:07:58 -02:00
Justin Shreve 944e5d658b Handle feedback 2016-11-14 09:08:46 -08:00
Justin Shreve 370166a6b0 Payment Token Data Store 2016-11-14 06:20:41 -08:00
Justin Shreve 1797c76a14 Implement WC_Data_Store and related code & tests. 2016-11-08 01:39:47 -08:00
Justin Shreve e1e6c682b5 * Stop using _ as a prefix for protected or private vars and functions. We have a keyword for that.
* Introduces set_id and get_id to WC_Data for the CRUD classes to share
2016-09-09 05:36:54 -07:00
Aristeides Stathopoulos 39d4d4bd69 Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar 2016-09-02 05:40:36 +03:00
Aristeides Stathopoulos f2730eea02 WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd 2016-08-27 08:57:05 +03:00
Mike Jolley d70cfa0c74 white space issues 2016-06-06 20:04:45 +01:00
Scrutinizer Auto-Fixer 7cef8ae4c9 Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2016-06-06 16:50:18 +00:00
Mike Jolley 2ba9029624 Suit CSS and method tidyup for saved methods form
cc @jameskoster
2016-05-26 12:42:32 +01:00
Mike Jolley 39b7b6ba51 get_type_to_display method 2016-05-26 12:42:32 +01:00
Joey Kudish bde619c4d6 Fix for older versions of php
Older versions of php cannot check `empty()` with a non-variable. Fixes
fatal introduced in 1d35fd6d73
2016-03-22 17:36:24 -07:00
Justin Shreve 1d35fd6d73 Convert WC_Payment_Tokens (and CC/eCheck tokens) to use the new WC_Data and meta handling code. 2016-03-21 11:06:17 -07:00
Justin Shreve 97c0edf445 Start on tests for testing CRUD meta.
Includes Mock object for testing against the abstract WC_Data.
2016-03-14 11:12:47 -07:00
Justin Shreve 5dbfc7ae16 Fix Payment Token 'set default' methods. Makes sure we are using the user ID of the payment token, and not the current user.
Also makes sure to properly unset other tokens when a new one is set as default. Finally, we make sure that a user is always set in our payment token tests (which was broken in some WP versions which alerted us to some broken tests).
2016-03-14 09:41:37 -07:00
Justin Shreve 49c45c6dc1 Make sure the is_default/default token ability works correctly. Also adds a new method for getting a users default token. Fixes up some docblocks. 2016-03-01 11:49:42 -08:00
Justin Shreve 5d8967c7d7 Prepare a list of payment methods for output on the payment methods "my account" page. 2016-03-01 11:49:40 -08:00
Justin Shreve 0061b36f3b Make sure WP knows about the payment token meta table, and return null in payment tokens get if a token cannot be found. 2016-03-01 11:49:39 -08:00
Justin Shreve df260c228d Prevent notice from being displayed for user_id and remove static on echeck validate 2016-03-01 11:49:39 -08:00
Justin Shreve 7b57b4c4cc Validate length for expiry - 4 chars for year and 2 for month. 2016-03-01 11:49:39 -08:00
Justin Shreve 214f077a91 Implement the rest of the WC_Data methods for creating, updating, reading, etc. 2016-03-01 11:49:39 -08:00
Justin Shreve c87c99f847 Start implementing the WC_Data interface. Move update, create, save, etc to the actual token class, and have the controller return our tokens. This matches the shipping zone API closer. 2016-03-01 11:49:39 -08:00
Justin Shreve f66b9e3681 Move meta (when creating) to its own sub meta array. 2016-03-01 11:49:39 -08:00
Justin Shreve f66a8b6478 Rename customer_id to user_id to match how orders reference the user. 2016-03-01 11:49:39 -08:00
Justin Shreve 6112752836 Misc cleanup based on PR feedback:
* Remove $token_id parameter from WC_Order's add_payment_token. get_id() can be used to access the ID
* Rename our list of token ids from meta to $token_ids as it makes more sense
* Cleaned up/fixed some of the comments in WC_Payment_Token
* Some code formatting fixes
2016-03-01 11:49:38 -08:00
Justin Shreve c5aec06a8a First pass at a payment token API 2016-03-01 11:49:37 -08:00