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

Complete Stripe 3D Secure Integration #158

Merged
merged 7 commits into from
May 11, 2021
Merged

Conversation

gfyre
Copy link
Contributor

@gfyre gfyre commented Dec 28, 2020

What is this doing?

Integrates Stripe 3D secure with the Payment Intents API. This pull request also includes code that handles errors in making/completing payments and notifies the user about the same.

To test it, simply put in your Stripe secret and public key and use one of the 3D secure cards from https://stripe.com/docs/testing

This URL also includes cards which will intentionally fail a payment. Use those to see how the errors are handled.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe how it impacts the application:

The PR fulfills these requirements:

  • It's submitted to the develop branch, not the master branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. Fix #xxx[,#xxx], where "xxx" is the issue number)
  • New/updated tests are included

Other information:

@smaharj1 smaharj1 added the enhancement New feature or request label Dec 30, 2020
Copy link
Collaborator

@smaharj1 smaharj1 left a comment

Choose a reason for hiding this comment

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

This PR is lit. You can leave the console logs since it will help us test it, but can you make some other changes/provide explanations where requested?

//console.log(req.user);
try {
response = await orderService.stripePaymentInstant(req.body.checkoutId, req.user);
console.log(response);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the console log here.

user_email: userObj.email
},
description: "Swaas Order " + checkoutId.substr(checkoutId.length - 6), // Last six chars of id
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain what "Swaas Order" is? It seems like it is specific to a product. If it is a product name, maybe we can move it out to config so that it is reusable.

this.$emit('pay', data.token);
// const data = await Stripe.createToken();
// this.$emit('pay', data.token);
event.target.disabled = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of directly accessing event.target.disabled, can you utilize the complete variable or create one more variable to handle this logic and pass it as a disabled prop in the <b-btn> component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was actually a quick fix to disabling a button. Perhaps, you could merge this PR into a new branch where the both of us could colab on such changes.

},
});
if (data && data.httpStatus === 200) {
console.log(data.responseData);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove all these console logs if you dont mind

if (confirmPayment.paymentIntent.status == 'succeeded') {
console.log('inside confirmPayment status', confirmPayment);
if (confirmPayment.hasOwnProperty('error')) {
this.$notify({
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we go into this error condition, shouldn't we return from the function at the end? Or displaying the error and then making ProxyUrl.stripeInstantPayment call the desired behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You need not return a function. I've tested various Stripe errors with this implementation and I've had no issues with the current error handling.

@smaharj1
Copy link
Collaborator

Also, please let us know if you guys are using Veniqa for your business. We'd be happy to feature you on our official website.

@gfyre
Copy link
Contributor Author

gfyre commented Dec 30, 2020

Hey @smaharj1, the console logs were put there for testing purposes while I was building the platform. However, I'll get rid of the console logs for this PR. As far as "Swaas Order", that is basically what would print on your card statement. You could change that to anything you'd like.

@smaharj1
Copy link
Collaborator

Hey @smaharj1, the console logs were put there for testing purposes while I was building the platform. However, I'll get rid of the console logs for this PR. As far as "Swaas Order", that is basically what would print on your card statement. You could change that to anything you'd like.

Can you remove the Swaas in that case so that it is generic?

@gfyre
Copy link
Contributor Author

gfyre commented Jan 2, 2021

Hey @smaharj1, the console logs were put there for testing purposes while I was building the platform. However, I'll get rid of the console logs for this PR. As far as "Swaas Order", that is basically what would print on your card statement. You could change that to anything you'd like.

Can you remove the Swaas in that case so that it is generic?

Absolutely.

@gfyre
Copy link
Contributor Author

gfyre commented Jan 2, 2021

@smaharj1 @Viveckh Also, are you guys open to changes to the UI? I'd be happy to work on the front-end in my free time.

@Viveckh
Copy link
Owner

Viveckh commented Jan 29, 2021

Sorry guys, been a little occupied lately, so couldn't get around to this.
I'll go through the code and also do some thorough testing and get back to you @gfyre . Looks pretty good on my initial skimming.

And yes, we would love contributions in any way, including the UI. We've wanted to support some additional design layouts in the list of options for home page "featured sections". And definitely, the admin panel could use some work in responsiveness across devices. Anything particular you got in mind that you wanted to work on?

@gfyre
Copy link
Contributor Author

gfyre commented Apr 17, 2021

How come this hasn't been merged yet? I've tested this and the code works just fine.

@smaharj1 smaharj1 merged commit 0bee6a8 into Viveckh:develop May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants