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

fix(lib/provider.js): fix RecurlyProvider throwing error when fraud property is set #123

Merged
merged 1 commit into from
Apr 13, 2021

Conversation

mikeedwards
Copy link
Contributor

When we set the fraud property on RecurlyProvider like so:

fraud={{kount: {dataCollector: true}}}

We get this error:

Error name:    "TypeError"
Error message: "Cannot read property 'get' of undefined"

in node_modules/recurly.js/lib/recurly/fraud.js:63:26

  attachDataCollector () {
    if (this.dataCollectorInitiated) return;
    this.dataCollectorInitiated = true;

    this.recurly.request.get({
      route: '/risk/info',
      done: (error, response) => {
        debug('risk info', error, response);

The problem seems to be with the way that recurly's constructor works—if you provide options in the constructor, then the configure event fires and the call to risk/info fails without a Request object being set yet. The way the recurly instance is set up here in this PR is more like your e2e tests in the recurly-js repo itself, so configuration happens after everything gets set up, including the request property.

@coveralls
Copy link

coveralls commented Apr 13, 2021

Pull Request Test Coverage Report for Build 690

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 98.944%

Totals Coverage Status
Change from base Build 689: 0.004%
Covered Lines: 221
Relevant Lines: 221

💛 - Coveralls

@chrissrogers
Copy link
Member

I think this is a good stopgap solution to the issue occurring in react-recurly and have made a note to investigate this is recurly-js as well. Thanks very much for the pull request!

@chrissrogers chrissrogers self-requested a review April 13, 2021 18:24
@@ -22805,7 +22805,7 @@
"lodash.pick": "^4.4.0",
"nanoid": "^2.1.9",
"promise": "^8.0.3",
"qs": "^6.9.3",
"qs": "^6.9.4",
Copy link
Member

Choose a reason for hiding this comment

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

Thanks as well for these updates 👍

@chrissrogers chrissrogers merged commit 7127041 into recurly:main Apr 13, 2021
recurly-integrations pushed a commit that referenced this pull request Oct 27, 2022
[Full Changelog](v1.2.4...v1.2.5)

**Merged Pull Requests**

- listen_for_attach_event [#187](#187) ([smagdicatrecurly](https://github.com/smagdicatrecurly))
- Adds demo for automated focus shift on individual card Elements [#183](#183) ([chrissrogers](https://github.com/chrissrogers))
- setup element when didmount [#182](#182) ([WillXing](https://github.com/WillXing))
- Docs fix: UseCheckoutPricingInput `subscriptions` [#157](#157) ([javimbk](https://github.com/javimbk))
- Docs Fix: useRecurly Paypal example [#156](#156) ([javimbk](https://github.com/javimbk))
- Revert "add security to github CODEOWNER file" [#147](#147) ([eternal44](https://github.com/eternal44))
- add security to github CODEOWNER file [#142](#142) ([eternal44](https://github.com/eternal44))
- fix(lib/provider.js): fix RecurlyProvider throwing error when fraud property is set [#123](#123) ([mikeedwards](https://github.com/mikeedwards))
recurly-integrations pushed a commit that referenced this pull request Oct 27, 2022
[Full Changelog](v1.2.4...v1.2.6)

**Merged Pull Requests**

- listen_for_attach_event [#187](#187) ([smagdicatrecurly](https://github.com/smagdicatrecurly))
- Adds demo for automated focus shift on individual card Elements [#183](#183) ([chrissrogers](https://github.com/chrissrogers))
- setup element when didmount [#182](#182) ([WillXing](https://github.com/WillXing))
- Docs fix: UseCheckoutPricingInput `subscriptions` [#157](#157) ([javimbk](https://github.com/javimbk))
- Docs Fix: useRecurly Paypal example [#156](#156) ([javimbk](https://github.com/javimbk))
- Revert "add security to github CODEOWNER file" [#147](#147) ([eternal44](https://github.com/eternal44))
- add security to github CODEOWNER file [#142](#142) ([eternal44](https://github.com/eternal44))
- fix(lib/provider.js): fix RecurlyProvider throwing error when fraud property is set [#123](#123) ([mikeedwards](https://github.com/mikeedwards))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants