vue-giveworks-form
Version:
This plugin provides Vue.js component for the open [http://giveworks.net](Giveworks Platform).
44 lines (36 loc) • 1.11 kB
JavaScript
import Api from '../Api';
import App from '../../../Config/App';
import script from 'vue-interface/src/Helpers/Script';
export default class AuthorizetNet extends Api {
api() {
return 'App\\SiteApis\\Gateways\\AuthorizeNet';
}
buttons() {
return [{
icon: ['far', 'credit-card'],
label: 'Credit Card',
component: 'authorize-net-credit-card'
}];
}
createToken(card, callback) {
return this.accept().dispatchData({
cardData: card,
authData: {
apiLoginID: this.options.login_id,
clientKey: this.options.public_key
}
}, callback);
}
accept() {
if(!this._accept) {
this._accept = window.Accept;
}
return this._accept;
}
script(success, error) {
const url = App.debug // Is app in developer mode?
? 'https://jstest.authorize.net/v1/Accept.js' // Developer
: 'https://js.authorize.net/v1/Accept.js'; // Production;
script(url).then(success, error);
}
}