@eveai/eve-sdk-for-node 0.0.2 → 0.0.3
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/README.md.bak +510 -0
- package/README.md.orig +510 -0
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +1 -1
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/dist/services/eveai-chat.d.mts +118 -0
- package/dist/services/eveai-chat.d.ts +118 -0
- package/dist/services/eveai-chat.js +115 -0
- package/dist/services/eveai-chat.js.map +1 -0
- package/dist/services/eveai-chat.mjs +114 -0
- package/dist/services/eveai-chat.mjs.map +1 -0
- package/dist/services/eveai-payment.d.mts +145 -0
- package/dist/services/eveai-payment.d.ts +145 -0
- package/dist/services/eveai-payment.js +132 -0
- package/dist/services/eveai-payment.js.map +1 -0
- package/dist/services/eveai-payment.mjs +131 -0
- package/dist/services/eveai-payment.mjs.map +1 -0
- package/dist/services/eveai-provider-discovery.d.mts +126 -0
- package/dist/services/eveai-provider-discovery.d.ts +126 -0
- package/dist/services/eveai-provider-discovery.js +96 -0
- package/dist/services/eveai-provider-discovery.js.map +1 -0
- package/dist/services/eveai-provider-discovery.mjs +95 -0
- package/dist/services/eveai-provider-discovery.mjs.map +1 -0
- package/dist/services/eveai-task.d.mts +137 -0
- package/dist/services/eveai-task.d.ts +137 -0
- package/dist/services/eveai-task.js +143 -0
- package/dist/services/eveai-task.js.map +1 -0
- package/dist/services/eveai-task.mjs +142 -0
- package/dist/services/eveai-task.mjs.map +1 -0
- package/package.json +16 -2
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// src/services/eveai-chat.ts
|
|
2
|
+
var EveAIChat = class {
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Create Conversation
|
|
8
|
+
*
|
|
9
|
+
* Start a new conversation for a task
|
|
10
|
+
*/
|
|
11
|
+
async createConversation(taskId, participantIds) {
|
|
12
|
+
const path = "/chat/conversations";
|
|
13
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
14
|
+
return await this.client.call("post", uri, {
|
|
15
|
+
"content-type": "application/json"
|
|
16
|
+
}, {
|
|
17
|
+
task_id: taskId,
|
|
18
|
+
participant_ids: participantIds
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get Conversation
|
|
23
|
+
*
|
|
24
|
+
* Get conversation details
|
|
25
|
+
*/
|
|
26
|
+
async getConversation(conversationId) {
|
|
27
|
+
const path = `/chat/conversations/${conversationId}`;
|
|
28
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
29
|
+
return await this.client.call("get", uri);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* List Conversations
|
|
33
|
+
*
|
|
34
|
+
* List all user conversations
|
|
35
|
+
*/
|
|
36
|
+
async listConversations(page = 1, pageSize = 20) {
|
|
37
|
+
const path = "/chat/conversations";
|
|
38
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
39
|
+
return await this.client.call("get", uri, {}, {
|
|
40
|
+
page,
|
|
41
|
+
page_size: pageSize
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Send Message
|
|
46
|
+
*
|
|
47
|
+
* Send a chat message
|
|
48
|
+
*/
|
|
49
|
+
async sendMessage(conversationId, content, type = "text", metadata) {
|
|
50
|
+
const path = `/chat/conversations/${conversationId}/messages`;
|
|
51
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
52
|
+
return await this.client.call("post", uri, {
|
|
53
|
+
"content-type": "application/json"
|
|
54
|
+
}, {
|
|
55
|
+
content,
|
|
56
|
+
type,
|
|
57
|
+
metadata
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get Messages
|
|
62
|
+
*
|
|
63
|
+
* Get messages for a conversation
|
|
64
|
+
*/
|
|
65
|
+
async getMessages(conversationId, page = 1, pageSize = 50) {
|
|
66
|
+
const path = `/chat/conversations/${conversationId}/messages`;
|
|
67
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
68
|
+
return await this.client.call("get", uri, {}, {
|
|
69
|
+
page,
|
|
70
|
+
page_size: pageSize
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Mark as Read
|
|
75
|
+
*
|
|
76
|
+
* Mark messages as read
|
|
77
|
+
*/
|
|
78
|
+
async markAsRead(conversationId, messageIds) {
|
|
79
|
+
const path = `/chat/conversations/${conversationId}/read`;
|
|
80
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
81
|
+
return await this.client.call("post", uri, {
|
|
82
|
+
"content-type": "application/json"
|
|
83
|
+
}, {
|
|
84
|
+
message_ids: messageIds
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get Unread Count
|
|
89
|
+
*
|
|
90
|
+
* Get total unread message count
|
|
91
|
+
*/
|
|
92
|
+
async getUnreadCount() {
|
|
93
|
+
const path = "/chat/unread";
|
|
94
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
95
|
+
return await this.client.call("get", uri);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Search Messages
|
|
99
|
+
*
|
|
100
|
+
* Search messages across conversations
|
|
101
|
+
*/
|
|
102
|
+
async searchMessages(query, conversationId) {
|
|
103
|
+
const path = "/chat/search";
|
|
104
|
+
const payload = { query };
|
|
105
|
+
if (conversationId)
|
|
106
|
+
payload.conversation_id = conversationId;
|
|
107
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
108
|
+
return await this.client.call("get", uri, {}, payload);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export { EveAIChat };
|
|
113
|
+
//# sourceMappingURL=out.js.map
|
|
114
|
+
//# sourceMappingURL=eveai-chat.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/eveai-chat.ts"],"names":[],"mappings":";AAOO,IAAM,YAAN,MAAgB;AAAA,EAGnB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,mBACF,QACA,gBAC6B;AAC7B,UAAM,OAAO;AACb,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,QAAQ,KAAK;AAAA,MACvC,gBAAgB;AAAA,IACpB,GAAG;AAAA,MACC,SAAS;AAAA,MACT,iBAAiB;AAAA,IACrB,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,gBAAgB,gBAAuD;AACzE,UAAM,OAAO,uBAAuB,cAAc;AAClD,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,GAAG;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,kBACF,OAAe,GACf,WAAmB,IACc;AACjC,UAAM,OAAO;AACb,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,KAAK,CAAC,GAAG;AAAA,MAC1C;AAAA,MACA,WAAW;AAAA,IACf,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,YACF,gBACA,SACA,OAAe,QACf,UACwB;AACxB,UAAM,OAAO,uBAAuB,cAAc;AAClD,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK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at Service\n * \n * Real-time messaging and conversation management\n */\nexport class EveAIChat {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Create Conversation\n * \n * Start a new conversation for a task\n */\n async createConversation(\n taskId: string,\n participantIds: number[]\n ): Promise<ConversationResponse> {\n const path = '/chat/conversations';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n task_id: taskId,\n participant_ids: participantIds\n });\n }\n\n /**\n * Get Conversation\n * \n * Get conversation details\n */\n async getConversation(conversationId: string): Promise<ConversationResponse> {\n const path = `/chat/conversations/${conversationId}`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri);\n }\n\n /**\n * List Conversations\n * \n * List all user conversations\n */\n async listConversations(\n page: number = 1,\n pageSize: number = 20\n ): Promise<ConversationListResponse> {\n const path = '/chat/conversations';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, {\n page,\n page_size: pageSize\n });\n }\n\n /**\n * Send Message\n * \n * Send a chat message\n */\n async sendMessage(\n conversationId: string,\n content: string,\n type: string = 'text',\n metadata?: any\n ): Promise<MessageResponse> {\n const path = `/chat/conversations/${conversationId}/messages`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n content,\n type,\n metadata\n });\n }\n\n /**\n * Get Messages\n * \n * Get messages for a conversation\n */\n async getMessages(\n conversationId: string,\n page: number = 1,\n pageSize: number = 50\n ): Promise<MessageListResponse> {\n const path = `/chat/conversations/${conversationId}/messages`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, {\n page,\n page_size: pageSize\n });\n }\n\n /**\n * Mark as Read\n * \n * Mark messages as read\n */\n async markAsRead(\n conversationId: string,\n messageIds: string[]\n ): Promise<StatusResponse> {\n const path = `/chat/conversations/${conversationId}/read`;\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n message_ids: messageIds\n });\n }\n\n /**\n * Get Unread Count\n * \n * Get total unread message count\n */\n async getUnreadCount(): Promise<UnreadCountResponse> {\n const path = '/chat/unread';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri);\n }\n\n /**\n * Search Messages\n * \n * Search messages across conversations\n */\n async searchMessages(\n query: string,\n conversationId?: string\n ): Promise<MessageListResponse> {\n const path = '/chat/search';\n const payload: any = { query };\n if (conversationId) payload.conversation_id = conversationId;\n\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, payload);\n }\n}\n\n// Types\nexport interface ConversationResponse {\n status_code: number;\n conversation: Conversation;\n}\n\nexport interface Conversation {\n id: string;\n task_id: string;\n participants: number[];\n last_message?: Message;\n unread_count: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface ConversationListResponse {\n status_code: number;\n conversations: Conversation[];\n total: number;\n}\n\nexport interface MessageResponse {\n status_code: number;\n message: Message;\n}\n\nexport interface Message {\n id: string;\n conversation_id: string;\n sender_id: number;\n content: string;\n type: string;\n metadata?: any;\n is_read: boolean;\n created_at: string;\n}\n\nexport interface MessageListResponse {\n status_code: number;\n messages: Message[];\n total: number;\n}\n\nexport interface UnreadCountResponse {\n status_code: number;\n unread_count: number;\n}\n\nexport interface StatusResponse {\n status_code: number;\n status_msg: string;\n}\n"]}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Client } from '../client.mjs';
|
|
2
|
+
import '../models.mjs';
|
|
3
|
+
import '../enums/database-type.mjs';
|
|
4
|
+
import '../enums/attribute-status.mjs';
|
|
5
|
+
import '../enums/column-status.mjs';
|
|
6
|
+
import '../enums/index-status.mjs';
|
|
7
|
+
import '../enums/deployment-status.mjs';
|
|
8
|
+
import '../enums/execution-trigger.mjs';
|
|
9
|
+
import '../enums/execution-status.mjs';
|
|
10
|
+
import '../enums/health-antivirus-status.mjs';
|
|
11
|
+
import '../enums/health-check-status.mjs';
|
|
12
|
+
import '../enums/message-status.mjs';
|
|
13
|
+
import '../query.mjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Eve.AI Payment Service
|
|
17
|
+
*
|
|
18
|
+
* Stripe payment processing, subscriptions, and transaction management
|
|
19
|
+
*/
|
|
20
|
+
declare class EveAIPayment {
|
|
21
|
+
client: Client;
|
|
22
|
+
constructor(client: Client);
|
|
23
|
+
/**
|
|
24
|
+
* Calculate Price
|
|
25
|
+
*
|
|
26
|
+
* Calculate final price with platform fee and member discount
|
|
27
|
+
*/
|
|
28
|
+
calculatePrice(baseAmount: number, tip?: number, isMember?: boolean): Promise<PriceCalculationResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Create Payment Intent
|
|
31
|
+
*
|
|
32
|
+
* Create Stripe payment intent for task payment
|
|
33
|
+
*/
|
|
34
|
+
createPaymentIntent(taskId: string, amount: number, currency?: string): Promise<PaymentIntentResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Confirm Payment
|
|
37
|
+
*
|
|
38
|
+
* Confirm payment and transfer funds
|
|
39
|
+
*/
|
|
40
|
+
confirmPayment(paymentIntentId: string, taskId: string): Promise<PaymentResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to Membership
|
|
43
|
+
*
|
|
44
|
+
* Subscribe user to $25/month membership
|
|
45
|
+
*/
|
|
46
|
+
subscribe(paymentMethodId: string): Promise<SubscriptionResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Cancel Subscription
|
|
49
|
+
*
|
|
50
|
+
* Cancel membership subscription
|
|
51
|
+
*/
|
|
52
|
+
cancelSubscription(): Promise<SubscriptionResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Get Subscription Status
|
|
55
|
+
*
|
|
56
|
+
* Check current subscription status
|
|
57
|
+
*/
|
|
58
|
+
getSubscription(): Promise<SubscriptionResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Get Payment History
|
|
61
|
+
*
|
|
62
|
+
* List all payments for user
|
|
63
|
+
*/
|
|
64
|
+
getPaymentHistory(page?: number, pageSize?: number): Promise<PaymentListResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Get Earnings
|
|
67
|
+
*
|
|
68
|
+
* Get provider earnings summary
|
|
69
|
+
*/
|
|
70
|
+
getEarnings(startDate?: string, endDate?: string): Promise<EarningsResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Request Payout
|
|
73
|
+
*
|
|
74
|
+
* Request payout to bank account
|
|
75
|
+
*/
|
|
76
|
+
requestPayout(amount: number): Promise<PayoutResponse>;
|
|
77
|
+
}
|
|
78
|
+
interface PriceCalculationResponse {
|
|
79
|
+
status_code: number;
|
|
80
|
+
total: number;
|
|
81
|
+
base_amount: number;
|
|
82
|
+
tip: number;
|
|
83
|
+
platform_fee: number;
|
|
84
|
+
discount: number;
|
|
85
|
+
breakdown: {
|
|
86
|
+
subtotal: number;
|
|
87
|
+
platform_fee: number;
|
|
88
|
+
discount: number;
|
|
89
|
+
tip: number;
|
|
90
|
+
total: number;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
interface PaymentIntentResponse {
|
|
94
|
+
status_code: number;
|
|
95
|
+
client_secret: string;
|
|
96
|
+
payment_intent_id: string;
|
|
97
|
+
}
|
|
98
|
+
interface PaymentResponse {
|
|
99
|
+
status_code: number;
|
|
100
|
+
status_msg: string;
|
|
101
|
+
payment: Payment;
|
|
102
|
+
}
|
|
103
|
+
interface Payment {
|
|
104
|
+
id: string;
|
|
105
|
+
task_id: string;
|
|
106
|
+
amount: number;
|
|
107
|
+
status: string;
|
|
108
|
+
created_at: string;
|
|
109
|
+
}
|
|
110
|
+
interface SubscriptionResponse {
|
|
111
|
+
status_code: number;
|
|
112
|
+
subscription?: Subscription;
|
|
113
|
+
}
|
|
114
|
+
interface Subscription {
|
|
115
|
+
id: string;
|
|
116
|
+
status: string;
|
|
117
|
+
current_period_end: string;
|
|
118
|
+
cancel_at_period_end: boolean;
|
|
119
|
+
}
|
|
120
|
+
interface PaymentListResponse {
|
|
121
|
+
status_code: number;
|
|
122
|
+
payments: Payment[];
|
|
123
|
+
total: number;
|
|
124
|
+
}
|
|
125
|
+
interface EarningsResponse {
|
|
126
|
+
status_code: number;
|
|
127
|
+
total_earnings: number;
|
|
128
|
+
available_balance: number;
|
|
129
|
+
pending_balance: number;
|
|
130
|
+
breakdown: {
|
|
131
|
+
completed_tasks: number;
|
|
132
|
+
total_revenue: number;
|
|
133
|
+
platform_fees: number;
|
|
134
|
+
net_earnings: number;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
interface PayoutResponse {
|
|
138
|
+
status_code: number;
|
|
139
|
+
payout_id: string;
|
|
140
|
+
amount: number;
|
|
141
|
+
status: string;
|
|
142
|
+
estimated_arrival: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { EarningsResponse, EveAIPayment, Payment, PaymentIntentResponse, PaymentListResponse, PaymentResponse, PayoutResponse, PriceCalculationResponse, Subscription, SubscriptionResponse };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Client } from '../client.js';
|
|
2
|
+
import '../models.js';
|
|
3
|
+
import '../enums/database-type.js';
|
|
4
|
+
import '../enums/attribute-status.js';
|
|
5
|
+
import '../enums/column-status.js';
|
|
6
|
+
import '../enums/index-status.js';
|
|
7
|
+
import '../enums/deployment-status.js';
|
|
8
|
+
import '../enums/execution-trigger.js';
|
|
9
|
+
import '../enums/execution-status.js';
|
|
10
|
+
import '../enums/health-antivirus-status.js';
|
|
11
|
+
import '../enums/health-check-status.js';
|
|
12
|
+
import '../enums/message-status.js';
|
|
13
|
+
import '../query.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Eve.AI Payment Service
|
|
17
|
+
*
|
|
18
|
+
* Stripe payment processing, subscriptions, and transaction management
|
|
19
|
+
*/
|
|
20
|
+
declare class EveAIPayment {
|
|
21
|
+
client: Client;
|
|
22
|
+
constructor(client: Client);
|
|
23
|
+
/**
|
|
24
|
+
* Calculate Price
|
|
25
|
+
*
|
|
26
|
+
* Calculate final price with platform fee and member discount
|
|
27
|
+
*/
|
|
28
|
+
calculatePrice(baseAmount: number, tip?: number, isMember?: boolean): Promise<PriceCalculationResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Create Payment Intent
|
|
31
|
+
*
|
|
32
|
+
* Create Stripe payment intent for task payment
|
|
33
|
+
*/
|
|
34
|
+
createPaymentIntent(taskId: string, amount: number, currency?: string): Promise<PaymentIntentResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Confirm Payment
|
|
37
|
+
*
|
|
38
|
+
* Confirm payment and transfer funds
|
|
39
|
+
*/
|
|
40
|
+
confirmPayment(paymentIntentId: string, taskId: string): Promise<PaymentResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to Membership
|
|
43
|
+
*
|
|
44
|
+
* Subscribe user to $25/month membership
|
|
45
|
+
*/
|
|
46
|
+
subscribe(paymentMethodId: string): Promise<SubscriptionResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Cancel Subscription
|
|
49
|
+
*
|
|
50
|
+
* Cancel membership subscription
|
|
51
|
+
*/
|
|
52
|
+
cancelSubscription(): Promise<SubscriptionResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Get Subscription Status
|
|
55
|
+
*
|
|
56
|
+
* Check current subscription status
|
|
57
|
+
*/
|
|
58
|
+
getSubscription(): Promise<SubscriptionResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Get Payment History
|
|
61
|
+
*
|
|
62
|
+
* List all payments for user
|
|
63
|
+
*/
|
|
64
|
+
getPaymentHistory(page?: number, pageSize?: number): Promise<PaymentListResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Get Earnings
|
|
67
|
+
*
|
|
68
|
+
* Get provider earnings summary
|
|
69
|
+
*/
|
|
70
|
+
getEarnings(startDate?: string, endDate?: string): Promise<EarningsResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Request Payout
|
|
73
|
+
*
|
|
74
|
+
* Request payout to bank account
|
|
75
|
+
*/
|
|
76
|
+
requestPayout(amount: number): Promise<PayoutResponse>;
|
|
77
|
+
}
|
|
78
|
+
interface PriceCalculationResponse {
|
|
79
|
+
status_code: number;
|
|
80
|
+
total: number;
|
|
81
|
+
base_amount: number;
|
|
82
|
+
tip: number;
|
|
83
|
+
platform_fee: number;
|
|
84
|
+
discount: number;
|
|
85
|
+
breakdown: {
|
|
86
|
+
subtotal: number;
|
|
87
|
+
platform_fee: number;
|
|
88
|
+
discount: number;
|
|
89
|
+
tip: number;
|
|
90
|
+
total: number;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
interface PaymentIntentResponse {
|
|
94
|
+
status_code: number;
|
|
95
|
+
client_secret: string;
|
|
96
|
+
payment_intent_id: string;
|
|
97
|
+
}
|
|
98
|
+
interface PaymentResponse {
|
|
99
|
+
status_code: number;
|
|
100
|
+
status_msg: string;
|
|
101
|
+
payment: Payment;
|
|
102
|
+
}
|
|
103
|
+
interface Payment {
|
|
104
|
+
id: string;
|
|
105
|
+
task_id: string;
|
|
106
|
+
amount: number;
|
|
107
|
+
status: string;
|
|
108
|
+
created_at: string;
|
|
109
|
+
}
|
|
110
|
+
interface SubscriptionResponse {
|
|
111
|
+
status_code: number;
|
|
112
|
+
subscription?: Subscription;
|
|
113
|
+
}
|
|
114
|
+
interface Subscription {
|
|
115
|
+
id: string;
|
|
116
|
+
status: string;
|
|
117
|
+
current_period_end: string;
|
|
118
|
+
cancel_at_period_end: boolean;
|
|
119
|
+
}
|
|
120
|
+
interface PaymentListResponse {
|
|
121
|
+
status_code: number;
|
|
122
|
+
payments: Payment[];
|
|
123
|
+
total: number;
|
|
124
|
+
}
|
|
125
|
+
interface EarningsResponse {
|
|
126
|
+
status_code: number;
|
|
127
|
+
total_earnings: number;
|
|
128
|
+
available_balance: number;
|
|
129
|
+
pending_balance: number;
|
|
130
|
+
breakdown: {
|
|
131
|
+
completed_tasks: number;
|
|
132
|
+
total_revenue: number;
|
|
133
|
+
platform_fees: number;
|
|
134
|
+
net_earnings: number;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
interface PayoutResponse {
|
|
138
|
+
status_code: number;
|
|
139
|
+
payout_id: string;
|
|
140
|
+
amount: number;
|
|
141
|
+
status: string;
|
|
142
|
+
estimated_arrival: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { EarningsResponse, EveAIPayment, Payment, PaymentIntentResponse, PaymentListResponse, PaymentResponse, PayoutResponse, PriceCalculationResponse, Subscription, SubscriptionResponse };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class EveAIPayment {
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Calculate Price
|
|
9
|
+
*
|
|
10
|
+
* Calculate final price with platform fee and member discount
|
|
11
|
+
*/
|
|
12
|
+
async calculatePrice(baseAmount, tip = 0, isMember = false) {
|
|
13
|
+
const path = "/payment/calculate";
|
|
14
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
15
|
+
return await this.client.call("post", uri, {
|
|
16
|
+
"content-type": "application/json"
|
|
17
|
+
}, {
|
|
18
|
+
base_amount: baseAmount,
|
|
19
|
+
tip,
|
|
20
|
+
is_member: isMember
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create Payment Intent
|
|
25
|
+
*
|
|
26
|
+
* Create Stripe payment intent for task payment
|
|
27
|
+
*/
|
|
28
|
+
async createPaymentIntent(taskId, amount, currency = "usd") {
|
|
29
|
+
const path = "/payment/create-intent";
|
|
30
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
31
|
+
return await this.client.call("post", uri, {
|
|
32
|
+
"content-type": "application/json"
|
|
33
|
+
}, {
|
|
34
|
+
task_id: taskId,
|
|
35
|
+
amount,
|
|
36
|
+
currency
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Confirm Payment
|
|
41
|
+
*
|
|
42
|
+
* Confirm payment and transfer funds
|
|
43
|
+
*/
|
|
44
|
+
async confirmPayment(paymentIntentId, taskId) {
|
|
45
|
+
const path = "/payment/confirm";
|
|
46
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
47
|
+
return await this.client.call("post", uri, {
|
|
48
|
+
"content-type": "application/json"
|
|
49
|
+
}, {
|
|
50
|
+
payment_intent_id: paymentIntentId,
|
|
51
|
+
task_id: taskId
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Subscribe to Membership
|
|
56
|
+
*
|
|
57
|
+
* Subscribe user to $25/month membership
|
|
58
|
+
*/
|
|
59
|
+
async subscribe(paymentMethodId) {
|
|
60
|
+
const path = "/payment/subscribe";
|
|
61
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
62
|
+
return await this.client.call("post", uri, {
|
|
63
|
+
"content-type": "application/json"
|
|
64
|
+
}, {
|
|
65
|
+
payment_method_id: paymentMethodId
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Cancel Subscription
|
|
70
|
+
*
|
|
71
|
+
* Cancel membership subscription
|
|
72
|
+
*/
|
|
73
|
+
async cancelSubscription() {
|
|
74
|
+
const path = "/payment/cancel-subscription";
|
|
75
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
76
|
+
return await this.client.call("post", uri);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get Subscription Status
|
|
80
|
+
*
|
|
81
|
+
* Check current subscription status
|
|
82
|
+
*/
|
|
83
|
+
async getSubscription() {
|
|
84
|
+
const path = "/payment/subscription";
|
|
85
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
86
|
+
return await this.client.call("get", uri);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get Payment History
|
|
90
|
+
*
|
|
91
|
+
* List all payments for user
|
|
92
|
+
*/
|
|
93
|
+
async getPaymentHistory(page = 1, pageSize = 20) {
|
|
94
|
+
const path = "/payment/history";
|
|
95
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
96
|
+
return await this.client.call("get", uri, {}, {
|
|
97
|
+
page,
|
|
98
|
+
page_size: pageSize
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get Earnings
|
|
103
|
+
*
|
|
104
|
+
* Get provider earnings summary
|
|
105
|
+
*/
|
|
106
|
+
async getEarnings(startDate, endDate) {
|
|
107
|
+
const path = "/payment/earnings";
|
|
108
|
+
const payload = {};
|
|
109
|
+
if (startDate)
|
|
110
|
+
payload.start_date = startDate;
|
|
111
|
+
if (endDate)
|
|
112
|
+
payload.end_date = endDate;
|
|
113
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
114
|
+
return await this.client.call("get", uri, {}, payload);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Request Payout
|
|
118
|
+
*
|
|
119
|
+
* Request payout to bank account
|
|
120
|
+
*/
|
|
121
|
+
async requestPayout(amount) {
|
|
122
|
+
const path = "/payment/payout";
|
|
123
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
124
|
+
return await this.client.call("post", uri, {
|
|
125
|
+
"content-type": "application/json"
|
|
126
|
+
}, { amount });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
exports.EveAIPayment = EveAIPayment;
|
|
131
|
+
//# sourceMappingURL=out.js.map
|
|
132
|
+
//# sourceMappingURL=eveai-payment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/services/eveai-payment.ts"],"names":[],"mappings":"AAOO,MAAM,aAAa;AAAA,EAGtB,YAAY,QAAgB;AACxB,SAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,eACF,YACA,MAAc,GACd,WAAoB,OACa;AACjC,UAAM,OAAO;AACb,UAAM,MAAM,IAAI,IA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AAO,KAAK,QAAQ,GAAG;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,kBAAiD;AACnD,UAAM,OAAO;AACb,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,GAAG;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,kBACF,OAAe,GACf,WAAmB,IACS;AAC5B,UAAM,OAAO;AACb,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,KAAK,CAAC,GAAG;AAAA,MAC1C;AAAA,MACA,WAAW;AAAA,IACf,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,YACF,WACA,SACyB;AACzB,UAAM,OAAO;AACb,UAAM,UAAe,CAAC;AACtB,QAAI;AAAW,cAAQ,aAAa;AACpC,QAAI;AAAS,cAAQ,WAAW;AAEhC,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,OAAO,KAAK,CAAC,GAAG,OAAO;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,cAAc,QAAyC;AACzD,UAAM,OAAO;AACb,UAAM,MAAM,IAAI,IAAI,KAAK,OAAO,OAAO,WAAW,IAAI;AACtD,WAAO,MAAM,KAAK,OAAO,KAAK,QAAQ,KAAK;AAAA,MACvC,gBAAgB;AAAA,IACpB,GAAG,EAAE,OAAO,CAAC;AAAA,EACjB;AACJ","sourcesContent":["import { Client } from '../client';\n\n/**\n * Eve.AI Payment Service\n * \n * Stripe payment processing, subscriptions, and transaction management\n */\nexport class EveAIPayment {\n client: Client;\n\n constructor(client: Client) {\n this.client = client;\n }\n\n /**\n * Calculate Price\n * \n * Calculate final price with platform fee and member discount\n */\n async calculatePrice(\n baseAmount: number,\n tip: number = 0,\n isMember: boolean = false\n ): Promise<PriceCalculationResponse> {\n const path = '/payment/calculate';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n base_amount: baseAmount,\n tip,\n is_member: isMember\n });\n }\n\n /**\n * Create Payment Intent\n * \n * Create Stripe payment intent for task payment\n */\n async createPaymentIntent(\n taskId: string,\n amount: number,\n currency: string = 'usd'\n ): Promise<PaymentIntentResponse> {\n const path = '/payment/create-intent';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n task_id: taskId,\n amount,\n currency\n });\n }\n\n /**\n * Confirm Payment\n * \n * Confirm payment and transfer funds\n */\n async confirmPayment(\n paymentIntentId: string,\n taskId: string\n ): Promise<PaymentResponse> {\n const path = '/payment/confirm';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n payment_intent_id: paymentIntentId,\n task_id: taskId\n });\n }\n\n /**\n * Subscribe to Membership\n * \n * Subscribe user to $25/month membership\n */\n async subscribe(paymentMethodId: string): Promise<SubscriptionResponse> {\n const path = '/payment/subscribe';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, {\n payment_method_id: paymentMethodId\n });\n }\n\n /**\n * Cancel Subscription\n * \n * Cancel membership subscription\n */\n async cancelSubscription(): Promise<SubscriptionResponse> {\n const path = '/payment/cancel-subscription';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri);\n }\n\n /**\n * Get Subscription Status\n * \n * Check current subscription status\n */\n async getSubscription(): Promise<SubscriptionResponse> {\n const path = '/payment/subscription';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri);\n }\n\n /**\n * Get Payment History\n * \n * List all payments for user\n */\n async getPaymentHistory(\n page: number = 1,\n pageSize: number = 20\n ): Promise<PaymentListResponse> {\n const path = '/payment/history';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, {\n page,\n page_size: pageSize\n });\n }\n\n /**\n * Get Earnings\n * \n * Get provider earnings summary\n */\n async getEarnings(\n startDate?: string,\n endDate?: string\n ): Promise<EarningsResponse> {\n const path = '/payment/earnings';\n const payload: any = {};\n if (startDate) payload.start_date = startDate;\n if (endDate) payload.end_date = endDate;\n\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('get', uri, {}, payload);\n }\n\n /**\n * Request Payout\n * \n * Request payout to bank account\n */\n async requestPayout(amount: number): Promise<PayoutResponse> {\n const path = '/payment/payout';\n const uri = new URL(this.client.config.endpoint + path);\n return await this.client.call('post', uri, {\n 'content-type': 'application/json',\n }, { amount });\n }\n}\n\n// Types\nexport interface PriceCalculationResponse {\n status_code: number;\n total: number;\n base_amount: number;\n tip: number;\n platform_fee: number;\n discount: number;\n breakdown: {\n subtotal: number;\n platform_fee: number;\n discount: number;\n tip: number;\n total: number;\n };\n}\n\nexport interface PaymentIntentResponse {\n status_code: number;\n client_secret: string;\n payment_intent_id: string;\n}\n\nexport interface PaymentResponse {\n status_code: number;\n status_msg: string;\n payment: Payment;\n}\n\nexport interface Payment {\n id: string;\n task_id: string;\n amount: number;\n status: string;\n created_at: string;\n}\n\nexport interface SubscriptionResponse {\n status_code: number;\n subscription?: Subscription;\n}\n\nexport interface Subscription {\n id: string;\n status: string;\n current_period_end: string;\n cancel_at_period_end: boolean;\n}\n\nexport interface PaymentListResponse {\n status_code: number;\n payments: Payment[];\n total: number;\n}\n\nexport interface EarningsResponse {\n status_code: number;\n total_earnings: number;\n available_balance: number;\n pending_balance: number;\n breakdown: {\n completed_tasks: number;\n total_revenue: number;\n platform_fees: number;\n net_earnings: number;\n };\n}\n\nexport interface PayoutResponse {\n status_code: number;\n payout_id: string;\n amount: number;\n status: string;\n estimated_arrival: string;\n}\n"]}
|