@pipedream/spondyr 0.0.1
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/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2020 Pipedream, Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import spondyr from "../../spondyr.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "spondyr-create-spondyr",
|
|
5
|
+
name: "Create Spondyr",
|
|
6
|
+
version: "0.0.1",
|
|
7
|
+
description: "Generate and optionally deliver correspondence. [See the docs here](https://client.spondyr.io/#/Public/Public/Documentation?Section=send-api)",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
spondyr,
|
|
11
|
+
transactionType: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
spondyr,
|
|
14
|
+
"transactionType",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
eventType: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
spondyr,
|
|
20
|
+
"eventType",
|
|
21
|
+
(c) => ({
|
|
22
|
+
transactionType: c.transactionType,
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
isGenerateOnly: {
|
|
27
|
+
type: "boolean",
|
|
28
|
+
label: "Is Generate Only",
|
|
29
|
+
description: "Set this flag to true to pause/defer delivery until a followup call is made via the Deliver API. This is useful for scenarios where you wish to view/preview the generated correspondence and validate things before allowing the correspondence to be delivered.",
|
|
30
|
+
optional: true,
|
|
31
|
+
},
|
|
32
|
+
data: {
|
|
33
|
+
type: "object",
|
|
34
|
+
label: "Data",
|
|
35
|
+
description: "It should contain your application's specific data, which should be in the same format as you defined for the `Transaction Type`",
|
|
36
|
+
optional: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
async run({ $ }) {
|
|
40
|
+
const {
|
|
41
|
+
eventType,
|
|
42
|
+
isGenerateOnly,
|
|
43
|
+
data,
|
|
44
|
+
} = this;
|
|
45
|
+
|
|
46
|
+
const response = await this.spondyr.createSpondyr({
|
|
47
|
+
$,
|
|
48
|
+
EventType: eventType,
|
|
49
|
+
IsGenerateOnly: isGenerateOnly,
|
|
50
|
+
Data: data,
|
|
51
|
+
});
|
|
52
|
+
$.export("$summary", `Spondyr Successfully created with id ${response.ReferenceID}!`);
|
|
53
|
+
return response;
|
|
54
|
+
},
|
|
55
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipedream/spondyr",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Pipedream Spondyr Components",
|
|
5
|
+
"main": "spondyr.app.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pipedream",
|
|
8
|
+
"spondyr"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://pipedream.com/apps/spondyr",
|
|
11
|
+
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@pipedream/platform": "^1.2.1"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
|
|
2
|
+
import spondyr from "../../spondyr.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
type: "source",
|
|
6
|
+
name: "New Spondyr Processed",
|
|
7
|
+
key: "spondyr-spondyr-processed",
|
|
8
|
+
description: "Emit new event when a spondyr is processed. [See docs here](https://client.spondyr.io/#/Public/Public/Documentation?Section=status-api)",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
props: {
|
|
12
|
+
spondyr,
|
|
13
|
+
db: "$.service.db",
|
|
14
|
+
timer: {
|
|
15
|
+
label: "Polling interval",
|
|
16
|
+
description: "Pipedream will poll the Spondyr API on this schedule",
|
|
17
|
+
type: "$.interface.timer",
|
|
18
|
+
default: {
|
|
19
|
+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
referenceId: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "Reference Id",
|
|
25
|
+
description: "The Reference Id of the Spondyr you want to get the status of.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
async processEvent(item) {
|
|
30
|
+
const {
|
|
31
|
+
APIStatus,
|
|
32
|
+
ReferenceID,
|
|
33
|
+
CreatedDate,
|
|
34
|
+
} = item;
|
|
35
|
+
|
|
36
|
+
const dateTime = CreatedDate || new Date().getTime();
|
|
37
|
+
this.$emit(item, {
|
|
38
|
+
id: ReferenceID + APIStatus,
|
|
39
|
+
summary: `Spondyr with ReferenceID ${ReferenceID} was successfully processed!`,
|
|
40
|
+
ts: dateTime,
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
async run() {
|
|
45
|
+
const response = await this.spondyr.getSpondyr({
|
|
46
|
+
ReferenceID: this.referenceId,
|
|
47
|
+
IncludeData: true,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (response.APIStatus === "OK") {
|
|
51
|
+
this.processEvent(response);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
package/spondyr.app.mjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
type: "app",
|
|
5
|
+
app: "spondyr",
|
|
6
|
+
propDefinitions: {
|
|
7
|
+
eventType: {
|
|
8
|
+
type: "string",
|
|
9
|
+
label: "Event Type",
|
|
10
|
+
description: "The Spondyr Event Type",
|
|
11
|
+
async options({
|
|
12
|
+
page, transactionType,
|
|
13
|
+
}) {
|
|
14
|
+
const { Data } = await this.listEventTypes({
|
|
15
|
+
params: {
|
|
16
|
+
page,
|
|
17
|
+
transactionType,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return Data.map((item) => (item.Name));
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
transactionType: {
|
|
25
|
+
type: "string",
|
|
26
|
+
label: "Transaction Type",
|
|
27
|
+
description: "The Spondyr Transaction Type",
|
|
28
|
+
async options({ page }) {
|
|
29
|
+
const { Data } = await this.listTransactionTypes({
|
|
30
|
+
params: {
|
|
31
|
+
page,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return Data.map((item) => (item.Name));
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
methods: {
|
|
40
|
+
_apiUrl() {
|
|
41
|
+
return "https://client.spondyr.io/api/v1.0.0";
|
|
42
|
+
},
|
|
43
|
+
_getHeaders() {
|
|
44
|
+
return {
|
|
45
|
+
"APIKey": this.$auth.api_key,
|
|
46
|
+
"ApplicationToken": this.$auth.app_token,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
async _makeRequest({
|
|
50
|
+
$ = this, path, ...opts
|
|
51
|
+
}) {
|
|
52
|
+
const config = {
|
|
53
|
+
url: `${this._apiUrl()}/${path}`,
|
|
54
|
+
headers: this._getHeaders(),
|
|
55
|
+
...opts,
|
|
56
|
+
};
|
|
57
|
+
return axios($, config);
|
|
58
|
+
},
|
|
59
|
+
createSpondyr({
|
|
60
|
+
$, ...data
|
|
61
|
+
}) {
|
|
62
|
+
return this._makeRequest({
|
|
63
|
+
$,
|
|
64
|
+
path: "Spondyr",
|
|
65
|
+
method: "POST",
|
|
66
|
+
data,
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
getSpondyr ({
|
|
70
|
+
$, ...params
|
|
71
|
+
}) {
|
|
72
|
+
return this._makeRequest({
|
|
73
|
+
$,
|
|
74
|
+
path: "Spondyr",
|
|
75
|
+
params,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
listTransactionTypes({ $ }) {
|
|
79
|
+
return this._makeRequest({
|
|
80
|
+
$,
|
|
81
|
+
path: "TransactionTypes",
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
listEventTypes({
|
|
85
|
+
$, params,
|
|
86
|
+
}) {
|
|
87
|
+
return this._makeRequest({
|
|
88
|
+
$,
|
|
89
|
+
path: "EventTypes",
|
|
90
|
+
params,
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|