Comparing version 0.1.2 to 0.1.3
@@ -25,3 +25,3 @@ 'use strict'; | ||
function Response(body) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { error: false, redirect: {} }; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { error: false, redirect: null }; | ||
var config = arguments[2]; | ||
@@ -63,3 +63,3 @@ | ||
value: function isRedirect() { | ||
return this.options.redirect; | ||
return this.options.redirect !== null; | ||
} | ||
@@ -66,0 +66,0 @@ }, { |
{ | ||
"name": "paymentjs", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A framework agnostic, multi-gateway payment processing library for Node.js, Inspired by Omnipay for PHP", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,3 +5,3 @@ import _ from 'lodash' | ||
export default class Response { | ||
constructor(body, options = { error: false, redirect: {}}, config) { | ||
constructor(body, options = { error: false, redirect: null}, config) { | ||
this.body = body; | ||
@@ -17,3 +17,3 @@ this.options = options; | ||
isRedirect(){ | ||
return this.options.redirect; | ||
return this.options.redirect !== null; | ||
} | ||
@@ -20,0 +20,0 @@ redirect(){ |
@@ -58,2 +58,5 @@ import { Alipay, Stripe } from '../src/gateways' | ||
}), { source: card.id }); | ||
if (response.isRedirect()) { | ||
console.log(await response.redirect()); | ||
} | ||
if (await response.isSuccess()) { | ||
@@ -60,0 +63,0 @@ console.log('success', '==-stripe-==', response.body); |
35657
813