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

Membership Block #9802

Merged
merged 63 commits into from Apr 29, 2019

Conversation

@artpi
Copy link
Contributor

commented Jun 19, 2018

This is the first PR of the block that is intended to provide something that beta users can test. We intend to work in small iterations and we will gladly address feedback in later PRs.

This introduces membership-button block to Jetpack.
This essentially will be a recurring donation button.

Purpose of the code in this PR is to:

  • introduce endpoints that communicate with WPCOM
  • whitelist certain options, CPTs and meta to store / sync data,
  • introduce gutenberg block that uses these endpoints and provides UI to connect to Stripe, create and choose a product
  • introduce a frontend of a block with the sole purpose of displaying a checkout window from wpcom in an iframe

This needs D26086-code . - deployed

Screenshots

Zrzut ekranu 2019-03-27 o 18 17 26

Zrzut ekranu 2019-03-27 o 17 41 59

Zrzut ekranu 2019-03-27 o 17 47 59

Internal references:

p89M8K-4a-p2
p1HpG7-6n6-p2

Testing instructions - Jurassic Ninja

The problem with this is that you can only use real money and real stripe accounts. If you want sandbox payments, you need to use the ngrok flow

  1. https://jurassic.ninja/create/?jetpack-beta&branch=add/memberships
  2. Connect Jetpack, enable "BETA_BLOCKS" in /wp-admin/options-general.php?page=companion_settings
  3. Go to editor
  4. Search for "Membership button" block
  5. You will get a placeholder that will say "connect to stripe", click that
  6. If you correctly set up the store sandbox, you will get "you can skip this form" at the top, click that
  7. You will get redirected to ugly looking page on success
  8. Now go back to gutenberg, click "Re-check Connection", wait
  9. Now you should have a button to add product, click it, fill the form
  10. choose your new product
  11. Publish the page
    12 Go to frontend, click the button that says contribution
  12. go with the flow

Testing instructions - Jetpack Docker

  1. Set up Jetpack with docker and ngrok.io, connnect jetpack
  2. Remember to turn on beta blocks
define( 'GUTENBERG_DEVELOPMENT_MODE', true );
define( 'JETPACK_BETA_BLOCKS', true );
  1. Checkout this PR
  2. Build blocks by
yarn build-extensions
  1. Continue from point 3. in the previous instruction

@artpi artpi requested a review from Automattic/jetpack as a code owner Jun 19, 2018

@oskosk

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2018

@artpi there are a few JS linting messages on the test runs:

modules/memberships/memberships.js
  line 23  col 76  Strings must use singlequote.
  line 24  col 40  Strings must use singlequote.
  line 25  col 97  Strings must use singlequote.
  line 26  col 60  Strings must use singlequote.
  line 26  col 86  Strings must use singlequote.
  line 27  col 29  Strings must use singlequote.
  line 11  col 13  'console' is not defined.
  line 16  col 13  'tb_remove' is not defined.
  line 30  col 13  'tb_show' is not defined.

@stale stale bot added the [Status] Stale label Sep 27, 2018

@jeherve jeherve added the Memberships label Sep 27, 2018

@stale stale bot removed the [Status] Stale label Sep 27, 2018

@stale stale bot added the [Status] Stale label Dec 27, 2018

@artpi artpi removed the [Status] Stale label Dec 28, 2018

@artpi artpi force-pushed the add/memberships branch from 34c1073 to 2836273 Mar 25, 2019

@artpi artpi requested a review from Automattic/jetpack-crew as a code owner Mar 25, 2019

@artpi artpi force-pushed the add/memberships branch from 2836273 to a72a7c4 Mar 27, 2019

@Automattic Automattic deleted a comment from stale bot Mar 27, 2019

@Automattic Automattic deleted a comment from stale bot Mar 27, 2019

@Automattic Automattic deleted a comment from jetpackbot Mar 27, 2019

@jetpackbot

This comment has been minimized.

Copy link

commented Mar 27, 2019

Warnings
⚠️ "Proposed changelog entry" is missing for this PR. Please include any meaningful changes

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS against a2c7318

@jeherve
Copy link
Member

left a comment

Just a few minor comments, I have not had the time to fully test this yet.

Also, and since we are introducing a bunch a new files, what do you think about adding them all to the pre-commit hook here in Jetpack?

'class.jetpack-plan.php',

We've been trying to do that for all new files to slowly move towards better code coverage in the plugin.

Show resolved Hide resolved _inc/lib/core-api/wpcom-endpoints/memberships.php Outdated
Show resolved Hide resolved extensions/blocks/membership-button/index.js
Show resolved Hide resolved modules/memberships/class-jetpack-memberships.php
Show resolved Hide resolved modules/memberships/class-jetpack-memberships.php Outdated
Show resolved Hide resolved modules/memberships/class-jetpack-memberships.php Outdated
Show resolved Hide resolved modules/module-extras.php Outdated

@jeherve jeherve requested a review from Mar 28, 2019

artpi and others added some commits Apr 23, 2019

Code review suggested edits - mostly copy
Co-Authored-By: artpi <artur.piszek@gmail.com>

@jeherve jeherve force-pushed the add/memberships branch from 3f8aa11 to 7956f6a Apr 29, 2019

blockers have been fixed

@jeherve
Copy link
Member

left a comment

Let's merge this now and address the feedback in future PRs.

It's worth noting that I'm currently having issues inserting new amounts. I get the following JavaScript error when I try to submit a new amount:

Uncaught (in promise) TypeError: Cannot read property 'id' of null
    at eval (edit.jsx:194)

This matches the following error on WordPress.com:

Fatal error: Uncaught Error: Call to undefined method WP_Error::to_array() in [...]jetpack-endpoints/memberships.php:105

@kraftbj kraftbj merged commit e9589a3 into master Apr 29, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
wpcom Status applied manually.
Details
@kraftbj

This comment has been minimized.

Copy link
Contributor

commented Apr 29, 2019

Merged, but let's definitely address the API this week (Crew) and this new error asap (@artpi).

@kraftbj kraftbj deleted the add/memberships branch Apr 29, 2019

kraftbj added a commit that referenced this pull request Apr 30, 2019

@kraftbj kraftbj referenced this pull request May 2, 2019

Merged

Remove JP Constants #24

@BurlesonBrad

This comment has been minimized.

Copy link

commented May 9, 2019

I'm not wanting to go down the coding rabbit hole any more, but here's an innertubes show for ya to see and watch what happens:
http://youtu.be/SNxLOaHWAt8?hd=1

First, It says I'm NOT connected to the Pack-O-Jets. Which, I am!! I've paid for the Premium Jets:
image

After the "You ain't connected to the Packs de La Jets" prompt, the "Connect to Stripe" button can't be clicked at all.

Great, first it prompts me that my Packs don't get to connect with any Jets. And now they don't get to have any Stripes either. Awesomesauce. 😭

I turned on my Beta Blockers and loaded up the Gutenberries as well 👍

image

Well. That didn't help either 😢

So, I decided to retry the Stripes, the Memberships, The Guttenberries, and the PacksOfJets again at 00:36 & still nothing https://youtu.be/SNxLOaHWAt8?t=36

@jeherve

This comment has been minimized.

Copy link
Member

commented May 10, 2019

@BurlesonBrad That error message should be displayed when the user you are logged in with is not linked to any WordPress.com account.

When you originally connected your site to WordPress.com, you did so while logged in as an admin on your site. If another admin wants to use the Memberships block, they'll need to link their own account to WordPress.com first. Does that make sense, and apply to you here, or do you see that error message while logged in with the admin account you used when you first connected your site to WordPress.com?

If the error appears even though the account you are currently logged in with is linked to WordPress.com, could you contact us via this form so we can run more tests with you and get this fixed?

Thank you!

@BurlesonBrad

This comment has been minimized.

Copy link

commented May 10, 2019

Yessir. In that quick vid and the screenshot as well, both are logged in and connected to the same WP.com account that I've had since dinosaurs roamed the planet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.