payrex-node 0.1.4 → 0.1.6

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
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.6] - 2024-07-24
4
+
5
+ - Adjust building of parameter query due to changes in checkout session endpoints.
6
+
7
+ ## [0.1.5] - 2024-07-24
8
+
9
+ - Finalize the checkout session endpoints.
10
+ - Remove the resource attribute from all resources. This is the standard implementation across all PayRex SDKs.
11
+
3
12
  ## [0.1.4] - 2024-07-23
4
13
 
5
14
  - Move the deprecated capture_type attribute.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payrex-node",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "PayRex Node JS Library",
5
5
  "keywords": [
6
6
  "payrex",
package/src/HttpClient.js CHANGED
@@ -25,8 +25,14 @@ HttpClient.prototype.request = async function ({ path, method, payload }) {
25
25
  };
26
26
 
27
27
  let data = null;
28
+
28
29
  if (method === 'post' || method === 'put') {
29
- data = qs.stringify(payload, { arrayFormat: 'brackets' });
30
+ data = qs.stringify(
31
+ payload,
32
+ {
33
+ arrayFormat: 'brackets'
34
+ }
35
+ );
30
36
  }
31
37
 
32
38
  try {
@@ -1,8 +1,9 @@
1
+ const PaymentIntentEntity = require("./PaymentIntentEntity");
2
+
1
3
  function CheckoutSessionEntity(apiResource) {
2
4
  const data = apiResource.data;
3
5
 
4
6
  this.id = data.id;
5
- this.resource = data.resource;
6
7
  this.customerReferenceId = data.customer_reference_id;
7
8
  this.clientSecret = data.client_secret;
8
9
  this.status = data.status;
@@ -10,12 +11,13 @@ function CheckoutSessionEntity(apiResource) {
10
11
  this.lineItems = data.line_items;
11
12
  this.livemode = data.livemode;
12
13
  this.url = data.url;
13
- this.paymentIntent = data.payment_intent;
14
+ this.paymentIntent = new PaymentIntentEntity({
15
+ data: data.payment_intent
16
+ });
14
17
  this.metadata = data.metadata;
15
18
  this.successUrl = data.success_url;
16
19
  this.cancelUrl = data.cancel_url;
17
20
  this.paymentMethods = data.payment_methods;
18
- this.captureType = data.capture_type;
19
21
  this.description = data.description;
20
22
  this.submitType = data.submit_type;
21
23
  this.expiresAt = data.expires_at;
@@ -2,7 +2,6 @@ function MerchantEntity(apiResource) {
2
2
  const data = apiResource.data;
3
3
 
4
4
  this.id = data.id;
5
- this.resource = data.resource;
6
5
  this.connectionType = data.connection_type;
7
6
  this.livemode = data.livemode;
8
7
  this.createdAt = data.created_at;
@@ -2,7 +2,6 @@ function PaymentIntentEntity(apiResource) {
2
2
  const data = apiResource.data;
3
3
 
4
4
  this.id = data.id;
5
- this.resource = data.resource;
6
5
  this.amount = data.amount;
7
6
  this.clientSecret = data.client_secret;
8
7
  this.currency = data.currency;
@@ -2,7 +2,6 @@ function PaymentMethodEntity(apiResource) {
2
2
  const data = apiResource.data;
3
3
 
4
4
  this.id = data.id;
5
- this.resource = data.resource;
6
5
  this.type = data.type;
7
6
  this.billingDetails = data.billing_details;
8
7
  this.livemode = data.livemode;
@@ -2,7 +2,6 @@ function RefundEntity(apiResource) {
2
2
  const data = apiResource.data;
3
3
 
4
4
  this.id = data.id;
5
- this.resource = data.resource;
6
5
  this.amount = data.amount;
7
6
  this.currency = data.currency;
8
7
  this.livemode = data.livemode;
@@ -2,7 +2,6 @@ function WebhookEntity(apiResource) {
2
2
  const data = apiResource.data;
3
3
 
4
4
  this.id = data.id;
5
- this.resource = data.resource;
6
5
  this.secretKey = data.secret_key;
7
6
  this.status = data.status;
8
7
  this.description = data.description;