Business Verification Drop-In Bugged

Hey,

It seems that there’s a bug in Dwolla’s source code for the business verification drop-in within the https://cdn.dwolla.com/v2/dwolla-web.js library.

I noticed that when using the github demo for business verification, upon reaching step 2 of the flow the dropdowns for business classification and industry are always greyed out and have no available options to choose from. See below.

This gets interesting because in my own code, when I try to simply import the dwolla library and do nothing else but include the dwolla-business-vcr HTML element, the console always shows an error in the dwolla library within the fetchBusinessCalssifications function: the error is TypeError: undefined is not a promise

The full error output is:

dwolla-web.js:182 Uncaught (in promise) TypeError: undefined is not a promise
    at Promise (<anonymous>)
    at Object.error (dwolla-web.js:182)
    at dwolla-web.js:182
    at async HTMLElement.fetchBusinessClassifications (dwolla-web.js:1044)
    at async HTMLElement.orderedLoad (dwolla-web.js:1044)

The source code in your library at line 182 is:

Finally, my front-end code to implement this library looks like this:

<template>
  <div class="container-fluid" id="app">
    <div class="customer">
      <dwolla-business-vcr
          terms="https://faketerms.html"
          privacy="https://fakeprivacypolicy.html">
      </dwolla-business-vcr>
    </div>
  </div>
</template>

<script>
export default{
  mounted() {
    let script = document.createElement("script");
    script.src = "https://cdn.dwolla.com/v2/dwolla-web.js";
    document.head.appendChild(script);
  },
};
</script>

@spencer @shreya @kmoreira Are you aware of this bug? What should we do to get the business drop-in imported without crashing?

1 Like

Let us know if this fixes itself with the correct imports in our dm

@kmoreira Outside of adding this code to the script is there something else I should be doing to import the lib correctly? This code didn’t work by the way (it’s a copy of the Client instantiation code here that you DMed me)

<script>
const Client = require("dwolla-v2").Client
const dwolla = new Client({
  key: "",
  secret: "",
  environment: "sandbox", // defaults to 'production'
});
export default{
  mounted() {
    let script = document.createElement("script");
    script.src = "https://cdn.dwolla.com/v2/dwolla-web.js";
    document.head.appendChild(script);
  },
};
</script>

The example repo is in Handlebars and vanilla JavaScript. Because your imports were importing from an unknown library, (“dwolla” instead of "dwolla-v2) and being redefined as something else entirely in addition to this, it was triggering some errors.

The example repo serves as a good guideline in how to get set up correctly, but now you just need to make the required syntax edits for your chosen framework, Vue.

@kmoreira We’re in dire need of some guidance on which part of the sample code we provided is causing the problem.

Because your imports were importing from an unknown library, (“dwolla” instead of "dwolla-v2)

Should https://cdn.dwolla.com/v2/dwolla-web.js be a different string to import the dwolla v2 web lib? We’re following the docs verbatim.

Additionally, we installed dwolla v2 via npm and we can clearly see it in our package.json file:

  "dependencies": {
    "dwolla-v2": "^3.2.0",
}

Additionally, you said:

and being redefined as something else entirely in addition to this, it was triggering some errors.

Where is the redefinition occuring? We only have 3 lines of script code doing anything related to this
library:

    let script = document.createElement("script");
    script.src = "https://cdn.dwolla.com/v2/dwolla-web.js";
    document.head.appendChild(script);

Please, as specific as you can be, what’s wrong with our code sample?

Hi @Cody_Eddings , Apologies, I’m jumping into this conversation late. Are you using dwolla-v2 server-side? Assuming you are using Vue on the client-side which calls off to your back-end server (using Node.js) to make API requests to Dwolla?

dwolla-web.js is a client-side UI library that is only available via our CDN
dwolla-v2 is a Node.js library for making server-side calls to the Dwolla API

That’s correct. I’m triggering dwolla-v2 calls on my server with my Vue 3 front end client.

The docs here seem to indicate that I should be trying to import the drop-in components via "https://cdn.dwolla.com/v2/dwolla-web.js" on my front-end.

Is that not correct?

It seems we are having similar issues, except I’m using Angular.
If you want to hop on a live-stream, we can try to figure it out together.

And if Dwolla team wants to come help, that would be fantastic.

password: 970412