From 8fe314c7564d86ef9c9aa579e7add07e8621a251 Mon Sep 17 00:00:00 2001 From: Jonathan Forrider Date: Sun, 28 Oct 2018 12:06:01 -0600 Subject: [PATCH 1/2] new ES6 helper class --- api_helper_class/lemonwayapi.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 api_helper_class/lemonwayapi.js diff --git a/api_helper_class/lemonwayapi.js b/api_helper_class/lemonwayapi.js new file mode 100644 index 0000000..e923e22 --- /dev/null +++ b/api_helper_class/lemonwayapi.js @@ -0,0 +1,29 @@ +/* + Title: LemonwayAPI + Author: Jonathan Forrider + Author Website: http://jfwebdesigns.altervista.org/ + Description: A Class used to build the connection to the Lemonway Payment Processor +*/ +import { HTTP } from 'meteor/http' + +export default class LemonwayAPI { + constructor (params) { + this._url = params.url; + this._httpMethod = params.httpMethod; //The URL provided by Lemonway + this._walletMethod = params.walletMethod; //Specific Controller methods located on Lemonway's servers + this._postData = params.postData; + } + + request (callback) { + let options = { + headers: { + "Content-Type": "application/json; charset=utf-8" + }, + data: this._postData + } + + if (this._url.substring(this._url.length) !== '/') this._url = this._url+'/'; + + HTTP.call(this._httpMethod, this._url + this._walletMethod, options, callback); + } +} \ No newline at end of file From 33a585fe361b504721d534fd5ca2c518f40df00f Mon Sep 17 00:00:00 2001 From: Jonathan Forrider Date: Sun, 28 Oct 2018 12:15:36 -0600 Subject: [PATCH 2/2] Added README --- api_helper_class/README.md | 1 + api_helper_class/lemonwayapi.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 api_helper_class/README.md diff --git a/api_helper_class/README.md b/api_helper_class/README.md new file mode 100644 index 0000000..6e8b521 --- /dev/null +++ b/api_helper_class/README.md @@ -0,0 +1 @@ +This is a Helper Class to be used in Meteor. \ No newline at end of file diff --git a/api_helper_class/lemonwayapi.js b/api_helper_class/lemonwayapi.js index e923e22..30f408c 100644 --- a/api_helper_class/lemonwayapi.js +++ b/api_helper_class/lemonwayapi.js @@ -3,6 +3,7 @@ Author: Jonathan Forrider Author Website: http://jfwebdesigns.altervista.org/ Description: A Class used to build the connection to the Lemonway Payment Processor + Dependencies: Meteor and http meteor module */ import { HTTP } from 'meteor/http' @@ -26,4 +27,4 @@ export default class LemonwayAPI { HTTP.call(this._httpMethod, this._url + this._walletMethod, options, callback); } -} \ No newline at end of file +}