payrex-node 1.2.1 → 1.3.0
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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function CustomerSessionEntity(apiResource) {
|
|
2
|
+
const data = apiResource.data;
|
|
3
|
+
|
|
4
|
+
this.id = data.id;
|
|
5
|
+
this.customerId = data.customer_id;
|
|
6
|
+
this.clientSecret = data.client_secret;
|
|
7
|
+
this.livemode = data.livemode;
|
|
8
|
+
this.components = data.components;
|
|
9
|
+
this.expired = data.expired;
|
|
10
|
+
this.expiredAt = data.expired_at;
|
|
11
|
+
this.createdAt = data.created_at;
|
|
12
|
+
this.updatedAt = data.updated_at;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = CustomerSessionEntity;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const BaseService = require('./BaseService');
|
|
2
|
+
const CustomerSessionEntity = require('../entities/CustomerSessionEntity');
|
|
3
|
+
const ApiResource = require('../ApiResource');
|
|
4
|
+
|
|
5
|
+
function CustomerSessionService(client) {
|
|
6
|
+
BaseService.call(this, client);
|
|
7
|
+
this.path = 'customer_sessions';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
CustomerSessionService.prototype.create = function (payload) {
|
|
11
|
+
return this.request({
|
|
12
|
+
path: this.path,
|
|
13
|
+
payload: payload,
|
|
14
|
+
method: 'post',
|
|
15
|
+
}).then(function (response) {
|
|
16
|
+
return new CustomerSessionEntity(response);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
CustomerSessionService.prototype.retrieve = function (id) {
|
|
21
|
+
return this.request({
|
|
22
|
+
path: `${this.path}/${id}`,
|
|
23
|
+
method: 'get',
|
|
24
|
+
}).then(function (response) {
|
|
25
|
+
return new CustomerSessionEntity(response);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
Object.setPrototypeOf(CustomerSessionService.prototype, BaseService.prototype);
|
|
30
|
+
|
|
31
|
+
module.exports = CustomerSessionService;
|
package/src/services/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const BillingStatementLineItemService = require('./BillingStatementLineItemService');
|
|
2
2
|
const BillingStatementService = require('./BillingStatementService');
|
|
3
3
|
const CheckoutSessionService = require('./CheckoutSessionService');
|
|
4
|
+
const CustomerSessionService = require('./CustomerSessionService');
|
|
4
5
|
const CustomerService = require('./CustomerService');
|
|
5
6
|
const PaymentIntentService = require('./PaymentIntentService');
|
|
6
7
|
const RefundService = require('./RefundService');
|
|
@@ -8,6 +9,7 @@ const WebhookService = require('./WebhookService');
|
|
|
8
9
|
|
|
9
10
|
module.exports = {
|
|
10
11
|
checkoutSessions: CheckoutSessionService,
|
|
12
|
+
customerSessions: CustomerSessionService,
|
|
11
13
|
paymentIntents: PaymentIntentService,
|
|
12
14
|
customers: CustomerService,
|
|
13
15
|
billingStatements: BillingStatementService,
|