-
Notifications
You must be signed in to change notification settings - Fork 213
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
Credit card management updates #14670
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14670 +/- ##
==========================================
+ Coverage 72.32% 72.40% +0.07%
==========================================
Files 120 121 +1
Lines 3404 3424 +20
Branches 1172 1179 +7
==========================================
+ Hits 2462 2479 +17
- Misses 917 920 +3
Partials 25 25
|
cb9ec35
to
4ef9df2
Compare
36dfd12
to
d54aff8
Compare
8a3e0e1
to
e6672de
Compare
</div> | ||
<div class="col-8"> | ||
<div class="u-align--left col-8 col-medium-4 col-small-3"> | ||
<p class="p-heading--4 u-no-margin--bottom">You have no payment method saved</p> |
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.
I think margin-bottom
should be 0. margin-bottom
is -0.45rem !important; because of this class u-no-margin--bottom
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.
I always though it was the same... Done, thanks!
</div> | ||
<div class="col-8"></div> | ||
</div> | ||
<hr class="{% if not default_payment_method.id %}u-hide{% endif %}" /> |
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.
I think the line should always show?
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.
This is the line at the bottom of the card form. I think it should not be there when there's no card?
</div> | ||
<div class="col-4 u-align--right"> | ||
<button class="p-button" id="cancel-payment-details">Cancel</button> | ||
<button class="p-button--positive" id="update-payment-details" disabled>Update</button> |
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.
Should this be "Save" or "Update"?
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.
Good 👀 Let's use "Save" that works for both editing and adding.
style="margin-top: 2rem"> | ||
<div class="col-8"> | ||
<div id="card-element"></div> | ||
<span id="card-errors" class="p-form-validation__message u-hide"></span> |
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.
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.
The styles are different across pages. I tried to keep that part as is.
<div class="col-4 u-align--right"> | ||
{% if default_payment_method["id"] %}<button class="p-button" id="cancel-payment-details">Cancel</button>{% endif %} | ||
<button class="p-button--positive" id="update-payment-details" disabled>Update</button> | ||
<div id="edit-payment-method-section" |
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.
it's minor but in design, there seems to be more space between the title "Payment method" and the input area.
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.
True. I can wrap the h1 in a section to give the layout a bit more vertical space. But having tried that, I think it looks a bit strange, and it's inconsistent with other pages. So I would suggest keeping it as it is.
@@ -36,6 +41,16 @@ const Notifications = () => { | |||
|
|||
return ( | |||
<> | |||
{hasPaymentMethod === false ? ( |
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.
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.
That's a good question for @polgarp
<p> | ||
We will save your card information. You can change it in your Ubuntu | ||
Pro Dashboard. | ||
</p> |
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.
Distributor users don't have access to the Pro dashboard, but this message is also showing in the checkout for them. Should we display this differently for distributor users?
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.
cc: @polgarp
@@ -36,6 +41,16 @@ const Notifications = () => { | |||
|
|||
return ( | |||
<> | |||
{hasPaymentMethod === false ? ( |
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.
can we simply use !hasPaymentMethod &&
instead of the ternary operator here?
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.
Using &&
for conditional rendering is a debated topic in react. I don't have a strong opinion and I use both depending on the situation. This time I went with the ternary because that's what the rest of the file is using.
As for the === false
, it's a way to make sure that the notification doesn't show up when hasPayment
method is undefined
(since it's returned by a hook, it's going to be undefined
at first). As an alternative (and maybe more common) I can check for when the query is done, like:
isHasPaymentMethodSuccess && !hasPaymentMethod ? <Notificacion /> : null
Let's try that.
@@ -75,7 +76,7 @@ const generateError = (error: Error | null) => { | |||
return ( | |||
<span data-test="has-pending-purchase-error"> | |||
You already have a pending purchase. Please go to{" "} | |||
<a href="/account/payment-methods">payment methods</a> to retry. | |||
<a href="/account/payment-methods">payment method</a> to retry. |
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.
we can use {urls.account.paymentMethods}
instead of /account/payment-methods
here as well
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.
True, I didn't realise
Looking good @andesol I've just made some comments for what I found 👍 |
f4a1b73
to
2d0b0dd
Compare
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.
Thanks @minkyngkm! I addressed some of your comments. As discussed before, we want to keep the autorenewal independent from this change.
Seems like we have something to clarify before this can land, plus a back-end issue. So let's keep it on hold for now.
<div> | ||
{% if not is_in_maintenance %}<a class="p-button--positive" href="/pro/subscribe">Buy new subscription</a>{% endif %} | ||
<a class="p-button" href="/account/invoices">Invoices</a> | ||
<a class="p-button" href="/account/payment-methods">Payment method</a> |
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.
This is the only real change. Rest is formatting
@@ -36,6 +41,16 @@ const Notifications = () => { | |||
|
|||
return ( | |||
<> | |||
{hasPaymentMethod === false ? ( |
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.
That's a good question for @polgarp
<p> | ||
We will save your card information. You can change it in your Ubuntu | ||
Pro Dashboard. | ||
</p> |
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.
cc: @polgarp
<div class="col-4 u-align--right"> | ||
{% if default_payment_method["id"] %}<button class="p-button" id="cancel-payment-details">Cancel</button>{% endif %} | ||
<button class="p-button--positive" id="update-payment-details" disabled>Update</button> | ||
<div id="edit-payment-method-section" |
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.
True. I can wrap the h1 in a section to give the layout a bit more vertical space. But having tried that, I think it looks a bit strange, and it's inconsistent with other pages. So I would suggest keeping it as it is.
@@ -36,6 +41,16 @@ const Notifications = () => { | |||
|
|||
return ( | |||
<> | |||
{hasPaymentMethod === false ? ( |
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.
Using &&
for conditional rendering is a debated topic in react. I don't have a strong opinion and I use both depending on the situation. This time I went with the ternary because that's what the rest of the file is using.
As for the === false
, it's a way to make sure that the notification doesn't show up when hasPayment
method is undefined
(since it's returned by a hook, it's going to be undefined
at first). As an alternative (and maybe more common) I can check for when the query is done, like:
isHasPaymentMethodSuccess && !hasPaymentMethod ? <Notificacion /> : null
Let's try that.
style="margin-top: 2rem"> | ||
<div class="col-8"> | ||
<div id="card-element"></div> | ||
<span id="card-errors" class="p-form-validation__message u-hide"></span> |
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.
The styles are different across pages. I tried to keep that part as is.
</div> | ||
<div class="col-4 u-align--right"> | ||
<button class="p-button" id="cancel-payment-details">Cancel</button> | ||
<button class="p-button--positive" id="update-payment-details" disabled>Update</button> |
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.
Good 👀 Let's use "Save" that works for both editing and adding.
</div> | ||
<div class="col-8"></div> | ||
</div> | ||
<hr class="{% if not default_payment_method.id %}u-hide{% endif %}" /> |
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.
This is the line at the bottom of the card form. I think it should not be there when there's no card?
</div> | ||
<div class="col-8"> | ||
<div class="u-align--left col-8 col-medium-4 col-small-3"> | ||
<p class="p-heading--4 u-no-margin--bottom">You have no payment method saved</p> |
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.
I always though it was the same... Done, thanks!
Done
QA
Issue
https://warthogs.atlassian.net/browse/WD-18327