Nuxt-返回3D安全表单不重定向

时间:2020-03-27 00:13:08

标签: javascript vuejs2 nuxt.js 3d-secure

我正在尝试实施3D安全表单,但是我无法显示用户银行的页面。

我正在从后端发送请求,而我的响应像这样:

{
  status: 'success',
  locale: 'en',
  systemTime: 1585266454071,
  conversationId: '123456789',
  threeDSHtmlContent: 'PCFkb2N0eXBlIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgICA8dGl0bGU+aXl6aWNvIE1vY2sgM0QtU2VjdXJlIFByb2Nlc3NpbmcgUGFnZTwvdGl0bGU+CjwvaGVhZD4KPGJvZHk+Cjxmb3JtIGlkPSJpeXppY28tM2RzLWZvcm0iIGFjdGlvbj0iaHR0cHM6Ly9zYW5kYm94LWFwaS5peXppcGF5LmNvbS9wYXltZW50L21vY2svaW5pdDNkcyIgbWV0aG9kPSJwb3N0Ij4KICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9Im9yZGVySWQiIHZhbHVlPSJtb2NrNDYtOTUwODMyNjU0MjAzODIxOWl5emlvcmQiPgogICAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0iYmluIiB2YWx1ZT0iNTQwMDAxIj4KICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9InN1Y2Nlc3NVcmwiIHZhbHVlPSJodHRwczovL3NhbmRib3gtYXBpLml5emlwYXkuY29tL3BheW1lbnQvaXl6aXBvcy9jYWxsYmFjazNkcy9zdWNjZXNzLzM0Ij4KICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9ImZhaWx1cmVVcmwiIHZhbHVlPSJodHRwczovL3NhbmRib3gtYXBpLml5emlwYXkuY29tL3BheW1lbnQvaXl6aXBvcy9jYWxsYmFjazNkcy9mYWlsdXJlLzM0Ij4KICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9ImNvbmZpcm1hdGlvblVybCIgdmFsdWU9Imh0dHBzOi8vc2FuZGJveC1hcGkuaXl6aXBheS5jb20vcGF5bWVudC9tb2NrL2NvbmZpcm0zZHMiPgogICAgPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0iUGFSZXEiIHZhbHVlPSJhZTJhZGQ4MC0zZTRiLTQ0OTQtOTdhYi1kMzk2YzA5ZWVkZmUiPgo8L2Zvcm0+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJpeXppY28tM2RzLWZvcm0iKS5zdWJtaXQoKTsKPC9zY3JpcHQ+CjwvYm9keT4KPC9odG1sPg=='
}

基本上,threeDSHtmlContent是HTML页面的base64编码的字符串。向其服务器发出请求,并且必须将我的Nuxt应用重定向到该服务器。回调后我可以处理。

我的Nuxt组件是:

<template>
  <v-container pa-12>
    <div :v-html="rawHTML"></div>
    ...
    OTHER FORM DATA
    ...
  </v-container>
</template>
  export default {
    computed: {
      rawHTML() {
        return this.$store.state.postAJob.rawHTML;
      }
    },
    methods: {
      submit() {
        this.$store.dispatch("postAJob/sendPayment", { ... })
      }
    }
}

还有我的商店:

export const state = () => ({
  rawHTML: ""
});

export const mutations = {
  SET_RAWHTML(state, data) {
    state.rawHTML = data;
  },
  SET_ERROR(state, data) {
    state.error = data;
  },
  SET_LOADING(state, data) {
    state.isLoading = data;
  }
};

export const actions = {
  async sendPayment({ commit }, payment) {
    commit("SET_LOADING", true);
    let response = await this.$axios.post(`/payment`, payment)
    let buff = new Buffer.from(response.data.threeDSHtmlContent, "base64");
    commit("SET_LOADING", false);
    commit("SET_RAWHTML", buff.toString())
  }
};

我的组件未提交响应随附的表格,因此我看不到3D安全页面。

如何使此返回表单的“提交”按钮起作用?

谢谢。

0 个答案:

没有答案