payrex-node 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ function PaymentEntity(apiResource) {
|
|
|
16
16
|
this.customer = data.customer
|
|
17
17
|
this.paymentMethod = data.payment_method
|
|
18
18
|
this.refunded = data.refunded
|
|
19
|
+
this.pageSession = data.page_session
|
|
19
20
|
this.createdAt = data.created_at;
|
|
20
21
|
this.updatedAt = data.updated_at;
|
|
21
22
|
}
|
|
@@ -6,6 +6,15 @@ function PaymentIntentService(client) {
|
|
|
6
6
|
this.path = 'payment_intents';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
PaymentIntentService.prototype.cancel = function (id) {
|
|
10
|
+
return this.request({
|
|
11
|
+
path: `${this.path}/${id}/cancel`,
|
|
12
|
+
method: 'post',
|
|
13
|
+
}).then(function (response) {
|
|
14
|
+
return new PaymentIntentEntity(response);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
9
18
|
PaymentIntentService.prototype.capture = function (id, payload) {
|
|
10
19
|
return this.request({
|
|
11
20
|
path: `${this.path}/${id}/capture`,
|
package/test2.js
CHANGED
|
@@ -27,6 +27,8 @@ const ResourceNotFoundError = require('./src/errors/ResourceNotFoundError');
|
|
|
27
27
|
(async () => {
|
|
28
28
|
try {
|
|
29
29
|
const paymentIntent = await payrex.paymentIntents.create({ amount: 10000 });
|
|
30
|
+
|
|
31
|
+
const payment = await payrex.payments.retrieve('pay_kYgpLcUFcQXS3Xb96VRABEZjuoS4DUeQ');
|
|
30
32
|
} catch (error) {
|
|
31
33
|
console.log('caught error!');
|
|
32
34
|
console.log(error.name);
|
|
@@ -65,4 +67,6 @@ const billingStatement = await payrex.billingStatements.create(
|
|
|
65
67
|
},
|
|
66
68
|
setup_future_usage: 'on_session'
|
|
67
69
|
}
|
|
68
|
-
)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
const paymentIntent = await payrex.paymentIntents.cancel('pi_2oB1X4co8y1ZEotscXJnPGC8meXCptx8');
|