Skip to content

Commit 45a5b81

Browse files
committed
add export transaction action
1 parent 1f57408 commit 45a5b81

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import paystack from "../../paystack.app.mjs";
2+
3+
export default {
4+
key: "paystack-export-transactions",
5+
name: "Export Transactions",
6+
description: "Export transactions from Paystack. See the documentation (https://paystack.com/docs/api/transaction/#export)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
paystack,
11+
from: {
12+
propDefinition: [
13+
paystack,
14+
"from",
15+
],
16+
optional: true,
17+
},
18+
to: {
19+
propDefinition: [
20+
paystack,
21+
"to",
22+
],
23+
optional: true,
24+
},
25+
status: {
26+
propDefinition: [
27+
paystack,
28+
"status",
29+
],
30+
optional: true,
31+
},
32+
},
33+
async run({ $ }) {
34+
const params = {
35+
from: this.from,
36+
to: this.to,
37+
status: this.status,
38+
};
39+
40+
const response = this.paystack.exportTransactions({
41+
$,
42+
params,
43+
});
44+
45+
$.export("$summary", `Successfully requested transaction export`);
46+
return response;
47+
},
48+
};

components/paystack/paystack.app.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ export default {
240240
...args,
241241
});
242242
},
243+
exportTransactions(args = {}) {
244+
return this._makeRequest({
245+
path: "/transaction/export",
246+
...args,
247+
});
248+
},
243249
async *paginate({
244250
resourceFn, args, max,
245251
}) {

0 commit comments

Comments
 (0)