@yosle/tropipayjs 0.1.11 → 0.1.13
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/api/TropipayAPI.d.ts +1 -8
- package/docs/.nojekyll +0 -0
- package/docs/404.html +17 -0
- package/docs/assets/css/styles.5c8c3f00.css +1 -0
- package/docs/assets/images/docsVersionDropdown-35e13cbe46c9923327f30a76a90bff3b.png +0 -0
- package/docs/assets/images/docusaurus-plushie-banner-a60f7593abca1e3eef26a9afa244e4fb.jpeg +0 -0
- package/docs/assets/images/localeDropdown-f0d995e751e7656a1b0dbbc1134e49c2.png +0 -0
- package/docs/assets/js/01a85c17.91559aa8.js +1 -0
- package/docs/assets/js/04f53609.3e080413.js +1 -0
- package/docs/assets/js/06f8edbc.d068ca2d.js +1 -0
- package/docs/assets/js/0e384e19.bfafbae8.js +1 -0
- package/docs/assets/js/14eb3368.dc3929be.js +1 -0
- package/docs/assets/js/1506.be55cc02.js +1 -0
- package/docs/assets/js/17896441.6978c74d.js +1 -0
- package/docs/assets/js/18c41134.51213963.js +1 -0
- package/docs/assets/js/1be78505.7eff18a4.js +1 -0
- package/docs/assets/js/1e4232ab.9d5e7d68.js +1 -0
- package/docs/assets/js/1f391b9e.ded0d3af.js +1 -0
- package/docs/assets/js/2529.215308a3.js +1 -0
- package/docs/assets/js/2a62e1de.f5d1c5c9.js +1 -0
- package/docs/assets/js/35eb6bfb.705be990.js +1 -0
- package/docs/assets/js/374b0cdb.7b632eb1.js +1 -0
- package/docs/assets/js/393be207.22fd7b62.js +1 -0
- package/docs/assets/js/4972.074ebb40.js +1 -0
- package/docs/assets/js/5160ec69.26603a56.js +1 -0
- package/docs/assets/js/5334ce5a.424fc12a.js +1 -0
- package/docs/assets/js/533a09ca.636e61f7.js +1 -0
- package/docs/assets/js/59362658.a2ba0846.js +1 -0
- package/docs/assets/js/5c868d36.f7746599.js +1 -0
- package/docs/assets/js/5f55c74a.654d3d70.js +1 -0
- package/docs/assets/js/6875c492.4887a372.js +1 -0
- package/docs/assets/js/6d28c3a2.500d2f8a.js +1 -0
- package/docs/assets/js/7177ef6c.93edadcb.js +1 -0
- package/docs/assets/js/73664a40.9a87d45e.js +1 -0
- package/docs/assets/js/7661071f.e1c9bc29.js +1 -0
- package/docs/assets/js/7ebdc023.47964b2f.js +1 -0
- package/docs/assets/js/814f3328.5d2849da.js +1 -0
- package/docs/assets/js/822bd8ab.d333174b.js +1 -0
- package/docs/assets/js/84d8e3c6.1948afb0.js +1 -0
- package/docs/assets/js/8717b14a.7cc8f157.js +1 -0
- package/docs/assets/js/925b3f96.cec27ac2.js +1 -0
- package/docs/assets/js/935f2afb.f8c4c915.js +1 -0
- package/docs/assets/js/943f97fe.fe5cbcd1.js +1 -0
- package/docs/assets/js/9d38d20f.d2a4a29c.js +1 -0
- package/docs/assets/js/9e4087bc.930b1943.js +1 -0
- package/docs/assets/js/a6aa9e1f.7745bc3a.js +1 -0
- package/docs/assets/js/c4f5d8e4.f1e52410.js +1 -0
- package/docs/assets/js/ccc49370.fbb75b83.js +1 -0
- package/docs/assets/js/d23d5178.fb9fee6f.js +1 -0
- package/docs/assets/js/d47dff13.ca5c7941.js +1 -0
- package/docs/assets/js/d9f32620.abb1b84e.js +1 -0
- package/docs/assets/js/dff1c289.178f928a.js +1 -0
- package/docs/assets/js/e273c56f.ad3daaac.js +1 -0
- package/docs/assets/js/e44a2883.faee0d73.js +1 -0
- package/docs/assets/js/f4f34a3a.6ba2e989.js +1 -0
- package/docs/assets/js/f55d3e7a.9370b31f.js +1 -0
- package/docs/assets/js/feeaa39e.dfbe8222.js +1 -0
- package/docs/assets/js/main.b18edd8d.js +2 -0
- package/docs/assets/js/main.b18edd8d.js.LICENSE.txt +63 -0
- package/docs/assets/js/runtime~main.48a22eee.js +1 -0
- package/docs/blog/archive/index.html +17 -0
- package/docs/blog/atom.xml +70 -0
- package/docs/blog/first-blog-post/index.html +17 -0
- package/docs/blog/index.html +17 -0
- package/docs/blog/long-blog-post/index.html +17 -0
- package/docs/blog/mdx-blog-post/index.html +17 -0
- package/docs/blog/rss.xml +52 -0
- package/docs/blog/tags/docusaurus/index.html +17 -0
- package/docs/blog/tags/facebook/index.html +17 -0
- package/docs/blog/tags/hello/index.html +17 -0
- package/docs/blog/tags/hola/index.html +17 -0
- package/docs/blog/tags/index.html +17 -0
- package/docs/blog/welcome/index.html +17 -0
- package/docs/docs/category/tutorial---basics/index.html +17 -0
- package/docs/docs/category/tutorial---extras/index.html +17 -0
- package/docs/docs/intro/index.html +17 -0
- package/docs/docs/tutorial-basics/congratulations/index.html +17 -0
- package/docs/docs/tutorial-basics/create-a-blog-post/index.html +17 -0
- package/docs/docs/tutorial-basics/create-a-document/index.html +17 -0
- package/docs/docs/tutorial-basics/create-a-page/index.html +17 -0
- package/docs/docs/tutorial-basics/deploy-your-site/index.html +17 -0
- package/docs/docs/tutorial-basics/markdown-features/index.html +17 -0
- package/docs/docs/tutorial-extras/manage-docs-versions/index.html +17 -0
- package/docs/docs/tutorial-extras/translate-your-site/index.html +17 -0
- package/docs/helloReact/index.html +17 -0
- package/docs/img/docusaurus-social-card.jpg +0 -0
- package/docs/img/docusaurus.png +0 -0
- package/docs/img/favicon.ico +0 -0
- package/docs/img/logo.svg +1 -0
- package/docs/img/undraw_docusaurus_mountain.svg +171 -0
- package/docs/img/undraw_docusaurus_react.svg +170 -0
- package/docs/img/undraw_docusaurus_tree.svg +40 -0
- package/docs/index.html +17 -0
- package/docs/markdown-page/index.html +17 -0
- package/docs/sitemap.xml +1 -0
- package/index.d.ts +20 -8
- package/index.js +88 -24
- package/package.json +1 -1
- package/paymentcard/PaymentCard.d.ts +21 -0
- package/src/api/TropipayAPI.ts +0 -24
- package/src/index.ts +7 -0
- package/src/paymentcard/PaymentCard.ts +84 -0
- package/docs/images/app-credentials-menu.png +0 -0
- package/docs/images/confirmation-code-screen.png +0 -0
- package/docs/images/intellisense-vs-code.png +0 -0
- package/docs/index.MD +0 -19
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Tropipay } from "../api/TropipayAPI";
|
|
2
|
+
import { PaymentLink } from "../interfaces";
|
|
3
|
+
import { PaymentLinkPayload } from "../interfaces";
|
|
4
|
+
export class PaymentCard {
|
|
5
|
+
private tropipay: Tropipay;
|
|
6
|
+
|
|
7
|
+
constructor(tropipayInstance: Tropipay) {
|
|
8
|
+
this.tropipay = tropipayInstance;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create a paymentLink with the specified options.
|
|
13
|
+
* @param payload PaymentLinkPayload Object.
|
|
14
|
+
* @returns Promise<PaymentLink> or throws an Exception.
|
|
15
|
+
* @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
|
|
16
|
+
*/
|
|
17
|
+
async create(payload: PaymentLinkPayload): Promise<PaymentLink> {
|
|
18
|
+
if (!Tropipay.accessToken) {
|
|
19
|
+
await this.tropipay.login();
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const paylink = await this.tropipay.request.post(
|
|
23
|
+
"/api/v2/paymentcards",
|
|
24
|
+
payload,
|
|
25
|
+
{
|
|
26
|
+
headers: {
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
Authorization: `Bearer ${Tropipay.accessToken}`,
|
|
29
|
+
Accept: "application/json",
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
return paylink.data as PaymentLink;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw new Error(`TropipayJS - Error creating the Payment Card.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Shows a list of stored paymentcards created by user.
|
|
40
|
+
* This list includes active and closed paylinks
|
|
41
|
+
* @returns Array of paymentlinks
|
|
42
|
+
*/
|
|
43
|
+
public async list() {
|
|
44
|
+
if (!Tropipay.accessToken) {
|
|
45
|
+
await this.tropipay.login();
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const paymentcards = await this.tropipay.request.get(
|
|
49
|
+
`/api/v2/paymentcards`,
|
|
50
|
+
{
|
|
51
|
+
headers: {
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
Authorization: `Bearer ${Tropipay.accessToken}`,
|
|
54
|
+
Accept: "application/json",
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
return paymentcards.data;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
throw new Error(`Could not retrieve PaymenCards list`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public async get(id: string) {
|
|
65
|
+
if (!Tropipay.accessToken) {
|
|
66
|
+
await this.tropipay.login();
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const paymentcard = await this.tropipay.request.get(
|
|
70
|
+
`/api/v2/paymentcards/${id}`,
|
|
71
|
+
{
|
|
72
|
+
headers: {
|
|
73
|
+
"Content-Type": "application/json",
|
|
74
|
+
Authorization: `Bearer ${Tropipay.accessToken}`,
|
|
75
|
+
Accept: "application/json",
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
return paymentcard.data;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
throw new Error(`Could not retrieve PaymenCards`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/index.MD
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Tropipayjs
|
|
2
|
-
|
|
3
|
-
Tropipayjs is a TypeScript/JavaScript library for the Tropipay API.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Installation](#installation)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [API Reference](#api-reference)
|
|
10
|
-
- [Contributing](#contributing)
|
|
11
|
-
- [License](#license)
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
To use Tropipayjs in your project, you need to install it via npm. Run the following command:
|
|
16
|
-
|
|
17
|
-
```npm install tropipayjs```
|
|
18
|
-
or
|
|
19
|
-
```yarn add tropipayjs```
|