Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥Remove deprecated methods 🔥 #613

Merged
merged 1 commit into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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({
rattrayalex-stripe marked this conversation as resolved.
Show resolved Hide resolved
method: 'GET',
}),

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

retrieveTransaction: stripeMethod({
ob-stripe marked this conversation as resolved.
Show resolved Hide resolved
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.

Loading