Skip to content

Commit

Permalink
Remove deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed May 8, 2019
1 parent e3f38cb commit 0db7e03
Show file tree
Hide file tree
Showing 40 changed files with 54 additions and 1,976 deletions.
95 changes: 0 additions & 95 deletions lib/StripeMethod.basic.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

const isPlainObject = require('lodash.isplainobject');
const stripeMethod = require('./StripeMethod');
const utils = require('./utils');

module.exports = {
create: stripeMethod({
Expand Down Expand Up @@ -32,97 +30,4 @@ module.exports = {
path: '{id}',
urlParams: ['id'],
}),

setMetadata(id, key, value, auth, cb) {
const self = this;
const data = key;
const isObject = isPlainObject(key);
// We assume null for an empty object
const isNull = data === null || (isObject && !Object.keys(data).length);

// Allow optional passing of auth & cb:
if ((isNull || isObject) && typeof value == 'string') {
auth = value;
} else if (typeof auth != 'string') {
if (!cb && typeof auth == 'function') {
cb = auth;
}
auth = null;
}

const urlData = this.createUrlData();
const path = this.createFullPath(`/${id}`, urlData);

return utils.callbackifyPromiseWithTimeout(
new Promise((resolve, reject) => {
if (isNull) {
// Reset metadata:
sendMetadata(null, auth);
} else if (!isObject) {
// Set individual metadata property:
const metadata = {};
metadata[key] = value;
sendMetadata(metadata, auth);
} else {
// Set entire metadata object after resetting it:
this._request(
'POST',
null,
path,
{metadata: null},
auth,
{},
(err, response) => {
if (err) {
return reject(err);
}
sendMetadata(data, auth);
}
);
}

function sendMetadata(metadata, auth) {
self._request(
'POST',
null,
path,
{metadata},
auth,
{},
(err, response) => {
if (err) {
reject(err);
} else {
resolve(response.metadata);
}
}
);
}
}),
cb
);
},

getMetadata(id, auth, cb) {
if (!cb && typeof auth == 'function') {
cb = auth;
auth = null;
}

const urlData = this.createUrlData();
const path = this.createFullPath(`/${id}`, urlData);

return utils.callbackifyPromiseWithTimeout(
new Promise((resolve, reject) => {
this._request('GET', null, path, {}, auth, {}, (err, response) => {
if (err) {
reject(err);
} else {
resolve(response.metadata);
}
});
}),
cb
);
},
};
6 changes: 0 additions & 6 deletions lib/resources/ApplicationFees.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ module.exports = StripeResource.extend({

includeBasic: ['list', 'retrieve'],

refund: stripeMethod({
method: 'POST',
path: '/{id}/refund',
urlParams: ['id'],
}),

createRefund: stripeMethod({
method: 'POST',
path: '/{feeId}/refunds',
Expand Down
12 changes: 0 additions & 12 deletions lib/resources/Balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,4 @@ module.exports = StripeResource.extend({
retrieve: stripeMethod({
method: 'GET',
}),

listTransactions: stripeMethod({
method: 'GET',
path: 'history',
methodType: 'list',
}),

retrieveTransaction: stripeMethod({
method: 'GET',
path: 'history/{transactionId}',
urlParams: ['transactionId'],
}),
});
2 changes: 1 addition & 1 deletion lib/resources/BitcoinReceivers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const stripeMethod = StripeResource.method;
module.exports = StripeResource.extend({
path: 'bitcoin/receivers',

includeBasic: ['list', 'retrieve', 'getMetadata'],
includeBasic: ['list', 'retrieve'],

listTransactions: stripeMethod({
method: 'GET',
Expand Down
20 changes: 0 additions & 20 deletions lib/resources/ChargeRefunds.js

This file was deleted.

64 changes: 1 addition & 63 deletions lib/resources/Charges.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,11 @@ const stripeMethod = StripeResource.method;
module.exports = StripeResource.extend({
path: 'charges',

includeBasic: [
'create',
'list',
'retrieve',
'update',
'setMetadata',
'getMetadata',
],
includeBasic: ['create', 'list', 'retrieve', 'update'],

capture: stripeMethod({
method: 'POST',
path: '/{id}/capture',
urlParams: ['id'],
}),

refund: stripeMethod({
method: 'POST',
path: '/{id}/refund',
urlParams: ['id'],
}),

updateDispute: stripeMethod({
method: 'POST',
path: '/{id}/dispute',
urlParams: ['id'],
}),

closeDispute: stripeMethod({
method: 'POST',
path: '/{id}/dispute/close',
urlParams: ['id'],
}),

/**
* Charge: Refund methods
* (Deprecated)
*/
createRefund: stripeMethod({
method: 'POST',
path: '/{id}/refunds',
urlParams: ['id'],
}),

listRefunds: stripeMethod({
method: 'GET',
path: '/{id}/refunds',
urlParams: ['id'],
methodType: 'list',
}),

retrieveRefund: stripeMethod({
method: 'GET',
path: '/{chargeId}/refunds/{refundId}',
urlParams: ['chargeId', 'refundId'],
}),

updateRefund: stripeMethod({
method: 'POST',
path: '/{chargeId}/refunds/{refundId}',
urlParams: ['chargeId', 'refundId'],
}),

markAsSafe(chargeId) {
return this.update(chargeId, {fraud_details: {user_report: 'safe'}});
},

markAsFraudulent(chargeId) {
return this.update(chargeId, {fraud_details: {user_report: 'fraudulent'}});
},
});
19 changes: 0 additions & 19 deletions lib/resources/CustomerCards.js

This file was deleted.

30 changes: 0 additions & 30 deletions lib/resources/CustomerSubscriptions.js

This file was deleted.

0 comments on commit 0db7e03

Please sign in to comment.