Skip to content

Stripe checkout onboarding service - #2991

Merged
slinlee merged 31 commits into
devfrom
dev-2990-stripe-checkout-onboarding-service
Apr 15, 2021
Merged

Stripe checkout onboarding service#2991
slinlee merged 31 commits into
devfrom
dev-2990-stripe-checkout-onboarding-service

Conversation

@fionnachan

@fionnachan fionnachan commented Mar 26, 2021

Copy link
Copy Markdown
Contributor

Changes

  • add Stripe checkout session API POST request service to pathmind-api
  • add button that would send a POST request to pathmind-api
  • upon a successful call, redirect the user to the Stripe checkout page
  • add "product" info on Stripe checkout page
  • add POST request error handler on frontend
  • add successful page for successful payment redirection
  • add webhook endpoint for Stripe events
  • fire segment track event upon successful segment payment
  • set up webhook endpoint on Stripe dashboard
  • update intercom <-> segment integration configuration on segment dashboard
  • configure Stripe branding settings

PR Screenshots

Site header
image
Checkout page hosted on Stripe
image
Success Page
image

Closes #2990

@fionnachan fionnachan added the Status: Being worked on This is being worked on by the assigned person. Don't start on this until you get cleared. label Mar 26, 2021
@fionnachan fionnachan self-assigned this Mar 26, 2021
@slinlee

slinlee commented Mar 26, 2021

Copy link
Copy Markdown
Contributor

looking good so far . Check it out @ejunprung

@ejunprung

ejunprung commented Mar 26, 2021

Copy link
Copy Markdown
Contributor

That's perfect. When someone pays, where will the notifications go? Just need a way to check if someone had paid or not. I can log into Stripe and stuff as well, whichever is less work.

@slinlee

slinlee commented Mar 26, 2021

Copy link
Copy Markdown
Contributor

We should hook it up from our serverside to segment. That will notify intercom

@fionnachan

Copy link
Copy Markdown
Contributor Author

Can someone please add me to the Stripe team as a "developer"?
https://stripe.com/docs/dashboard/teams#user-roles
I'll need to access the API / webhook dashboard to set up the payment notification webhook ->
https://stripe.com/docs/payments/checkout/fulfill-orders

@EvgeniyEA

Copy link
Copy Markdown
Contributor

run tests

@EvgeniyEA

Copy link
Copy Markdown
Contributor

@fionnachan There is an error in Jenkins https://jenkins.dev.devpathmind.com/job/Test_PRs/4531/execution/node/47/log/
`Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'stripeAPIService': Unsatisfied dependency expressed through field 'segmentTrackerService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.skymind.pathmind.services.analytics.SegmentTrackerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

[�[1;34mINFO�[m] Pathmind Punctuator ................................ �[1;32mSUCCESS�[m [ 0.449 s]
[�[1;34mINFO�[m] Pathmind BDD Tests ................................. �[1;32mSUCCESS�[m [ 4.849 s]
[�[1;34mINFO�[m] Pathmind API ....................................... �[1;31mFAILURE�[m [ 5.298 s]`

@fionnachan

Copy link
Copy Markdown
Contributor Author

@slinlee do we need to include tax for this payment?
Reference doc: https://stripe.com/docs/payments/checkout/taxes

@slinlee

slinlee commented Mar 30, 2021

Copy link
Copy Markdown
Contributor

@slinlee do we need to include tax for this payment?
Reference doc: https://stripe.com/docs/payments/checkout/taxes

@ejunprung do we need to?

@fionnachan

Copy link
Copy Markdown
Contributor Author

I added a segment event on successful payment
but I think it's easier to check on Stripe than Intercom
https://dashboard.stripe.com/payments?status%5B%5D=successful

@fionnachan fionnachan removed the Status: Being worked on This is being worked on by the assigned person. Don't start on this until you get cleared. label Mar 30, 2021
pathmind.email.from.name=Pathmind
pathmind.application.url=${APPLICATION_URL:http://localhost:8080}
pathmind.application.environment=${ENVIRONMENT}
pathmind.pathmind-api.url=${PATHMIND_API_URL:http://localhost:8081}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@xneyder this is the parameter, thanks

@xneyder

xneyder commented Apr 7, 2021

Copy link
Copy Markdown
Contributor

Thanks, @fionnachan. I have added it to Jenkins; please let me know if you need anything else.

@alethander alethander left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there are few changes needed to replace System.out and e.printStackTrace with log.
is there documentation on integration with Stripe?

Comment thread pathmind-api/src/main/java/io/skymind/pathmind/api/domain/StripeAPIService.java Outdated
Comment thread pathmind-api/src/main/java/io/skymind/pathmind/api/domain/StripeAPIService.java Outdated
Comment thread pathmind-api/src/main/java/io/skymind/pathmind/api/domain/StripeAPIService.java Outdated
@fionnachan

Copy link
Copy Markdown
Contributor Author

Thanks, @fionnachan. I have added it to Jenkins; please let me know if you need anything else.

We need the URL to be pathmind-api's URL at different environment.... can we set the env value for PATHMIND_API_URL for pr tests, dev, test, and prod respectively?

@fionnachan

Copy link
Copy Markdown
Contributor Author

@alexamakarov yes here are the docs:
Checkout page creation: https://stripe.com/docs/checkout/integration-builder
Webhook: https://stripe.com/docs/webhooks/integration-builder

@alethander
alethander force-pushed the dev-2990-stripe-checkout-onboarding-service branch from 2f2f67b to cc01901 Compare April 8, 2021 20:20
@EvgeniyEA EvgeniyEA added BDD Tests: Coverage Approved Tests have been added for the PR and removed BDD Tests: Changes Needed labels Apr 13, 2021
@fionnachan

Copy link
Copy Markdown
Contributor Author

Sorry, forgot to update the status after talking to Alex.

@alexamakarov would like to take over the PR to do some cleanups on the pathmind-api part (enhancement)

On another note, the only blocker for merging this PR here is that the PR tests cannot trigger the pathmind-api webhook properly because the webhook signing secret on the shared.properties file is for the deployed endpoint https://api.dev.devpathmind.com/stripe-webhook but it doesn't exist yet because we haven't merged & deployed this PR

I'll message @xneyder about configuring the webhook signing secret for different environments.

@EvgeniyEA

Copy link
Copy Markdown
Contributor

Latest Jenkins build failed with Page not found error after clicking Request Onboarding Service btn
image

@fionnachan

Copy link
Copy Markdown
Contributor Author

@EvgeniyEA yes it's the same issue mentioned above because of the stripe webhook secret and its endpoint.... I'm not sure if there's a way to get around this without deploying the site since our pathmind api module of the PR tests has a dynamic URL and it's not desirable to add all the dynamic URLs to the Stripe webhook configuration.

Worst case is we might need to disable the e2e tests that involves the "Stripe page" step before merging this PR.

@fionnachan

Copy link
Copy Markdown
Contributor Author

@EvgeniyEA Now that I think about it, the standard way to test this would be to mock Stripe API calls instead of actually calling the Stripe service. Would you know if that is possible?

@EvgeniyEA

Copy link
Copy Markdown
Contributor

@fionnachan we can try with https://github.com/stripe/stripe-mock
I disabled stripe tests for now

@slinlee slinlee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks.

@alexamakarov - what types of changes did you have in mind for the API?

@slinlee
slinlee merged commit 33817b1 into dev Apr 15, 2021
@slinlee
slinlee deleted the dev-2990-stripe-checkout-onboarding-service branch April 15, 2021 22:22
slinlee added a commit that referenced this pull request Apr 15, 2021
Stripe checkout onboarding service (#2991)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BDD Tests: Coverage Approved Tests have been added for the PR Status: Ready for review Review is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add way to ask users to pay for onboarding plan

6 participants