Skip to content
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

Merged
merged 14 commits into from
Jul 22, 2017

Conversation

retrofox
Copy link
Contributor

@retrofox retrofox commented Jul 20, 2017

This PR depending on #7409

This PR implements the ability to print the message when a transaction ends.

image

simple-payments-message-5

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?

@artpi artpi force-pushed the simple-payments/cpt branch from 893bbb3 to 5214211 Compare July 20, 2017 15:47
@artpi
Copy link
Contributor

artpi commented Jul 21, 2017

I merged #7409 into feature/simple-payments branch. I am changing target of this PR to feature/simple-payments. Please rebase if need be.

@artpi artpi changed the base branch from simple-payments/cpt to feature/simple-payments July 21, 2017 12:01
@retrofox retrofox force-pushed the simple-payments/show-messages-response branch from 65b9c15 to b233443 Compare July 21, 2017 13:01
@iamtakashi
Copy link
Contributor

iamtakashi commented Jul 21, 2017

Just put together really quickly.

image

@lamosty
Copy link
Contributor

lamosty commented Jul 21, 2017

@iamtakashi done here cbdb5fe. Thanks.

@lamosty lamosty force-pushed the simple-payments/show-messages-response branch from 5c02c3e to cbdb5fe Compare July 21, 2017 17:20
@lamosty lamosty mentioned this pull request Jul 21, 2017
@lamosty lamosty changed the title [WIP] Simple payments/show messages response Simple payments/show messages response Jul 21, 2017
@lamosty lamosty added the [Status] Needs Review This PR is ready for review. label Jul 21, 2017
@@ -9,6 +9,7 @@
/* jshint unused:false */
var PaypalExpressCheckout = {
sandbox: true,
$purchaseMessageContainer: null,
Copy link
Contributor Author

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?

Copy link
Contributor

@lamosty lamosty Jul 21, 2017

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( '' )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semicolon

@retrofox
Copy link
Contributor Author

When the page has more than one button the response is propagated into all of them.

simple-payments-message-2

@retrofox
Copy link
Contributor Author

When a button is clicked it should clean only its own message.

simple-payments-message-3

@retrofox
Copy link
Contributor Author

Before these changes when the transactions failed we were showing the error. Now it's silenced.

image

@retrofox
Copy link
Contributor Author

Before these changes when the transactions failed we were showing the error. Now it's silenced.

image

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;
Copy link
Contributor

@iamtakashi iamtakashi Jul 21, 2017

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;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this now

Copy link
Contributor Author

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;
}

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry Takashi. I didn't see your comment last night. It was tacked in this commit 59ea83a of the #7500

@@ -55,9 +55,6 @@ var PaypalExpressCheckout = {
throw new Error( 'PayPal module is required by PaypalExpressCheckout' );
}

// message DOM element instance
Copy link
Contributor Author

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 {
Copy link
Contributor

@iamtakashi iamtakashi Jul 21, 2017

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?

Copy link
Contributor Author

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.

@benhuberman
Copy link

@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...

Thank you, [buyer name]! Your purchase was successful.
We just sent you an email with complete purchase details to [email address].

Alternatively, if the email can be considered a confirmation email, I'd just replace the second line with:

We just sent you a confirmation email to [email address].

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 needs copy review label).

@jhnstn jhnstn removed the [Status] Needs Review This PR is ready for review. label Jul 22, 2017
@jhnstn jhnstn merged commit d5c7477 into feature/simple-payments Jul 22, 2017
@jhnstn
Copy link
Member

jhnstn commented Jul 22, 2017

This is working as described. Merging now and we can make any further changes in follow up PR's

@jhnstn jhnstn deleted the simple-payments/show-messages-response branch July 22, 2017 05:21
@jeherve jeherve added the [Feature] Pay with PayPal aka Simple Payments label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Pay with PayPal aka Simple Payments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants