@chevre/domain 25.2.0-alpha.3 → 25.2.0-alpha.31

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 (89) hide show
  1. package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
  2. package/lib/chevre/factory/customerTelephone2COATelNum.js +23 -0
  3. package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
  4. package/lib/chevre/repo/action/acceptPay.js +47 -19
  5. package/lib/chevre/repo/action/actionProcess.js +57 -57
  6. package/lib/chevre/repo/action.d.ts +16 -9
  7. package/lib/chevre/repo/action.js +99 -180
  8. package/lib/chevre/repo/message.d.ts +1 -1
  9. package/lib/chevre/repo/message.js +1 -1
  10. package/lib/chevre/repo/mongoose/schemas/action.js +67 -66
  11. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
  12. package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
  13. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
  14. package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
  15. package/lib/chevre/repo/order.d.ts +735 -0
  16. package/lib/chevre/repo/order.js +13 -20
  17. package/lib/chevre/repo/orderInTransaction.d.ts +45 -0
  18. package/lib/chevre/repo/orderInTransaction.js +175 -0
  19. package/lib/chevre/repo/person.d.ts +0 -15
  20. package/lib/chevre/repo/person.js +122 -108
  21. package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
  22. package/lib/chevre/repo/transaction/placeOrder.js +43 -83
  23. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
  24. package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
  25. package/lib/chevre/service/offer/event/authorize/factory.d.ts +5 -5
  26. package/lib/chevre/service/offer/event/authorize/factory.js +30 -20
  27. package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
  28. package/lib/chevre/service/offer/event/authorize.js +3 -3
  29. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
  30. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
  31. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
  32. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +17 -14
  33. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
  34. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
  35. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
  36. package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
  37. package/lib/chevre/service/order/deleteOrder.js +8 -1
  38. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
  39. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -0
  40. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
  41. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
  42. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +95 -33
  43. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -0
  44. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -6
  45. package/lib/chevre/service/order/payOrder.d.ts +2 -0
  46. package/lib/chevre/service/order/placeOrder.d.ts +2 -0
  47. package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
  48. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
  49. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
  50. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
  51. package/lib/chevre/service/payment/any/authorize.js +13 -37
  52. package/lib/chevre/service/payment/any/factory.d.ts +6 -6
  53. package/lib/chevre/service/payment/any/factory.js +19 -22
  54. package/lib/chevre/service/payment/any/findAcceptAction.d.ts +3 -1
  55. package/lib/chevre/service/payment/any/findAcceptAction.js +14 -6
  56. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
  57. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +4 -66
  58. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
  59. package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
  60. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
  61. package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
  62. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  63. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
  64. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +17 -8
  65. package/lib/chevre/service/reserve/searchByOrder.js +2 -6
  66. package/lib/chevre/service/task/confirmReserveTransaction.js +2 -7
  67. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +2 -2
  68. package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -0
  69. package/lib/chevre/service/task/placeOrder.js +2 -2
  70. package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
  71. package/lib/chevre/service/task/voidPayTransaction.js +3 -7
  72. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
  73. package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
  74. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
  75. package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
  76. package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
  77. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +0 -1
  78. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +7 -2
  79. package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +16 -12
  80. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
  81. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +11 -2
  82. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +112 -91
  83. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +4 -0
  84. package/lib/chevre/service/transaction/placeOrder/confirm.js +31 -74
  85. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
  86. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
  87. package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +2 -0
  88. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +19 -9
  89. package/package.json +5 -4
@@ -2,17 +2,28 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateAgent = updateAgent;
4
4
  const google_libphonenumber_1 = require("google-libphonenumber");
5
+ const libphonenumber_js_1 = require("libphonenumber-js");
5
6
  const factory_1 = require("../../../factory");
6
- function fixCustomer(params) {
7
+ function fixCustomer(params, options) {
7
8
  return async (repos) => {
9
+ const { useLibphonenumber } = options;
8
10
  let formattedTelephone;
9
11
  try {
10
- const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
11
- const phoneNumber = phoneUtil.parse(params.agent.telephone, params.agent.telephoneRegion);
12
- if (!phoneUtil.isValidNumber(phoneNumber)) {
13
- throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
12
+ if (useLibphonenumber) {
13
+ const phoneNumber = (0, libphonenumber_js_1.parsePhoneNumberFromString)(String(params.agent.telephone), params.agent.telephoneRegion);
14
+ if (phoneNumber === undefined || !phoneNumber.isValid()) {
15
+ throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
16
+ }
17
+ formattedTelephone = phoneNumber.format('E.164');
18
+ }
19
+ else {
20
+ const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
21
+ const phoneNumber = phoneUtil.parse(params.agent.telephone, params.agent.telephoneRegion);
22
+ if (!phoneUtil.isValidNumber(phoneNumber)) {
23
+ throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
24
+ }
25
+ formattedTelephone = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.E164);
14
26
  }
15
- formattedTelephone = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.E164);
16
27
  }
17
28
  catch (error) {
18
29
  throw new factory_1.factory.errors.Argument('telephone', (error instanceof Error) ? error.message : String(error));
@@ -68,9 +79,9 @@ function fixCustomer(params) {
68
79
  /**
69
80
  * 取引人プロフィール更新
70
81
  */
71
- function updateAgent(params) {
82
+ function updateAgent(params, options) {
72
83
  return async (repos) => {
73
- const { customer, transaction } = await fixCustomer(params)(repos);
84
+ const { customer, transaction } = await fixCustomer(params, options)(repos);
74
85
  // also save in orderInTransaction(2024-06-20~)
75
86
  if (customer !== undefined) {
76
87
  // // 注文ドキュメントを参照(2026-06-24~)
@@ -95,6 +106,5 @@ function updateAgent(params) {
95
106
  customer: customerInOrder
96
107
  });
97
108
  }
98
- // return newAgent;
99
109
  };
100
110
  }
package/package.json CHANGED
@@ -11,15 +11,16 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "9.5.0-alpha.2",
14
+ "@chevre/factory": "9.5.0-alpha.11",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
18
18
  "@surfrock/sdk": "2.0.0",
19
19
  "debug": "4.4.3",
20
- "google-libphonenumber": "^3.2.18",
20
+ "google-libphonenumber": "3.2.35",
21
21
  "http-status": "2.1.0",
22
22
  "jsonwebtoken": "9.0.0",
23
+ "libphonenumber-js": "1.13.8",
23
24
  "lodash.difference": "^4.5.0",
24
25
  "moment": "^2.29.1",
25
26
  "moment-timezone": "^0.5.33",
@@ -34,7 +35,7 @@
34
35
  "@sendgrid/helpers": "8.0.0",
35
36
  "@size-limit/preset-big-lib": "12.0.0",
36
37
  "@types/debug": "4.1.13",
37
- "@types/google-libphonenumber": "^7.4.19",
38
+ "@types/google-libphonenumber": "7.4.30",
38
39
  "@types/jsonwebtoken": "9.0.1",
39
40
  "@types/lodash.difference": "^4.5.6",
40
41
  "@types/node": "22.19.7",
@@ -91,5 +92,5 @@
91
92
  "postversion": "git push origin --tags",
92
93
  "prepublishOnly": "npm run clean && npm run build"
93
94
  },
94
- "version": "25.2.0-alpha.3"
95
+ "version": "25.2.0-alpha.31"
95
96
  }