diff --git a/README.txt b/README.txt index c084faa..ed313f5 100644 --- a/README.txt +++ b/README.txt @@ -22,6 +22,8 @@ Basic usage is like: Implements all the functions of the Stripe API: Charges, Customers, Plans, Coupons, Subscriptions, Invoice Items, Invoices, and Tokens +Supported CFML engines: ColdFusion 9.0.1 or Railo 3.3.1 + Support: http://groups.google.com/group/stripecfc/ FW/1 (https://github.com/seancorfield/fw1) is the framework used for this web application @@ -29,4 +31,5 @@ but that is not required to use Stripe.cfc in your own application. Changes: -11/29/2011 - changes to Response.getRawResponse() to .getResult(), use a common view for errors, handle 400,404 status codes \ No newline at end of file +11/29/2011 - 1.0.2,Response.errorCode +11/29/2011 - 1.0.1,changes to Response.getRawResponse() to .getResult(), use a common view for errors, handle 400,404 status codes \ No newline at end of file diff --git a/stripe/Response.cfc b/stripe/Response.cfc index b504c08..6db0953 100644 --- a/stripe/Response.cfc +++ b/stripe/Response.cfc @@ -2,9 +2,10 @@ component accessors="true" { property name="status"; //unprocessed, success, failure property name="result"; //the deserialized json object from the API call - property name="errorType"; + property name="errorType"; //error types: invalid_request_error, api_error, card_error, http_error + property name="errorCode"; property name="errorMessage"; - property name="rawResponse"; //cfhttp.filecontent of the API http request + property name="rawResponse"; //the raw response from the cfhttp request function init() { diff --git a/stripe/Stripe.cfc b/stripe/Stripe.cfc index c4e678d..d207a3d 100644 --- a/stripe/Stripe.cfc +++ b/stripe/Stripe.cfc @@ -27,7 +27,7 @@ component accessors="true" function getVersion() { - return "1.0.1"; + return "1.0.2"; } function updateSubscription(id,plan,prorate=true,trial_end="",card="") @@ -298,17 +298,19 @@ component accessors="true" switch(status) { case "400": + case "401": + case "402": case "404": - response = deserializeJSON(httpResponse.fileContent); - stripeResponse.setStatus("failure"); - stripeResponse.setErrorType(response.error.type); + response = deserializeJSON(httpResponse.fileContent); + stripeResponse.setErrorType(response.error.type); stripeResponse.setErrorMessage(response.error.message); + if (isDefined('response.error.code')) stripeResponse.setErrorCode(response.error.code); break; default: stripeResponse.setErrorType("http_error"); - stripeResponse.setErrorMessage("Gateway returned unknown response: #status#: #httpResponse.errorDetail#"); - stripeResponse.setStatus("failure"); - } + stripeResponse.setErrorMessage("Gateway returned unknown response: #status#: #httpResponse.errorDetail#"); + } + stripeResponse.setStatus("failure"); } else { @@ -319,6 +321,7 @@ component accessors="true" //failure stripeResponse.setStatus("failure"); stripeResponse.setErrorType(response.error.type); + stripeResponse.setErrorCode(response.error.code); stripeResponse.setErrorMessage(response.error.message); } else diff --git a/views/common/responseerror.cfm b/views/common/responseerror.cfm index eed89d1..cf1fe72 100644 --- a/views/common/responseerror.cfm +++ b/views/common/responseerror.cfm @@ -1,7 +1,8 @@
- errorType: #stripeResponse.getErrorType()#
+ errorType: #stripeResponse.getErrorType()#
errorMessage: #stripeResponse.getErrorMessage()#
+ errorCode: #stripeResponse.getErrorCode()#
\ No newline at end of file