node-behind-api-client 2.0.48

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.
Files changed (157) hide show
  1. package/.gitlab-ci.yml +20 -0
  2. package/README.md +65 -0
  3. package/docs/behind-api-client/easyjob/JobDescriptions/README.md +654 -0
  4. package/docs/behind-api-client/easyjob/README.md +647 -0
  5. package/docs/behind-api-client/easyjob/applicants/README.md +494 -0
  6. package/docs/behind-api-client/easyjob/applications/README.md +754 -0
  7. package/docs/behind-api-client/easyjob/candidateProfiles/README.md +940 -0
  8. package/docs/behind-api-client/easyjob/jd-candidate-questions/README.md +372 -0
  9. package/docs/behind-api-client/payments/payture/README.21.md +901 -0
  10. package/docs/behind-api-client/payments/payture/README.cards.md +1497 -0
  11. package/docs/behind-api-client/payments/payture/README.md +1497 -0
  12. package/docs/behind-api-client/payments/payture/README.rukitchen.md +396 -0
  13. package/docs/behind-api-client/payments/payture/README.subscriptions.md +1266 -0
  14. package/docs/behind-api-client/payments/stripe/README.flow.md +254 -0
  15. package/docs/behind-api-client/rag/storage/README.md +519 -0
  16. package/example.js +35 -0
  17. package/index.cjs +14 -0
  18. package/index.js +15 -0
  19. package/lib/behind-api-auth-client/BehindApiAuthClient.js +91 -0
  20. package/lib/behind-api-auth-client/authorisation/AuthorisationApp.js +9 -0
  21. package/lib/behind-api-auth-client/authorisation/AuthorisationV10.js +9 -0
  22. package/lib/behind-api-auth-client/authorisation/AuthorisationV10Code.js +30 -0
  23. package/lib/behind-api-auth-client/example.js +47 -0
  24. package/lib/behind-api-auth-client/package.json +9 -0
  25. package/lib/behind-api-client/BehindApiClient.js +137 -0
  26. package/lib/behind-api-client/chat/ChatApp.js +11 -0
  27. package/lib/behind-api-client/chat/ChatV10.js +13 -0
  28. package/lib/behind-api-client/chat/ChatV10Chat.js +87 -0
  29. package/lib/behind-api-client/chat/ChatV10Chats.js +14 -0
  30. package/lib/behind-api-client/chat/ChatV10Message.js +57 -0
  31. package/lib/behind-api-client/chat/ChatV20.js +11 -0
  32. package/lib/behind-api-client/chat/ChatV20Chat.js +14 -0
  33. package/lib/behind-api-client/chat/ChatV20Message.js +27 -0
  34. package/lib/behind-api-client/easyjob/EasyjobApp.js +9 -0
  35. package/lib/behind-api-client/easyjob/EasyjobV10.js +31 -0
  36. package/lib/behind-api-client/easyjob/EasyjobV10Answers.js +16 -0
  37. package/lib/behind-api-client/easyjob/EasyjobV10Applicants.js +29 -0
  38. package/lib/behind-api-client/easyjob/EasyjobV10Applications.js +39 -0
  39. package/lib/behind-api-client/easyjob/EasyjobV10CandidateProfileArtifacts.js +31 -0
  40. package/lib/behind-api-client/easyjob/EasyjobV10CandidateProfiles.js +99 -0
  41. package/lib/behind-api-client/easyjob/EasyjobV10Companies.js +36 -0
  42. package/lib/behind-api-client/easyjob/EasyjobV10Cv.js +15 -0
  43. package/lib/behind-api-client/easyjob/EasyjobV10Departments.js +37 -0
  44. package/lib/behind-api-client/easyjob/EasyjobV10JobDescriptionArtifacts.js +29 -0
  45. package/lib/behind-api-client/easyjob/EasyjobV10JobDescriptionCandidateQuestions.js +63 -0
  46. package/lib/behind-api-client/easyjob/EasyjobV10JobDescriptions.js +93 -0
  47. package/lib/behind-api-client/easyjob/EasyjobV10Reports.js +35 -0
  48. package/lib/behind-api-client/example.js +47 -0
  49. package/lib/behind-api-client/global/GlobalApp.js +9 -0
  50. package/lib/behind-api-client/global/GlobalV10.js +11 -0
  51. package/lib/behind-api-client/global/GlobalV10Sockets.js +16 -0
  52. package/lib/behind-api-client/global/GlobalV10Storage.js +29 -0
  53. package/lib/behind-api-client/gpt/GptApp.js +15 -0
  54. package/lib/behind-api-client/gpt/GptV10.js +15 -0
  55. package/lib/behind-api-client/gpt/GptV10Prompt.js +17 -0
  56. package/lib/behind-api-client/gpt/GptV10Request.js +16 -0
  57. package/lib/behind-api-client/gpt/GptV10Storedprompts.js +14 -0
  58. package/lib/behind-api-client/gpt/GptV10Whisper.js +23 -0
  59. package/lib/behind-api-client/gpt/GptV20.js +9 -0
  60. package/lib/behind-api-client/gpt/GptV20Prompt.js +15 -0
  61. package/lib/behind-api-client/gpt/GptV30.js +13 -0
  62. package/lib/behind-api-client/gpt/GptV30Chat.js +19 -0
  63. package/lib/behind-api-client/gpt/GptV30Prompt.js +41 -0
  64. package/lib/behind-api-client/gpt/GptV30Prompts.js +32 -0
  65. package/lib/behind-api-client/gpt/GptV40.js +11 -0
  66. package/lib/behind-api-client/gpt/GptV40Prompt.js +24 -0
  67. package/lib/behind-api-client/gpt/GptV40Prompts.js +30 -0
  68. package/lib/behind-api-client/mailer/MailerApp.js +11 -0
  69. package/lib/behind-api-client/mailer/MailerV10.js +15 -0
  70. package/lib/behind-api-client/mailer/MailerV10Bulk.js +21 -0
  71. package/lib/behind-api-client/mailer/MailerV10Message.js +83 -0
  72. package/lib/behind-api-client/mailer/MailerV10Settings.js +44 -0
  73. package/lib/behind-api-client/mailer/MailerV10Template.js +23 -0
  74. package/lib/behind-api-client/mailer/MailerV20.js +9 -0
  75. package/lib/behind-api-client/mailer/MailerV20Message.js +21 -0
  76. package/lib/behind-api-client/mastogram/MastogramApp.js +9 -0
  77. package/lib/behind-api-client/mastogram/MastogramV10.js +13 -0
  78. package/lib/behind-api-client/mastogram/MastogramV10Bluesky.js +42 -0
  79. package/lib/behind-api-client/mastogram/MastogramV10Mastodon.js +45 -0
  80. package/lib/behind-api-client/mastogram/MastogramV10Telegram.js +39 -0
  81. package/lib/behind-api-client/monitor/MonitorApp.js +9 -0
  82. package/lib/behind-api-client/monitor/MonitorV10.js +13 -0
  83. package/lib/behind-api-client/monitor/MonitorV10Finances.js +39 -0
  84. package/lib/behind-api-client/monitor/MonitorV10Record.js +15 -0
  85. package/lib/behind-api-client/monitor/MonitorV10Records.js +22 -0
  86. package/lib/behind-api-client/oauth/OauthApp.js +9 -0
  87. package/lib/behind-api-client/oauth/OauthV10.js +9 -0
  88. package/lib/behind-api-client/oauth/OauthV10Authorisation.js +15 -0
  89. package/lib/behind-api-client/package.json +9 -0
  90. package/lib/behind-api-client/payments/PaymentsApp.js +13 -0
  91. package/lib/behind-api-client/payments/PaymentsV10.js +15 -0
  92. package/lib/behind-api-client/payments/PaymentsV10Gift.js +32 -0
  93. package/lib/behind-api-client/payments/PaymentsV10Payture.js +30 -0
  94. package/lib/behind-api-client/payments/PaymentsV10Product.js +15 -0
  95. package/lib/behind-api-client/payments/PaymentsV10Telegram.js +44 -0
  96. package/lib/behind-api-client/payments/PaymentsV20.js +9 -0
  97. package/lib/behind-api-client/payments/PaymentsV20Payture.js +32 -0
  98. package/lib/behind-api-client/payments/PaymentsV21.js +15 -0
  99. package/lib/behind-api-client/payments/PaymentsV21Cards.js +14 -0
  100. package/lib/behind-api-client/payments/PaymentsV21Payture.js +29 -0
  101. package/lib/behind-api-client/payments/PaymentsV21Stripe.js +28 -0
  102. package/lib/behind-api-client/payments/PaymentsV21Subscriptions.js +21 -0
  103. package/lib/behind-api-client/questionnaire/QuestionnaireApp.js +9 -0
  104. package/lib/behind-api-client/questionnaire/QuestionnaireV10.js +9 -0
  105. package/lib/behind-api-client/questionnaire/QuestionnaireV10Form.js +22 -0
  106. package/lib/behind-api-client/raet/RaetApp.js +11 -0
  107. package/lib/behind-api-client/raet/RaetV10.js +21 -0
  108. package/lib/behind-api-client/raet/RaetV10Cv.js +87 -0
  109. package/lib/behind-api-client/raet/RaetV10Individual.js +43 -0
  110. package/lib/behind-api-client/raet/RaetV10Individuals.js +38 -0
  111. package/lib/behind-api-client/raet/RaetV10Jd.js +47 -0
  112. package/lib/behind-api-client/raet/RaetV10Project.js +61 -0
  113. package/lib/behind-api-client/raet/RaetV10Projects.js +14 -0
  114. package/lib/behind-api-client/raet/RaetV10Report.js +39 -0
  115. package/lib/behind-api-client/raet/RaetV20.js +11 -0
  116. package/lib/behind-api-client/raet/RaetV20Cv.js +31 -0
  117. package/lib/behind-api-client/raet/RaetV20Individuals.js +25 -0
  118. package/lib/behind-api-client/rag/RagApp.js +9 -0
  119. package/lib/behind-api-client/rag/RagV10.js +9 -0
  120. package/lib/behind-api-client/rag/RagV10Storage.js +27 -0
  121. package/lib/behind-api-client/ruKitchen/RuKitchenApp.js +9 -0
  122. package/lib/behind-api-client/ruKitchen/RuKitchenV10.js +11 -0
  123. package/lib/behind-api-client/ruKitchen/RuKitchenV10Importer.js +29 -0
  124. package/lib/behind-api-client/ruKitchen/RuKitchenV10SeoArticle.js +14 -0
  125. package/lib/behind-api-client/sales/SalesApp.js +11 -0
  126. package/lib/behind-api-client/sales/SalesV10.js +23 -0
  127. package/lib/behind-api-client/sales/SalesV10Catalogue.js +58 -0
  128. package/lib/behind-api-client/sales/SalesV10Categories.js +15 -0
  129. package/lib/behind-api-client/sales/SalesV10Companies.js +55 -0
  130. package/lib/behind-api-client/sales/SalesV10Company.js +120 -0
  131. package/lib/behind-api-client/sales/SalesV10Group.js +70 -0
  132. package/lib/behind-api-client/sales/SalesV10Groups.js +21 -0
  133. package/lib/behind-api-client/sales/SalesV10Logs.js +14 -0
  134. package/lib/behind-api-client/sales/SalesV10Notes.js +38 -0
  135. package/lib/behind-api-client/sales/SalesV20.js +11 -0
  136. package/lib/behind-api-client/sales/SalesV20Companies.js +26 -0
  137. package/lib/behind-api-client/sales/SalesV20Notes.js +17 -0
  138. package/lib/behind-api-client/sip/SipApp.js +9 -0
  139. package/lib/behind-api-client/sip/SipV10.js +15 -0
  140. package/lib/behind-api-client/sip/SipV10Call.js +83 -0
  141. package/lib/behind-api-client/sip/SipV10Phone.js +44 -0
  142. package/lib/behind-api-client/sip/SipV10Transcript.js +21 -0
  143. package/lib/behind-api-client/sip/SipV10Transcripts.js +21 -0
  144. package/lib/behind-api-client/storage/StorageApp.js +9 -0
  145. package/lib/behind-api-client/storage/StorageV10.js +11 -0
  146. package/lib/behind-api-client/storage/StorageV10File.js +35 -0
  147. package/lib/behind-api-client/storage/StorageV10Upload.js +21 -0
  148. package/lib/behind-api-client/tests/TestsApp.js +9 -0
  149. package/lib/behind-api-client/tests/TestsV10.js +15 -0
  150. package/lib/behind-api-client/tests/TestsV10Cases.js +29 -0
  151. package/lib/behind-api-client/tests/TestsV10CasesExtended.js +14 -0
  152. package/lib/behind-api-client/tests/TestsV10Core.js +14 -0
  153. package/lib/behind-api-client/tests/TestsV10Mail.js +14 -0
  154. package/lib/behind-api-client/tools/ToolsApp.js +9 -0
  155. package/lib/behind-api-client/tools/ToolsV10.js +9 -0
  156. package/lib/behind-api-client/tools/ToolsV10Pdf.js +30 -0
  157. package/package.json +25 -0
@@ -0,0 +1,254 @@
1
+ # Stripe Subscription Flow
2
+
3
+ ## Workflow Overview
4
+
5
+ This document outlines the complete subscription process for integrating Stripe payments with BehindAPI.
6
+
7
+ ### Process Steps
8
+
9
+ 1. **Extract Subscription ID**
10
+ - Receive `subscription_id` from URL GET parameter
11
+
12
+ 2. **Check Existing Payment Methods**
13
+ - Query BehindAPI to check if user has saved Stripe cards
14
+
15
+ 3. **Direct Subscription (Existing Card)**
16
+ - If saved card exists, proceed directly to subscription creation using `subscription_id`
17
+
18
+ 4. **New Card Authorization Flow**
19
+ - If no saved card exists, initiate card authorization process:
20
+
21
+ 4.1 **Initialize Authorization**
22
+ - Call BehindAPI to initialize card authorization
23
+ - Obtain `client_secret` for Stripe integration
24
+
25
+ 4.2 **Stripe Card Setup**
26
+ - Use Stripe SDK to authorize card with `client_secret`
27
+ - Receive customer card token from Stripe
28
+
29
+ 4.3 **Finalize Authorization**
30
+ - Send customer card token to BehindAPI endpoint
31
+ - Save payment method for future use
32
+
33
+ 4.4 **Create Subscription**
34
+ - Subscribe user using `subscription_id`
35
+
36
+
37
+ ````html
38
+
39
+ <script src="https://js.stripe.com/v3/"></script>
40
+
41
+ <form style="width:100%;display:none" method="post" id="stripe-payment-form">
42
+ <div class="form-row">
43
+ <label for="card-element" style="display:none">
44
+ We accept credit or debit cards. After you fill all necessary fileds,
45
+ <span id="stripe-payment-form-amount"></span> will be debited from your card. The rest of founds
46
+ <span id="stripe-payment-form-amount-rest"></span> will be taken from your Zecamp wallet.
47
+ </label>
48
+ <div id="stripe-payment-form-card-element">
49
+ <!-- A Stripe Element will be inserted here. -->
50
+ </div>
51
+
52
+ <div id="payment-method-selection">
53
+
54
+ </div>
55
+
56
+ <!-- Used to display form errors. -->
57
+ <div id="card-errors" role="alert"></div>
58
+ </div>
59
+ </form>
60
+
61
+ ````
62
+
63
+ ````js
64
+
65
+ /**
66
+ * Stripe Payment Integration
67
+ * Handles subscription payments with saved card support
68
+ */
69
+ $(document).ready(function() {
70
+ (async () => {
71
+ // Initialize API clients
72
+ console.log("Initializing Stripe Payment System...");
73
+ const BehindAPI = new BehindApiClient(
74
+ "https://127.0.0.1:6002",
75
+ "ACCESS_TOKEN HERE"
76
+ );
77
+ const stripe = Stripe("pk_test_OE8u9FAKvK0W8vYr5mMCj92G");
78
+
79
+ // Step 1: Check for existing saved cards
80
+ const savedCards = await BehindAPI.payments.V21.cards.getList();
81
+ const savedStripeCards = savedCards.data.filter(card => card.payment_method === "stripe");
82
+ console.log("Found saved Stripe cards:", savedStripeCards.length);
83
+
84
+ // Step 2: Initialize payment form based on saved cards
85
+ if (savedStripeCards.length === 0) {
86
+ initializeNewCardForm();
87
+ } else {
88
+ displaySavedCardInfo();
89
+ }
90
+
91
+ /**
92
+ * Initialize form for new card entry
93
+ */
94
+ function initializeNewCardForm() {
95
+ console.log("Setting up new card form...");
96
+
97
+ // Create Stripe Elements instance
98
+ const elements = stripe.elements();
99
+
100
+ // Define card input styling
101
+ const cardElementStyle = {
102
+ base: {
103
+ color: '#32325d',
104
+ lineHeight: '18px',
105
+ fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
106
+ fontSmoothing: 'antialiased',
107
+ fontSize: '16px',
108
+ '::placeholder': {
109
+ color: '#aab7c4'
110
+ }
111
+ },
112
+ invalid: {
113
+ color: '#fa755a',
114
+ iconColor: '#fa755a'
115
+ }
116
+ };
117
+
118
+ // Create and mount card element
119
+ const card = elements.create('card', { style: cardElementStyle });
120
+ card.mount('#stripe-payment-form-card-element');
121
+
122
+ // Handle real-time validation errors
123
+ card.addEventListener('change', function(event) {
124
+ const displayError = document.getElementById('card-errors');
125
+ displayError.textContent = event.error ? event.error.message : '';
126
+ });
127
+
128
+ // Store card element for use in payment processing
129
+ window.stripeCardElement = card;
130
+ }
131
+
132
+ /**
133
+ * Display saved card information
134
+ */
135
+ function displaySavedCardInfo() {
136
+ console.log("Displaying saved card info...");
137
+
138
+ const firstCard = savedStripeCards[0];
139
+ const cardElement = document.getElementById('stripe-payment-form-card-element');
140
+
141
+ // Generate card display HTML
142
+ cardElement.innerHTML = `
143
+ <div class="saved-card-info">
144
+ <div class="card-display">
145
+ <div class="card-icon">${getCardIcon(firstCard.binding_type)}</div>
146
+ <div class="card-details">
147
+
148
+ <div class="card-number">•••• •••• •••• ${firstCard.binding_name}</div>
149
+ </div>
150
+
151
+ </div>
152
+ </div>
153
+ `;
154
+ }
155
+
156
+ /**
157
+ * Get appropriate icon for card type
158
+ */
159
+ function getCardIcon(cardType) {
160
+ const icons = {
161
+ 'visa': '💳',
162
+ 'mastercard': '💳',
163
+ 'amex': '💳',
164
+ 'discover': '💳',
165
+ 'default': '💳'
166
+ };
167
+ return icons[cardType.toLowerCase()] || icons.default;
168
+ }
169
+
170
+ // Step 3: Handle payment form submission
171
+ $("#stripe-payment-submit").on("click", async function(event) {
172
+ event.preventDefault();
173
+ console.log("Processing payment...");
174
+
175
+ try {
176
+ if (savedStripeCards.length === 0) {
177
+ await processNewCardPayment();
178
+ } else {
179
+ await processSubscriptionWithSavedCard();
180
+ }
181
+ } catch (error) {
182
+ console.error("Payment processing error:", error);
183
+ alert("Payment failed. Please try again.");
184
+ }
185
+ });
186
+
187
+ /**
188
+ * Process payment with new card
189
+ */
190
+ async function processNewCardPayment() {
191
+ console.log("Processing new card payment...");
192
+
193
+ // Step 1: Initialize payment intent on server
194
+ const paymentIntent = await BehindAPI.payments.V21.stripe.init();
195
+ console.log("Payment intent created:", paymentIntent);
196
+
197
+ const clientSecret = paymentIntent.data.client_secret;
198
+ const cardholderName = "CARDHOLDER NAME"; // TODO: Get from form input
199
+
200
+ try {
201
+ // Step 2: Set up payment method with Stripe
202
+ const cardToken = await stripe.handleCardSetup(
203
+ clientSecret,
204
+ window.stripeCardElement,
205
+ {
206
+ payment_method_data: {
207
+ billing_details: { name: cardholderName }
208
+ }
209
+ }
210
+ );
211
+
212
+ // Step 3: Finalize card setup on server
213
+ const bindResult = await BehindAPI.payments.V21.stripe.finalise(
214
+ cardToken.setupIntent.payment_method
215
+ );
216
+ console.log("Card setup finalized:", bindResult);
217
+
218
+ // Step 4: Create subscription
219
+ await createSubscription();
220
+
221
+ } catch (cardError) {
222
+ console.error("Card setup error:", cardError);
223
+ throw new Error("Card setup failed");
224
+ }
225
+ }
226
+
227
+ /**
228
+ * Process subscription with existing saved card
229
+ */
230
+ async function processSubscriptionWithSavedCard() {
231
+ console.log("Using saved card for subscription...");
232
+ await createSubscription();
233
+ }
234
+
235
+ /**
236
+ * Create subscription using the configured payment method
237
+ */
238
+ async function createSubscription() {
239
+ console.log("Creating subscription...");
240
+
241
+ // TODO: Get subscription_id from URL parameter
242
+ const subscriptionId = "subscription_id_here";
243
+
244
+ const subscriptionResult = await BehindAPI.payments.V21.subscriptions.subscribe(subscriptionId);
245
+ console.log("Subscription created successfully:", subscriptionResult);
246
+
247
+ // Show success message to user
248
+ alert("Subscription activated successfully!");
249
+ }
250
+
251
+ })();
252
+ });
253
+
254
+ ````