-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving the handling of express method titles #3844
Open
wjrosa
wants to merge
25
commits into
develop
Choose a base branch
from
dev/improving-handling-of-ece-method-titles
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5964a5c
Hiding actions for pending Amazon Pay orders
wjrosa d087e0b
Improving the handling of express method titles
wjrosa 7dd9b52
Checking for order received page
wjrosa 15c0fdf
Adding specific unit tests
wjrosa 8bf1210
Readme and changelog entries
wjrosa 2b0870c
Adding specific unit tests
wjrosa ecef98d
Adding specific unit tests
wjrosa cbddf33
Changelog and readme entries
wjrosa 30ae66d
Revert automatic PHPCS fix
wjrosa d5a3bb1
Merge branch 'tweak/hiding-actions-for-pending-amazon-pay-orders' int…
wjrosa 908a8df
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
wjrosa f342132
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
wjrosa f404e83
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
diegocurbelo 9761184
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
wjrosa 59bad51
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
wjrosa 7cdf96e
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
wjrosa 3f9b85f
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
wjrosa 27eb069
Merge branch 'dev/improving-handling-of-ece-method-titles' of https:/…
wjrosa bc554a2
Fix changelog and readme entries
wjrosa f523739
Improving handling of BACS debit payment method title
wjrosa 28cd97a
Merge branch 'develop' into dev/improving-handling-of-ece-method-titles
wjrosa 49851d3
Refactor implementation removing constant class following review comm…
wjrosa e7d8eec
Minor refactoring
wjrosa c6c0890
Fix tests + updating missing occurrences
wjrosa 12561e4
Minor refactor
wjrosa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,11 @@ public function __construct() { | |
* @return string | ||
*/ | ||
public function get_title( $payment_details = false ) { | ||
$wallet_type = WC_Stripe_Payment_Methods::AMAZON_PAY === ( $payment_details->type ?? null ) ? WC_Stripe_Payment_Methods::AMAZON_PAY : ( $payment_details->card->wallet->type ?? null ); | ||
if ( WC_Stripe_Payment_Methods::AMAZON_PAY === ( $payment_details->type ?? null ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just making it easier to read. |
||
return $this->get_card_wallet_type_title( WC_Stripe_Payment_Methods::AMAZON_PAY ); | ||
} | ||
|
||
$wallet_type = $payment_details->card->wallet->type ?? null; | ||
if ( $payment_details && $wallet_type ) { | ||
return $this->get_card_wallet_type_title( $wallet_type ); | ||
} | ||
|
@@ -126,24 +130,13 @@ public function get_testing_instructions() { | |
* @return string The title for the card wallet type. | ||
*/ | ||
private function get_card_wallet_type_title( $express_payment_type ) { | ||
$express_payment_titles = [ | ||
'apple_pay' => 'Apple Pay', | ||
'google_pay' => 'Google Pay', | ||
WC_Stripe_Payment_Methods::AMAZON_PAY => 'Amazon Pay', | ||
]; | ||
|
||
$payment_method_title = $express_payment_titles[ $express_payment_type ] ?? false; | ||
$express_payment_titles = WC_Stripe_Payment_Methods::EXPRESS_METHODS_LABELS; | ||
$payment_method_title = $express_payment_titles[ $express_payment_type ] ?? false; | ||
|
||
if ( ! $payment_method_title ) { | ||
return parent::get_title(); | ||
} | ||
|
||
$suffix = apply_filters( 'wc_stripe_payment_request_payment_method_title_suffix', 'Stripe' ); | ||
|
||
if ( ! empty( $suffix ) ) { | ||
$suffix = " ($suffix)"; | ||
} | ||
|
||
return $payment_method_title . $suffix; | ||
return $payment_method_title . WC_Stripe_Express_Checkout_Helper::get_payment_method_title_suffix(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making it easier to read. And fixing the suffix part (it is dynamic).