payrex-node 0.1.2 → 0.1.4

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.4] - 2024-07-23
4
+
5
+ - Move the deprecated capture_type attribute.
6
+
7
+ ## [0.1.3] - 2024-07-22
8
+
9
+ - Add the new payment_method_options attribute.
10
+
3
11
  ## [0.1.2] - 2024-05-23
4
12
 
5
13
  - Update error handling.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payrex-node",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "PayRex Node JS Library",
5
5
  "keywords": [
6
6
  "payrex",
@@ -0,0 +1,8 @@
1
+ ## 🤔 What?
2
+ -
3
+
4
+ ## 🤔 Why?
5
+ -
6
+
7
+ ## 📝 Additional Notes
8
+ -
@@ -4,7 +4,6 @@ function PaymentIntentEntity(apiResource) {
4
4
  this.id = data.id;
5
5
  this.resource = data.resource;
6
6
  this.amount = data.amount;
7
- this.captureType = data.capture_type;
8
7
  this.clientSecret = data.client_secret;
9
8
  this.currency = data.currency;
10
9
  this.description = data.description;
@@ -13,6 +12,7 @@ function PaymentIntentEntity(apiResource) {
13
12
  this.latestPayment = data.latest_payment;
14
13
  this.paymentMethodId = data.payment_method_id;
15
14
  this.paymentMethods = data.payment_methods;
15
+ this.paymentMethodOptions = data.payment_method_options;
16
16
  this.status = data.status;
17
17
  this.nextAction = data.next_action;
18
18
  this.returnUrl = data.return_url;
package/test2.js DELETED
@@ -1,46 +0,0 @@
1
- const payrex = require('payrex-node')(
2
- 'sk_live_znE26cM4ZbZP3mfTLeZsnw7EceWHKiPN'
3
- );
4
-
5
- const RequestInvalidError = require('./src/errors/RequestInvalidError');
6
- const AuthenticationInvalidError = require('./src/errors/AuthenticationInvalidError');
7
- const ResourceNotFoundError = require('./src/errors/ResourceNotFoundError');
8
-
9
- // try {
10
- // const paymentIntent = await payrex.paymentIntents.create({ amount: 10000 });
11
- // } catch (error) {
12
- // console.log('caught error!')
13
- // if (error instanceof ResourceNotFoundError) {
14
- // // handle error if a resource does not exist.
15
- // } else if (error instanceof AuthenticationInvalidError) {
16
- // // handle authentication error
17
- // } else if (error instanceof RequestInvalidError) {
18
- // console.log('handle error if there\'s validation error');
19
-
20
- // error.errors.forEach((e) => {
21
- // console.log(e.code);
22
- // console.log(e.detail);
23
- // });
24
- // }
25
- // }
26
-
27
- (async () => {
28
- try {
29
- const paymentIntent = await payrex.paymentIntents.create({ amount: 10000 });
30
- } catch (error) {
31
- console.log('caught error!');
32
- console.log(error.name);
33
- if (error.name === 'ResourceNotFoundError') {
34
- // handle error if a resource does not exist.
35
- } else if (error.name === 'AuthenticationInvalidError') {
36
- // handle authentication error
37
- } else if (error.name === 'RequestInvalidError') {
38
- console.log("handle error if there's validation error");
39
-
40
- error.errors.forEach((e) => {
41
- console.log(e.code);
42
- console.log(e.detail);
43
- });
44
- }
45
- }
46
- })();