You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use recommended order currency API for multicurrency subscription renewal | switch | resubscribe (#4228)
* use recommended `WC_Order::get_currency()` for getting renewal currency:
- previously used raw `get_post_meta()`
- this is no longer recommended, and could break on stores using
(forthcoming) custom order tables
* add changelog
* convert id to order/subscription object before calling get_currency:
- fix logic issue in previous commit
* fix fatal error on resubscribe – get subscription from ID
* fix override_selected_currency test for renewal case:
- Make a real order with non-default currency - integration test style.
- Enhance mock_wcs_cart_contains_renewal so test can customise
product and renewal order ids.
- Mock the real order instead of hacking post meta (legacy implementation detail).
- Fix up all uses of mock_wcs_cart_contains_renewal() for new signature.
* Repair multicurrency sub switch unit test:
- Rename / update comment to clarify test scope.
- Mock up a real order (aka subscription) with custom currency.
- Mock that order idea in $_GET request params.
* repair multicurrency subs switch in cart unit test:
- use WC_Order for mock subscription
- mock subscription and cart APIs as needed
* refactor mock_wcs_get_order_type_cart_items so can pass a real order id
* repair multicurrency sub resubscribe unit test:
- parameterise wcs_get_order_type_cart_items so can use real order id
- mock sub (order) and wcs_get_subscription to return mocked sub
- it's fine right
* remove a bunch of extraneous whitespace / php linter fixes
* remove extraneous whitespace / php linter fixes
* add local wrapper for wcs_get_subscription() – attempt psalm fix:
- ERROR: UndefinedFunction
$switch_subscription = wcs_get_subscription( $switch_cart_item['subscription_switch']['subscription_id'] );
* fix mismatched param name in docblock for get_subscription wrapper
* remove incorrect return type (array) from get_subscription test helper +
+ clarify true type in docblock comment
* remove whitespace offending the linter
* rename subscription variable – it's resubscribe not switch
Co-authored-by: Rua Haszard <[email protected]>
0 commit comments