omise / card.js

Deprecation Notice: Moved to Omise.js
6 stars 3 forks source link

result fail handle is missing #5

Open fake-or-dead opened 9 years ago

fake-or-dead commented 9 years ago
function listenToCardJsIframeMessage(event) {
    if (!event.origin) {
      return;
    };

    if (event.origin !== serverOrigin) {
      return;
    };

    if (event.data == "closeOmiseCardJsPopup") {
      hideIframe();
    } else {

      try {
        if (formObject && formObject.active) {
          var result = JSON.parse(event.data);
          omiseTokenHiddenField.value = result.omiseToken;
          hideIframe();
          formObject.submit();
        };
      }
      catch (e) {
        hideIframe();
      };

    };
  };

I can't find a way to handle error message if Omise return Error https://docs.omise.co/api/errors/ It's just cactch and hide iframe

incase that Omise return error msg correctly I still can't get error msg because of submit form only omiseToken data