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

Stripe Connect and Multi-Shop Checkout #2682

Merged
merged 62 commits into from
Aug 22, 2017

Conversation

spencern
Copy link
Contributor

@spencern spencern commented Aug 15, 2017

New Features

  1. Stripe Connect Integration - removes old payments-stripe-connect package and enables stripe connect on payments-stripe package.
  • Permits merchants to signup for stripe from within their merchant shop dashboard
  • Provides link to stripe dashboard for merchant
  • Creates a separate charge for each merchant involved in an order and rolls them up into a single order with multiple payments and shipments per order
  • Core rewrite of stripe payment integration to be simpler to reason about
  1. Multi-shop tax calculation
  2. Multi-shop cart transform methods
  3. Better Package subscription management to ensure that routes are available when needed
  4. New register.js registry options
  • showForShopType - Display this template only to shop types listed in the array
  • hideForShopType - Display this template to any shop type not listed in the array
  1. New registry provides options
  • marketplaceMerchantSettings - templates that provide marketplaceMerchantSettings will be listed in the marketplaceMerchantSetting section of the Shops dashboard panel
    image

To Test:

  1. Setup primary shop
  • Setup Taxes Use "Custom Rates" package instead of TaxCloud or Avalara
  • Setup shipping
  • Setup stripe, including Stripe Connect Client ID (ca_xxx)
  • Invite new shop owner from Shops -> Marketplace dashboard panel
  1. Setup Marketplace Shop
  • Create and publish a product as a 2nd marketplace owner
  • Connect Stripe Connect account in the Shops -> My Shop Settings
  • Setup tax rates using "Custom Rates" package
  1. Checkout as a non-shop-owner user. You must have an account with an email to complete checkout with Stripe Connect.

Notes:

  • You may need to setup different product publications for marketplace to add multiple shops products to your cart as a non-logged in user. I've got some example publications that I'll upload in a different branch that enable this, but they are not ready for merging into the main branch yet. I'll link here to those soon.

Demo Video: https://soapbox.wistia.com/videos/hsaL6MEH4u

Caveats:

  1. Will not work as is with Tax Settings other than the Custom Rates tax plugin
  2. Multi-shop checkout will not work with any provider other than Stripe
  3. You cannot capture, refund, or otherwise process the stripe connect charges through Reaction at this time. Those our Stripe methods that handle those actions need to be updated to use connect when necessary
  4. You cannot checkout anonymously with Stripe connect - we can discuss options to circumvent this if necessary, but for now, if you want to checkout with connect/multi-shop you must have an account
  5. Shipping is charged for each shop, there is not currently a way to permit shops to set up their own shipping. I don't imagine it would be too difficult of a change to update the shipping providers to work with multi-shop checkout, but I haven't done it yet.
  6. I haven't updated the tests yet to account for multi-shop stripe payments

This is a very large PR with more files than I wanted to touch. Part of why I'm cutting it off now and not continuing to implement the remaining stripe methods, taxes, and shipping.

marketplaceMerchantSettings only shows up for non-primary shop owners.
Will be used for stripe merchant account setup and other merchant specific settings
only show switch to primary shops if marketplace is enabled.
This should probably replace getPackageSettingsWith options, but not sure what our deprecation path should look like right now.
Also adjusts getSummary function to support shopId filtered reducers
For some reason two auths in Stripe equal an auth then immediate deauthorization
…stripe-connect-merchant-signup

# Conflicts:
#	imports/plugins/included/payments-stripe-connect/server/i18n/ar.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/bg.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/cs.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/de.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/el.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/es.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/fr.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/he.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/hr.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/hu.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/it.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/my.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/nb.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/nl.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/pl.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/pt.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/ro.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/ru.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/sl.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/sv.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/tr.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/vi.json
#	imports/plugins/included/payments-stripe-connect/server/i18n/zh.json
#	server/methods/core/shop.js
This needs to be reversed once listing refunds for connect is figured out
@brent-hoover
Copy link
Collaborator

The name passed in when setting up a merchant connect account seems to be the name of the Primary shop (Reaction Commerce) rather than the name of my merchant shop (Brent's Shop)
stripe__connect_with_reaction_commerce

@brent-hoover
Copy link
Collaborator

brent-hoover commented Aug 16, 2017

I'm getting blocked while trying to set up the connect account for my merchant store. Putting in Stripe test account/routing number (https://stripe.com/docs/connect/testing) gives me this error

stripe__connect_with_reaction_commerce

@spencern spencern mentioned this pull request Aug 17, 2017
59 tasks
@spencern
Copy link
Contributor Author

So I haven't been able to reproduce the 404 error that happens when connecting stripe to a merchant account.

I've fixed the issue that was happening when checking out a single product from the primary shop with taxes not setup.

@brent-hoover
Copy link
Collaborator

I was able to checkout using a second shop using the cherry-picked commit mentioned above. I got an error when I hadn't set up taxes though, and the tax configuration screen was little messed up, but the 404 error was no longer there as long I do "skip" and don't setup anything in the configuration screen.

image

@spencern
Copy link
Contributor Author

@zenweasel This should be ready ready for another review / PR now.

I've added a test for the primary stripe charge method that should be a good example of how to create other (smaller hopefully) automated tests for the new Stripe package using nock to mock HTTP api calls and responses.

Also all of your concerns have been addressed either through code or comments.

@spencern spencern changed the title [WIP] Stripe Connect and Multi-Shop Checkout Stripe Connect and Multi-Shop Checkout Aug 21, 2017
@brent-hoover
Copy link
Collaborator

After checking out with a primary shop only, I get this error if I try to approve an order

Exception while invoking method 'orders/approvePayment' Error: Amount must be a number
    at getErrorObject (packages/aldeed_collection2-core.js:480:15)
    at [object Object].doValidate (packages/aldeed_collection2-core.js:462:13)
    at [object Object].Mongo.Collection.(anonymous function) (packages/aldeed_collection2-core.js:214:25)
    at [object Object].Mongo.Collection.(anonymous function) [as update] (packages/dispatch_run-as-user.js:325:19)
    at [object Object].ordersApprovePayment (server/methods/core/orders.js:171:19)
    at packages/check.js:129:16
    at [object Object]._.extend.withValue (packages/meteor.js:1126:17)
    at Object.exports.Match._failIfArgumentsAreNotAllChecked (packages/check.js:128:41)
    at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1765:18)
    at packages/ddp-server/livedata_server.js:719:19
    at [object Object]._.extend.withValue (packages/meteor.js:1126:17)
    at packages/ddp-server/livedata_server.js:717:46
    at [object Object]._.extend.withValue (packages/meteor.js:1126:17)
    at packages/ddp-server/livedata_server.js:715:46
    at [object Object]._.extend.protocol_handlers.method (packages/ddp-server/livedata_server.js:689:23)
    at packages/ddp-server/livedata_server.js:559:43
Sanitized and reported to the client as: Amount must be a number [400]

@brent-hoover
Copy link
Collaborator

Retested and approvals working now. Merging per @spencern

@brent-hoover brent-hoover merged commit 8601516 into marketplace Aug 22, 2017
@brent-hoover brent-hoover deleted the spencer-stripe-connect-merchant-signup branch August 22, 2017 06:04
@spencern spencern mentioned this pull request Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants