-
Notifications
You must be signed in to change notification settings - Fork 815
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
Simple payments/show messages response #7495
Simple payments/show messages response #7495
Conversation
893bbb3
to
5214211
Compare
I merged #7409 into |
65b9c15
to
b233443
Compare
@iamtakashi done here cbdb5fe. Thanks. |
Props @iamtakashi for the suggestion.
5c02c3e
to
cbdb5fe
Compare
@@ -9,6 +9,7 @@ | |||
/* jshint unused:false */ | |||
var PaypalExpressCheckout = { | |||
sandbox: true, | |||
$purchaseMessageContainer: null, |
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.
why are we using $
to define a var in JavaScript?
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 jQuery convention. If something is jQuery object, we use $
in the var name to state that. It helps with differentiating it from standard html element object so you can expect it to have jQuery capabilities.
if ( PaypalExpressCheckout.$purchaseMessageContainer.hasClass( 'show' ) ) { | ||
PaypalExpressCheckout.$purchaseMessageContainer | ||
.removeClass( 'show success error' ) | ||
.html( '' ) |
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.
semicolon
This commit: 3fa3603 If the data sent to Paypal isn't consistent the request of the create endpoint will respond with some error which will be caught in the client-side. |
@@ -0,0 +1,17 @@ | |||
.jetpack-simple-payments__purchase-message { | |||
display: none; | |||
color: #fff; |
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 move only this color rule to a different block with a selector with a higher specificity so that it remains in white in most themes?
body .jetpack-simple-payments__wrapper p.jetpack-simple-payments__purchase-message {
color: #fff;
}
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.
Adding this now
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 fyi I've changed to div
instead of p
;
body .jetpack-simple-payments__wrapper div.jetpack-simple-payments__purchase-message {
color: #fff;
}
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.
Did it work? jetpack-simple-payments__purchase-message
is a <p>
isn't it? I've asked to change it to <p>
since most themes should have some spacing for it so that we don't have to add some arbitrary margin.
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.
@@ -55,9 +55,6 @@ var PaypalExpressCheckout = { | |||
throw new Error( 'PayPal module is required by PaypalExpressCheckout' ); | |||
} | |||
|
|||
// message DOM element instance |
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 idea here was create an instance of the button to use
padding: 1em; | ||
} | ||
|
||
body .jetpack-simple-payments__wrapper div.jetpack-simple-payments__purchase-message.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.
We don't need to add specificities to others. We only need the bloated selector for the <p>
.
body .jetpack-simple-payments__wrapper p.jetpack-simple-payments__purchase-message {
color: #fff;
}
The rest should just be fine as they were.
Are we displaying links in the message?
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 rest should just be fine as they were.
Let's rollback in #7500.
Are we displaying links in the message?
we were adding the emial address as a link. Let's cleaning it as well.
@jhnstn -- replying here to your P2 message re: successful purchase message. My main concern about the current version is that it's a bit repetitive and could be pared down just a bit. How about...
Alternatively, if the email can be considered a confirmation email, I'd just replace the second line with:
Let me know if you'd like one of the editors to look at any other loose copy bits here. And for future reference, you can still ping us directly here with @Automattic/editorial (which we encourage people to do in repos where you can't add the |
This is working as described. Merging now and we can make any further changes in follow up PR's |
This PR depending on #7409
This PR implements the ability to print the message when a transaction ends.
Testing
With Paypal sandbox account, click on the "Buy" button. After successful purchase, do you get a green success message? Try buying again. Does the message disappear when you click on the "buy" button again? Do you get the green success message after the second purchase?