paymongo-cli 1.4.4 → 1.4.6

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 (142) hide show
  1. package/.github/copilot-instructions.md +95 -95
  2. package/CHANGELOG.md +27 -0
  3. package/LICENSE +20 -20
  4. package/dist/.tsbuildinfo +1 -1
  5. package/dist/commands/config.js +14 -0
  6. package/dist/commands/dev.js +2 -1
  7. package/dist/commands/generate/templates/checkout-page/index.js +520 -520
  8. package/dist/commands/generate/templates/payment-intent/javascript.js +68 -68
  9. package/dist/commands/generate/templates/payment-intent/typescript.js +92 -92
  10. package/dist/commands/generate/templates/webhook-handler/javascript.js +192 -147
  11. package/dist/commands/generate/templates/webhook-handler/typescript.js +147 -117
  12. package/dist/commands/generate.js +43 -37
  13. package/dist/commands/init.js +22 -5
  14. package/dist/commands/login.js +53 -16
  15. package/dist/commands/team/index.js +4 -3
  16. package/dist/commands/trigger.js +40 -2
  17. package/dist/commands/webhooks.js +1 -1
  18. package/dist/services/analytics/service.js +5 -1
  19. package/dist/services/api/client.js +1 -1
  20. package/dist/services/config/manager.js +6 -8
  21. package/dist/services/team/service.js +4 -1
  22. package/dist/types/schemas.js +38 -9
  23. package/eslint.config.ts +70 -70
  24. package/package.json +2 -2
  25. package/coverage/base.css +0 -224
  26. package/coverage/block-navigation.js +0 -87
  27. package/coverage/favicon.png +0 -0
  28. package/coverage/index.html +0 -281
  29. package/coverage/lcov-report/base.css +0 -224
  30. package/coverage/lcov-report/block-navigation.js +0 -87
  31. package/coverage/lcov-report/favicon.png +0 -0
  32. package/coverage/lcov-report/index.html +0 -281
  33. package/coverage/lcov-report/prettify.css +0 -1
  34. package/coverage/lcov-report/prettify.js +0 -2
  35. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  36. package/coverage/lcov-report/sorter.js +0 -210
  37. package/coverage/lcov.info +0 -5053
  38. package/coverage/prettify.css +0 -1
  39. package/coverage/prettify.js +0 -2
  40. package/coverage/sort-arrow-sprite.png +0 -0
  41. package/coverage/sorter.js +0 -210
  42. package/dist/commands/config.d.ts +0 -21
  43. package/dist/commands/config.d.ts.map +0 -1
  44. package/dist/commands/config.js.map +0 -1
  45. package/dist/commands/dev.d.ts +0 -16
  46. package/dist/commands/dev.d.ts.map +0 -1
  47. package/dist/commands/dev.js.map +0 -1
  48. package/dist/commands/env.d.ts +0 -4
  49. package/dist/commands/env.d.ts.map +0 -1
  50. package/dist/commands/env.js.map +0 -1
  51. package/dist/commands/init.d.ts +0 -15
  52. package/dist/commands/init.d.ts.map +0 -1
  53. package/dist/commands/init.js.map +0 -1
  54. package/dist/commands/login.d.ts +0 -20
  55. package/dist/commands/login.d.ts.map +0 -1
  56. package/dist/commands/login.js.map +0 -1
  57. package/dist/commands/payments.d.ts +0 -41
  58. package/dist/commands/payments.d.ts.map +0 -1
  59. package/dist/commands/payments.js.map +0 -1
  60. package/dist/commands/team/index.d.ts +0 -4
  61. package/dist/commands/team/index.d.ts.map +0 -1
  62. package/dist/commands/team/index.js.map +0 -1
  63. package/dist/commands/trigger.d.ts +0 -4
  64. package/dist/commands/trigger.d.ts.map +0 -1
  65. package/dist/commands/trigger.js.map +0 -1
  66. package/dist/commands/webhooks.d.ts +0 -23
  67. package/dist/commands/webhooks.d.ts.map +0 -1
  68. package/dist/commands/webhooks.js.map +0 -1
  69. package/dist/index.d.ts +0 -3
  70. package/dist/index.d.ts.map +0 -1
  71. package/dist/index.js.map +0 -1
  72. package/dist/services/analytics/service.d.ts +0 -35
  73. package/dist/services/analytics/service.d.ts.map +0 -1
  74. package/dist/services/analytics/service.js.map +0 -1
  75. package/dist/services/api/client.d.ts +0 -26
  76. package/dist/services/api/client.d.ts.map +0 -1
  77. package/dist/services/api/client.js.map +0 -1
  78. package/dist/services/api/rate-limiter.d.ts +0 -64
  79. package/dist/services/api/rate-limiter.d.ts.map +0 -1
  80. package/dist/services/api/rate-limiter.js.map +0 -1
  81. package/dist/services/api/undici-client.d.ts +0 -39
  82. package/dist/services/api/undici-client.d.ts.map +0 -1
  83. package/dist/services/api/undici-client.js +0 -288
  84. package/dist/services/api/undici-client.js.map +0 -1
  85. package/dist/services/config/manager.d.ts +0 -16
  86. package/dist/services/config/manager.d.ts.map +0 -1
  87. package/dist/services/config/manager.js.map +0 -1
  88. package/dist/services/dev/process-manager.d.ts +0 -50
  89. package/dist/services/dev/process-manager.d.ts.map +0 -1
  90. package/dist/services/dev/process-manager.js.map +0 -1
  91. package/dist/services/github/auth.d.ts +0 -15
  92. package/dist/services/github/auth.d.ts.map +0 -1
  93. package/dist/services/github/auth.js +0 -79
  94. package/dist/services/github/auth.js.map +0 -1
  95. package/dist/services/github/client.d.ts +0 -95
  96. package/dist/services/github/client.d.ts.map +0 -1
  97. package/dist/services/github/client.js +0 -130
  98. package/dist/services/github/client.js.map +0 -1
  99. package/dist/services/github/sync.d.ts +0 -26
  100. package/dist/services/github/sync.d.ts.map +0 -1
  101. package/dist/services/github/sync.js +0 -203
  102. package/dist/services/github/sync.js.map +0 -1
  103. package/dist/services/payments/simulator.d.ts +0 -28
  104. package/dist/services/payments/simulator.d.ts.map +0 -1
  105. package/dist/services/payments/simulator.js.map +0 -1
  106. package/dist/services/team/service.d.ts +0 -44
  107. package/dist/services/team/service.d.ts.map +0 -1
  108. package/dist/services/team/service.js.map +0 -1
  109. package/dist/services/web/server.d.ts +0 -31
  110. package/dist/services/web/server.d.ts.map +0 -1
  111. package/dist/services/web/server.js +0 -206
  112. package/dist/services/web/server.js.map +0 -1
  113. package/dist/types/paymongo.d.ts +0 -204
  114. package/dist/types/paymongo.d.ts.map +0 -1
  115. package/dist/types/paymongo.js.map +0 -1
  116. package/dist/types/schemas.d.ts +0 -80
  117. package/dist/types/schemas.d.ts.map +0 -1
  118. package/dist/types/schemas.js.map +0 -1
  119. package/dist/utils/bulk.d.ts +0 -62
  120. package/dist/utils/bulk.d.ts.map +0 -1
  121. package/dist/utils/bulk.js.map +0 -1
  122. package/dist/utils/cache.d.ts +0 -22
  123. package/dist/utils/cache.d.ts.map +0 -1
  124. package/dist/utils/cache.js.map +0 -1
  125. package/dist/utils/constants.d.ts +0 -32
  126. package/dist/utils/constants.d.ts.map +0 -1
  127. package/dist/utils/constants.js.map +0 -1
  128. package/dist/utils/errors.d.ts +0 -34
  129. package/dist/utils/errors.d.ts.map +0 -1
  130. package/dist/utils/errors.js.map +0 -1
  131. package/dist/utils/logger.d.ts +0 -20
  132. package/dist/utils/logger.d.ts.map +0 -1
  133. package/dist/utils/logger.js.map +0 -1
  134. package/dist/utils/spinner.d.ts +0 -17
  135. package/dist/utils/spinner.d.ts.map +0 -1
  136. package/dist/utils/spinner.js.map +0 -1
  137. package/dist/utils/validator.d.ts +0 -10
  138. package/dist/utils/validator.d.ts.map +0 -1
  139. package/dist/utils/validator.js.map +0 -1
  140. package/dist/utils/webhook-store.d.ts +0 -22
  141. package/dist/utils/webhook-store.d.ts.map +0 -1
  142. package/dist/utils/webhook-store.js.map +0 -1
@@ -1,71 +1,71 @@
1
1
  export function getPaymentIntentTemplate(methods) {
2
- return `const axios = require('axios');
3
-
4
- // PayMongo API credentials
5
- const PAYMONGO_SECRET_KEY = process.env.PAYMONGO_SECRET_KEY;
6
- const PAYMONGO_PUBLIC_KEY = process.env.PAYMONGO_PUBLIC_KEY;
7
-
8
- async function createPaymentIntent(amount, currency = 'PHP', description = '') {
9
- try {
10
- const response = await axios.post(
11
- 'https://api.paymongo.com/v1/payment_intents',
12
- {
13
- data: {
14
- attributes: {
15
- amount: amount, // Amount in centavos (e.g., 10000 = ₱100.00)
16
- currency: currency,
17
- description: description,
18
- payment_method_allowed: ${JSON.stringify(methods)},
19
- }
20
- }
21
- },
22
- {
23
- headers: {
24
- 'Authorization': \`Basic \${Buffer.from(PAYMONGO_SECRET_KEY + ':').toString('base64')}\`,
25
- 'Content-Type': 'application/json',
26
- }
27
- }
28
- );
29
-
30
- const paymentIntent = response.data.data;
31
-
32
- console.log('Payment Intent created:', paymentIntent.id);
33
- console.log('Client Key:', paymentIntent.attributes.client_key);
34
- console.log('Amount:', (paymentIntent.attributes.amount / 100).toFixed(2), paymentIntent.attributes.currency);
35
-
36
- return {
37
- id: paymentIntent.id,
38
- clientKey: paymentIntent.attributes.client_key,
39
- amount: paymentIntent.attributes.amount,
40
- currency: paymentIntent.attributes.currency,
41
- status: paymentIntent.attributes.status
42
- };
43
-
44
- } catch (error) {
45
- console.error('Error creating payment intent:', error.response?.data || error.message);
46
- throw error;
47
- }
48
- }
49
-
50
- // Example usage
51
- async function example() {
52
- try {
53
- const paymentIntent = await createPaymentIntent(
54
- 10000, // ₱100.00
55
- 'PHP',
56
- 'Sample payment'
57
- );
58
-
59
- console.log('Use this client key in your frontend:', paymentIntent.clientKey);
60
-
61
- } catch (error) {
62
- console.error('Failed to create payment intent');
63
- }
64
- }
65
-
66
- module.exports = { createPaymentIntent };
67
-
68
- if (require.main === module) {
69
- example();
2
+ return `const axios = require('axios');
3
+
4
+ // PayMongo API credentials
5
+ const PAYMONGO_SECRET_KEY = process.env.PAYMONGO_SECRET_KEY;
6
+ const PAYMONGO_PUBLIC_KEY = process.env.PAYMONGO_PUBLIC_KEY;
7
+
8
+ async function createPaymentIntent(amount, currency = 'PHP', description = '') {
9
+ try {
10
+ const response = await axios.post(
11
+ 'https://api.paymongo.com/v1/payment_intents',
12
+ {
13
+ data: {
14
+ attributes: {
15
+ amount: amount, // Amount in centavos (e.g., 10000 = ₱100.00)
16
+ currency: currency,
17
+ description: description,
18
+ payment_method_allowed: ${JSON.stringify(methods)},
19
+ }
20
+ }
21
+ },
22
+ {
23
+ headers: {
24
+ 'Authorization': \`Basic \${Buffer.from(PAYMONGO_SECRET_KEY + ':').toString('base64')}\`,
25
+ 'Content-Type': 'application/json',
26
+ }
27
+ }
28
+ );
29
+
30
+ const paymentIntent = response.data.data;
31
+
32
+ console.log('Payment Intent created:', paymentIntent.id);
33
+ console.log('Client Key:', paymentIntent.attributes.client_key);
34
+ console.log('Amount:', (paymentIntent.attributes.amount / 100).toFixed(2), paymentIntent.attributes.currency);
35
+
36
+ return {
37
+ id: paymentIntent.id,
38
+ clientKey: paymentIntent.attributes.client_key,
39
+ amount: paymentIntent.attributes.amount,
40
+ currency: paymentIntent.attributes.currency,
41
+ status: paymentIntent.attributes.status
42
+ };
43
+
44
+ } catch (error) {
45
+ console.error('Error creating payment intent:', error.response?.data || error.message);
46
+ throw error;
47
+ }
48
+ }
49
+
50
+ // Example usage
51
+ async function example() {
52
+ try {
53
+ const paymentIntent = await createPaymentIntent(
54
+ 10000, // ₱100.00
55
+ 'PHP',
56
+ 'Sample payment'
57
+ );
58
+
59
+ console.log('Use this client key in your frontend:', paymentIntent.clientKey);
60
+
61
+ } catch (error) {
62
+ console.error('Failed to create payment intent');
63
+ }
64
+ }
65
+
66
+ module.exports = { createPaymentIntent };
67
+
68
+ if (require.main === module) {
69
+ example();
70
70
  }`;
71
71
  }
@@ -1,95 +1,95 @@
1
1
  export function getPaymentIntentTemplate(methods) {
2
- return `import axios from 'axios';
3
-
4
- interface PaymentIntent {
5
- id: string;
6
- clientKey: string;
7
- amount: number;
8
- currency: string;
9
- status: string;
10
- }
11
-
12
- interface PayMongoPaymentIntentResponse {
13
- data: {
14
- id: string;
15
- attributes: {
16
- amount: number;
17
- currency: string;
18
- description: string;
19
- status: string;
20
- client_key: string;
21
- payment_method_allowed: string[];
22
- };
23
- };
24
- }
25
-
26
- // PayMongo API credentials
27
- const PAYMONGO_SECRET_KEY = process.env.PAYMONGO_SECRET_KEY!;
28
- const PAYMONGO_PUBLIC_KEY = process.env.PAYMONGO_PUBLIC_KEY!;
29
-
30
- export async function createPaymentIntent(
31
- amount: number,
32
- currency: string = 'PHP',
33
- description: string = ''
34
- ): Promise<PaymentIntent> {
35
- try {
36
- const response = await axios.post<PayMongoPaymentIntentResponse>(
37
- 'https://api.paymongo.com/v1/payment_intents',
38
- {
39
- data: {
40
- attributes: {
41
- amount: amount, // Amount in centavos (e.g., 10000 = ₱100.00)
42
- currency: currency,
43
- description: description,
44
- payment_method_allowed: ${JSON.stringify(methods)},
45
- }
46
- }
47
- },
48
- {
49
- headers: {
50
- 'Authorization': \`Basic \${Buffer.from(PAYMONGO_SECRET_KEY + ':').toString('base64')}\`,
51
- 'Content-Type': 'application/json',
52
- }
53
- }
54
- );
55
-
56
- const paymentIntent = response.data.data;
57
-
58
- console.log('Payment Intent created:', paymentIntent.id);
59
- console.log('Client Key:', paymentIntent.attributes.client_key);
60
- console.log('Amount:', (paymentIntent.attributes.amount / 100).toFixed(2), paymentIntent.attributes.currency);
61
-
62
- return {
63
- id: paymentIntent.id,
64
- clientKey: paymentIntent.attributes.client_key,
65
- amount: paymentIntent.attributes.amount,
66
- currency: paymentIntent.attributes.currency,
67
- status: paymentIntent.attributes.status
68
- };
69
-
70
- } catch (error: any) {
71
- console.error('Error creating payment intent:', error.response?.data || error.message);
72
- throw error;
73
- }
74
- }
75
-
76
- // Example usage
77
- async function example(): Promise<void> {
78
- try {
79
- const paymentIntent = await createPaymentIntent(
80
- 10000, // ₱100.00
81
- 'PHP',
82
- 'Sample payment'
83
- );
84
-
85
- console.log('Use this client key in your frontend:', paymentIntent.clientKey);
86
-
87
- } catch (error) {
88
- console.error('Failed to create payment intent');
89
- }
90
- }
91
-
92
- if (require.main === module) {
93
- example();
2
+ return `import axios from 'axios';
3
+
4
+ interface PaymentIntent {
5
+ id: string;
6
+ clientKey: string;
7
+ amount: number;
8
+ currency: string;
9
+ status: string;
10
+ }
11
+
12
+ interface PayMongoPaymentIntentResponse {
13
+ data: {
14
+ id: string;
15
+ attributes: {
16
+ amount: number;
17
+ currency: string;
18
+ description: string;
19
+ status: string;
20
+ client_key: string;
21
+ payment_method_allowed: string[];
22
+ };
23
+ };
24
+ }
25
+
26
+ // PayMongo API credentials
27
+ const PAYMONGO_SECRET_KEY = process.env.PAYMONGO_SECRET_KEY!;
28
+ const PAYMONGO_PUBLIC_KEY = process.env.PAYMONGO_PUBLIC_KEY!;
29
+
30
+ export async function createPaymentIntent(
31
+ amount: number,
32
+ currency: string = 'PHP',
33
+ description: string = ''
34
+ ): Promise<PaymentIntent> {
35
+ try {
36
+ const response = await axios.post<PayMongoPaymentIntentResponse>(
37
+ 'https://api.paymongo.com/v1/payment_intents',
38
+ {
39
+ data: {
40
+ attributes: {
41
+ amount: amount, // Amount in centavos (e.g., 10000 = ₱100.00)
42
+ currency: currency,
43
+ description: description,
44
+ payment_method_allowed: ${JSON.stringify(methods)},
45
+ }
46
+ }
47
+ },
48
+ {
49
+ headers: {
50
+ 'Authorization': \`Basic \${Buffer.from(PAYMONGO_SECRET_KEY + ':').toString('base64')}\`,
51
+ 'Content-Type': 'application/json',
52
+ }
53
+ }
54
+ );
55
+
56
+ const paymentIntent = response.data.data;
57
+
58
+ console.log('Payment Intent created:', paymentIntent.id);
59
+ console.log('Client Key:', paymentIntent.attributes.client_key);
60
+ console.log('Amount:', (paymentIntent.attributes.amount / 100).toFixed(2), paymentIntent.attributes.currency);
61
+
62
+ return {
63
+ id: paymentIntent.id,
64
+ clientKey: paymentIntent.attributes.client_key,
65
+ amount: paymentIntent.attributes.amount,
66
+ currency: paymentIntent.attributes.currency,
67
+ status: paymentIntent.attributes.status
68
+ };
69
+
70
+ } catch (error: any) {
71
+ console.error('Error creating payment intent:', error.response?.data || error.message);
72
+ throw error;
73
+ }
74
+ }
75
+
76
+ // Example usage
77
+ async function example(): Promise<void> {
78
+ try {
79
+ const paymentIntent = await createPaymentIntent(
80
+ 10000, // ₱100.00
81
+ 'PHP',
82
+ 'Sample payment'
83
+ );
84
+
85
+ console.log('Use this client key in your frontend:', paymentIntent.clientKey);
86
+
87
+ } catch (error) {
88
+ console.error('Failed to create payment intent');
89
+ }
90
+ }
91
+
92
+ if (require.main === module) {
93
+ example();
94
94
  }`;
95
95
  }