Skip to content

Commit

Permalink
payments/charges
Browse files Browse the repository at this point in the history
  • Loading branch information
mcohen01 committed Dec 19, 2015
1 parent d138c3d commit cd8226d
Showing 1 changed file with 0 additions and 90 deletions.
90 changes: 0 additions & 90 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,96 +82,6 @@ QuickBooks.prototype.changeDataCapture = function(entities, since, callback) {
module.request(this, 'get', {url: url}, null, callback)
}

// ********************** Charge Api **********************

QuickBooks.prototype.cardToken = function(card, callback) {
module.request(this, 'post', {
url: '/tokens',
headers: {
company_id: this.realmId
}
}, card, callback)
}


/**
* Process a credit card charge using card details or token.
* Can capture funds or just authorize.
*
* @param {object} charge - details, amount, currency etc. of charge to be processed
* @param callback - Callback function which is called with any error or the saved Charge
*/
QuickBooks.prototype.charge = function(charge, callback) {
module.request(this, 'post', {
url: '/charges',
headers: {
company_id: this.realmId
}
}, charge, callback)
}

/**
* Get details of charge.
*
* @param {string} chargeId - of previously created charge
* @param callback - Callback function which is called with any error or the Charge
*/
QuickBooks.prototype.getCharge = function(chargeId, callback) {
module.request(this, 'get', {
url: '/charges/' + chargeId,
headers: {
company_id: this.realmId
}
}, null, callback)
}

/**
* Allows you to capture funds for an existing charge that was intended to be captured at a later time.
*
* @param {string} chargeId - of previously created charge
* @param {object} charge - details, amount, currency to capture
* @param callback - Callback function which is called with any error or the capture description
*/
QuickBooks.prototype.capture = function(chargeId, capture, callback) {
module.request(this, 'post', {
url: '/charges/' + chargeId + '/capture',
headers: {
company_id: this.realmId
}
}, capture, callback)
}

/**
* Allows you to refund an existing charge. Full and partial refund are supported.
*
* @param {string} chargeId - of previously created charge
* @param {object} refund - details, amount, currency to refund
* @param callback - Callback function which is called with any error or the refund description
*/
QuickBooks.prototype.refund = function(chargeId, refund, callback) {
module.request(this, 'post', {
url: '/charges/' + chargeId + '/refunds',
headers: {
company_id: this.realmId
}
}, refund, callback)
}

/**
* Retrieves the Refund for the given refund id
*
* @param {string} chargeId - id of previously created charge
* @param {string} refundId - id of previously created Refund
* @param callback - Callback function which is called with any error or the Refund
*/
QuickBooks.prototype.getRefund = function(chargeId, refundId, callback) {
module.request(this, 'get', {
url: '/charges/' + chargeId + '/refunds/' + refundId,
headers: {
company_id: this.realmId
}
}, null, callback)
}

/**
* Creates the Account in QuickBooks
Expand Down

0 comments on commit cd8226d

Please sign in to comment.