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

card add #1373

Merged
merged 1 commit into from
Oct 30, 2018
Merged

card add #1373

merged 1 commit into from
Oct 30, 2018

Conversation

jonathandelefortrie
Copy link

@jonathandelefortrie jonathandelefortrie commented Oct 24, 2018

What?

Add payment method.

  • Adding new icon lock.svg.
  • Unify the CSS classes for the add and edit form.
  • New template for edit form with an injection of global variables into context.
  • Extended the account.js with a new method to initiate credit card and billing address fields validations, mapping form fields name and value to body request (bigpay).
  • Added a payment-method.js file for credit card validations and helpers with unit test.
  • Various fixes: blacklist key in payment methods list, remove the statement in edit form for bigpay token.

Tickets

Screenshots (if appropriate)

Desktop
screen shot 2018-10-26 at 2 21 57 pm

Mobile
screen shot 2018-10-26 at 2 22 28 pm

@bigbot
Copy link

bigbot commented Oct 24, 2018

Autotagging @bigcommerce/storefront-team @davidchin

@jonathandelefortrie jonathandelefortrie changed the title (WIP) card add card add Oct 25, 2018
@jonathandelefortrie
Copy link
Author

Hey @junedkazi , this is code the for add card form. The form uses ajax to store the credit card, so it requires some extra javascript validation which I have added in a standalone file. Can you have a look at the PR and let know if the implementation is okay? Thank you

Copy link
Contributor

@danieldelcore danieldelcore left a comment

Choose a reason for hiding this comment

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

Hey man, looks good for the most part!
I'm a little concerned about the way we have to map data before posting to bigpay, It would be really nice if we could find a better solution.

Would you be able to have a look as well please, @junedkazi @jackosaurus

case 'FormField[2][5]':
refObj.last_name = item.value;
break;
case 'FormField[2][6]':
Copy link
Contributor

Choose a reason for hiding this comment

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

I would really like to avoid doing this if we can help it.
Is there a way that we can either:

  • Build the form manually
  • Get the backend to send proper names over the wire so we can avoid or simplify this mapping?

🍹

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree we need a better way of building these switch cases instead of relying on numeric keys.

Choose a reason for hiding this comment

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

Hey @junedkazi @danieldelcore , the best alternative will be to create those input fields manually so I have a better control of the form names.

@@ -8,6 +8,7 @@
"dependencies": {
"@bigcommerce/stencil-utils": "^1.1.2",
"babel-polyfill": "^6.26.0",
"creditcards": "^3.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

No package lock file please.

@@ -201,6 +208,103 @@ export default class Account extends PageManager {
});
}

initPaymentMethodFormValidation($paymentMethodForm) {
// Inject validations into form fields before validation runs
$paymentMethodForm.find('#first_name.form-field').attr('data-validation', `{ "type": "singleline", "label": "${this.context.firstNameLabel}", "required": true, "maxlength": 0 }`);

Choose a reason for hiding this comment

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

Hey @junedkazi , we have removed the dynamic input fields for the static components. however, I had to inject the validation through javascript because it was breaking the template engine.

Copy link
Contributor

@danieldelcore danieldelcore left a comment

Choose a reason for hiding this comment

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

Ok, looks good to me!
Thanks for all of the input @junedkazi @jackosaurus

@danieldelcore danieldelcore merged commit 9b2b731 into bigcommerce:payment-methods-feature Oct 30, 2018
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