@ripwords/myinvois-client 0.2.27 → 0.2.29

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 (65) hide show
  1. package/dist/api/documentManagement.js +1 -1
  2. package/dist/api/documentSubmission.js +2 -2
  3. package/dist/{document-nWFcUMsi.js → document-DI6hw1MO.js} +1 -1
  4. package/dist/{document-CNM7-o5x.cjs → document-DWsGewNs.cjs} +2 -2
  5. package/dist/document-DWsGewNs.cjs.map +1 -0
  6. package/dist/{documentManagement-CIQPkmyb.js → documentManagement-CeNbp3qm.js} +13 -3
  7. package/dist/{documentManagement-DQ7JEcBq.cjs → documentManagement-CyPwiyP4.cjs} +14 -4
  8. package/dist/documentManagement-CyPwiyP4.cjs.map +1 -0
  9. package/dist/{documentSubmission-BE1En5JO.cjs → documentSubmission-D96QqHJ-.cjs} +2 -2
  10. package/dist/{documentSubmission-BE1En5JO.cjs.map → documentSubmission-D96QqHJ-.cjs.map} +1 -1
  11. package/dist/{documentSubmission-CVwFwnDd.js → documentSubmission-Dr4R4sKD.js} +1 -1
  12. package/dist/index.cjs +35 -3
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.ts +26 -0
  15. package/dist/index.js +35 -3
  16. package/dist/index10.cjs +53 -16
  17. package/dist/index10.cjs.map +1 -1
  18. package/dist/index11.cjs +532 -0
  19. package/dist/index11.cjs.map +1 -0
  20. package/dist/index12.cjs +187 -25
  21. package/dist/index12.cjs.map +1 -1
  22. package/dist/index13.cjs +0 -24
  23. package/dist/index14.cjs +25 -0
  24. package/dist/index14.cjs.map +1 -0
  25. package/dist/index17.cjs +28 -4
  26. package/dist/index17.cjs.map +1 -0
  27. package/dist/index18.cjs +24 -6
  28. package/dist/index18.cjs.map +1 -0
  29. package/dist/index19.cjs +0 -5
  30. package/dist/index2.cjs +3 -61
  31. package/dist/index20.cjs +33 -2
  32. package/dist/index20.cjs.map +1 -0
  33. package/dist/index21.cjs +23 -2
  34. package/dist/{index13.cjs.map → index21.cjs.map} +1 -1
  35. package/dist/index22.cjs +0 -6
  36. package/dist/index23.cjs +0 -4
  37. package/dist/index24.cjs +0 -13
  38. package/dist/index25.cjs +4 -4
  39. package/dist/index26.cjs +5 -20
  40. package/dist/index27.cjs +4 -2
  41. package/dist/index28.cjs +2 -2
  42. package/dist/index29.cjs +2 -329
  43. package/dist/index3.cjs +9 -528
  44. package/dist/index3.cjs.map +1 -1
  45. package/dist/index30.cjs +5 -192
  46. package/dist/index4.cjs +4 -195
  47. package/dist/index5.cjs +22 -0
  48. package/dist/index6.cjs +2 -24
  49. package/dist/index67.cts.map +1 -1
  50. package/dist/index7.cjs +3 -0
  51. package/dist/index8.cjs +330 -0
  52. package/dist/index8.cjs.map +1 -0
  53. package/dist/index9.cjs +189 -25
  54. package/dist/index9.cjs.map +1 -1
  55. package/dist/utils/document.js +1 -1
  56. package/dist/utils/signature-diagnostics.js +1 -1
  57. package/package.json +3 -1
  58. package/dist/document-CNM7-o5x.cjs.map +0 -1
  59. package/dist/documentManagement-DQ7JEcBq.cjs.map +0 -1
  60. package/dist/index2.cjs.map +0 -1
  61. package/dist/index24.cjs.map +0 -1
  62. package/dist/index29.cjs.map +0 -1
  63. package/dist/index30.cjs.map +0 -1
  64. package/dist/index4.cjs.map +0 -1
  65. package/dist/index6.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { getDocument, getDocumentDetails, searchDocuments } from "./documentManagement-CIQPkmyb.js";
1
+ import { getDocument, getDocumentDetails, searchDocuments } from "./documentManagement-CeNbp3qm.js";
2
2
  import "./formatIdValue-qTxJqj9o.js";
3
- import "./document-nWFcUMsi.js";
4
- import { getSubmissionStatus, performDocumentAction, submitDocument } from "./documentSubmission-CVwFwnDd.js";
3
+ import "./document-DI6hw1MO.js";
4
+ import { getSubmissionStatus, performDocumentAction, submitDocument } from "./documentSubmission-Dr4R4sKD.js";
5
5
  import { getDocumentType, getDocumentTypeVersion, getDocumentTypes } from "./documentTypeManagement-cBtVCOY3.js";
6
6
  import { getNotifications } from "./notificationManagement-n4Z5e-My.js";
7
7
  import { platformLogin } from "./platformLogin-CqI9OLYP.js";
@@ -15,6 +15,7 @@ var MyInvoisClient = class MyInvoisClient {
15
15
  baseUrl;
16
16
  clientId;
17
17
  clientSecret;
18
+ environment;
18
19
  onBehalfOf;
19
20
  signingCredentials;
20
21
  debug;
@@ -26,6 +27,7 @@ var MyInvoisClient = class MyInvoisClient {
26
27
  this.clientId = clientId;
27
28
  this.clientSecret = clientSecret;
28
29
  this.baseUrl = getBaseUrl(environment);
30
+ this.environment = environment;
29
31
  this.onBehalfOf = onBehalfOf;
30
32
  this.debug = debug ?? process.env.MYINVOIS_DEBUG === "true" ? true : false;
31
33
  const { issuerName, serialNumber } = extractCertificateInfo(certificatePem);
@@ -479,6 +481,36 @@ var MyInvoisClient = class MyInvoisClient {
479
481
  return getDocumentType({ fetch: this.fetch.bind(this) }, id);
480
482
  }
481
483
  /**
484
+ * Generates a shareable QR code URL for a specific document.
485
+ *
486
+ * This method retrieves the document details using its unique identifier,
487
+ * then constructs a URL that can be used to access or share the document
488
+ * via the MyInvois platform. The URL format differs between sandbox and
489
+ * production environments.
490
+ *
491
+ * @param documentUid - The unique identifier of the document
492
+ * @returns Promise resolving to a string containing the QR code URL
493
+ *
494
+ * @example
495
+ * ```typescript
496
+ * const qrCodeUrl = await client.getDocumentQrCode('abc123');
497
+ * console.log('Shareable QR code URL:', qrCodeUrl);
498
+ * // Output (sandbox): https://preprod.myinvois.hasil.gov.my/abc123/share/longId
499
+ * // Output (production): https://myinvois.hasil.gov.my/abc123/share/longId
500
+ * ```
501
+ *
502
+ * @remarks
503
+ * - The returned URL can be embedded in a QR code for document sharing.
504
+ * - The method fetches the document to obtain its longId, which is required for the URL.
505
+ * - Ensure the documentUid is valid and accessible by the current client.
506
+ */
507
+ async getDocumentQrCode(documentUid) {
508
+ const doc = await getDocument({ fetch: this.fetch.bind(this) }, documentUid);
509
+ console.log(doc);
510
+ const qrCodeBaseLink = `https://${this.environment === "sandbox" ? "preprod." : ""}myinvois.hasil.gov.my/`;
511
+ return qrCodeBaseLink + documentUid + "/share/" + doc.longId;
512
+ }
513
+ /**
482
514
  * Retrieves detailed information about a specific version of a document type.
483
515
  *
484
516
  * This method fetches version-specific metadata, schema definitions, and validation rules
package/dist/index10.cjs CHANGED
@@ -1,25 +1,62 @@
1
1
 
2
- //#region src/types/payment-modes.d.ts
2
+ //#region src/types/classification-codes.d.ts
3
3
  /**
4
- * Enum representing the allowed payment mode codes with descriptive names.
5
- * Provides a more readable way to reference payment modes.
4
+ * Enum representing the allowed classification codes with descriptive names.
5
+ * Provides a more readable way to reference classification codes.
6
6
  *
7
7
  * @example
8
- * const mode = PaymentModeCodeEnum.Cash;
9
- * console.log(mode); // Output: "01"
8
+ * const code = ClassificationCodeEnum.ComputerSmartphoneOrTablet;
9
+ * console.log(code); // Output: "003"
10
10
  */
11
- let PaymentModeCodeEnum = /* @__PURE__ */ function(PaymentModeCodeEnum$1) {
12
- PaymentModeCodeEnum$1["Cash"] = "01";
13
- PaymentModeCodeEnum$1["Cheque"] = "02";
14
- PaymentModeCodeEnum$1["BankTransfer"] = "03";
15
- PaymentModeCodeEnum$1["CreditCard"] = "04";
16
- PaymentModeCodeEnum$1["DebitCard"] = "05";
17
- PaymentModeCodeEnum$1["EWalletDigitalWallet"] = "06";
18
- PaymentModeCodeEnum$1["DigitalBank"] = "07";
19
- PaymentModeCodeEnum$1["Others"] = "08";
20
- return PaymentModeCodeEnum$1;
11
+ let ClassificationCodeEnum = /* @__PURE__ */ function(ClassificationCodeEnum$1) {
12
+ ClassificationCodeEnum$1["BreastfeedingEquipment"] = "001";
13
+ ClassificationCodeEnum$1["ChildCareCentresAndKindergartensFees"] = "002";
14
+ ClassificationCodeEnum$1["ComputerSmartphoneOrTablet"] = "003";
15
+ ClassificationCodeEnum$1["ConsolidatedEInvoice"] = "004";
16
+ ClassificationCodeEnum$1["ConstructionMaterials"] = "005";
17
+ ClassificationCodeEnum$1["Disbursement"] = "006";
18
+ ClassificationCodeEnum$1["Donation"] = "007";
19
+ ClassificationCodeEnum$1["ECommerceEInvoiceToBuyer"] = "008";
20
+ ClassificationCodeEnum$1["ECommerceSelfBilledToSellerLogistics"] = "009";
21
+ ClassificationCodeEnum$1["EducationFees"] = "010";
22
+ ClassificationCodeEnum$1["GoodsOnConsignmentConsignor"] = "011";
23
+ ClassificationCodeEnum$1["GoodsOnConsignmentConsignee"] = "012";
24
+ ClassificationCodeEnum$1["GymMembership"] = "013";
25
+ ClassificationCodeEnum$1["InsuranceEducationMedicalBenefits"] = "014";
26
+ ClassificationCodeEnum$1["InsuranceTakafulLife"] = "015";
27
+ ClassificationCodeEnum$1["InterestFinancingExpenses"] = "016";
28
+ ClassificationCodeEnum$1["InternetSubscription"] = "017";
29
+ ClassificationCodeEnum$1["LandAndBuilding"] = "018";
30
+ ClassificationCodeEnum$1["MedicalExamLearningDisabilities"] = "019";
31
+ ClassificationCodeEnum$1["MedicalExamVaccination"] = "020";
32
+ ClassificationCodeEnum$1["MedicalExpensesSeriousDiseases"] = "021";
33
+ ClassificationCodeEnum$1["Others"] = "022";
34
+ ClassificationCodeEnum$1["PetroleumOperations"] = "023";
35
+ ClassificationCodeEnum$1["PrivateRetirementSchemeDeferredAnnuity"] = "024";
36
+ ClassificationCodeEnum$1["MotorVehicle"] = "025";
37
+ ClassificationCodeEnum$1["SubscriptionBooksJournalsEtc"] = "026";
38
+ ClassificationCodeEnum$1["Reimbursement"] = "027";
39
+ ClassificationCodeEnum$1["RentalOfMotorVehicle"] = "028";
40
+ ClassificationCodeEnum$1["EVChargingFacilities"] = "029";
41
+ ClassificationCodeEnum$1["RepairAndMaintenance"] = "030";
42
+ ClassificationCodeEnum$1["ResearchAndDevelopment"] = "031";
43
+ ClassificationCodeEnum$1["ForeignIncome"] = "032";
44
+ ClassificationCodeEnum$1["SelfBilledBettingGaming"] = "033";
45
+ ClassificationCodeEnum$1["SelfBilledImportationGoods"] = "034";
46
+ ClassificationCodeEnum$1["SelfBilledImportationServices"] = "035";
47
+ ClassificationCodeEnum$1["SelfBilledOthers"] = "036";
48
+ ClassificationCodeEnum$1["SelfBilledMonetaryPaymentToAgents"] = "037";
49
+ ClassificationCodeEnum$1["SportsEquipmentRentalFeesEtc"] = "038";
50
+ ClassificationCodeEnum$1["SupportingEquipmentDisabledPerson"] = "039";
51
+ ClassificationCodeEnum$1["VoluntaryContributionProvidentFund"] = "040";
52
+ ClassificationCodeEnum$1["DentalExamTreatment"] = "041";
53
+ ClassificationCodeEnum$1["FertilityTreatment"] = "042";
54
+ ClassificationCodeEnum$1["TreatmentHomeCareNursingEtc"] = "043";
55
+ ClassificationCodeEnum$1["VouchersGiftCardsLoyaltyPoints"] = "044";
56
+ ClassificationCodeEnum$1["SelfBilledNonMonetaryPaymentToAgents"] = "045";
57
+ return ClassificationCodeEnum$1;
21
58
  }({});
22
59
 
23
60
  //#endregion
24
- exports.PaymentModeCodeEnum = PaymentModeCodeEnum;
61
+ exports.ClassificationCodeEnum = ClassificationCodeEnum;
25
62
  //# sourceMappingURL=index10.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index10.cjs","names":[],"sources":["../src/types/payment-modes.d.ts"],"sourcesContent":["/**\n * Represents the allowed codes for payment modes.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/payment-methods/\n */\nexport type PaymentModeCode =\n | '01' // Cash\n | '02' // Cheque\n | '03' // Bank Transfer\n | '04' // Credit Card\n | '05' // Debit Card\n | '06' // e-Wallet / Digital Wallet\n | '07' // Digital Bank\n | '08' // Others\n\n/**\n * Enum representing the allowed payment mode codes with descriptive names.\n * Provides a more readable way to reference payment modes.\n *\n * @example\n * const mode = PaymentModeCodeEnum.Cash;\n * console.log(mode); // Output: \"01\"\n */\nexport enum PaymentModeCodeEnum {\n Cash = '01',\n Cheque = '02',\n BankTransfer = '03',\n CreditCard = '04',\n DebitCard = '05',\n EWalletDigitalWallet = '06',\n DigitalBank = '07',\n Others = '08',\n}\n\n/**\n * Interface representing a payment mode entry.\n * Contains the code and its corresponding description.\n */\nexport interface PaymentMode {\n code: PaymentModeCode\n description: string\n}\n"],"mappings":";;;;;;;;;;AAsBA,IAAY,sEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
1
+ {"version":3,"file":"index10.cjs","names":[],"sources":["../src/types/classification-codes.d.ts"],"sourcesContent":["/**\n * Represents the allowed classification codes for e-Invoice items.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/classification-codes/\n */\nexport type ClassificationCode =\n | '001' // Breastfeeding equipment\n | '002' // Child care centres and kindergartens fees\n | '003' // Computer, smartphone or tablet\n | '004' // Consolidated e-Invoice\n | '005' // Construction materials (as specified under Fourth Schedule of the Lembaga Pembangunan Industri Pembinaan Malaysia Act 1994)\n | '006' // Disbursement\n | '007' // Donation\n | '008' // e-Commerce - e-Invoice to buyer / purchaser\n | '009' // e-Commerce - Self-billed e-Invoice to seller, logistics, etc.\n | '010' // Education fees\n | '011' // Goods on consignment (Consignor)\n | '012' // Goods on consignment (Consignee)\n | '013' // Gym membership\n | '014' // Insurance - Education and medical benefits\n | '015' // Insurance - Takaful or life insurance\n | '016' // Interest and financing expenses\n | '017' // Internet subscription\n | '018' // Land and building\n | '019' // Medical examination for learning disabilities and early intervention or rehabilitation treatments of learning disabilities\n | '020' // Medical examination or vaccination expenses\n | '021' // Medical expenses for serious diseases\n | '022' // Others\n | '023' // Petroleum operations (as defined in Petroleum (Income Tax) Act 1967)\n | '024' // Private retirement scheme or deferred annuity scheme\n | '025' // Motor vehicle\n | '026' // Subscription of books / journals / magazines / newspapers / other similar publications\n | '027' // Reimbursement\n | '028' // Rental of motor vehicle\n | '029' // EV charging facilities (Installation, rental, sale / purchase or subscription fees)\n | '030' // Repair and maintenance\n | '031' // Research and development\n | '032' // Foreign income\n | '033' // Self-billed - Betting and gaming\n | '034' // Self-billed - Importation of goods\n | '035' // Self-billed - Importation of services\n | '036' // Self-billed - Others\n | '037' // Self-billed - Monetary payment to agents, dealers or distributors\n | '038' // Sports equipment, rental / entry fees for sports facilities, registration in sports competition or sports training fees imposed by associations / sports clubs / companies registered with the Sports Commissioner or Companies Commission of Malaysia and carrying out sports activities as listed under the Sports Development Act 1997\n | '039' // Supporting equipment for disabled person\n | '040' // Voluntary contribution to approved provident fund\n | '041' // Dental examination or treatment\n | '042' // Fertility treatment\n | '043' // Treatment and home care nursing, daycare centres and residential care centers\n | '044' // Vouchers, gift cards, loyalty points, etc\n | '045' // Self-billed - Non-monetary payment to agents, dealers or distributors\n\n/**\n * Enum representing the allowed classification codes with descriptive names.\n * Provides a more readable way to reference classification codes.\n *\n * @example\n * const code = ClassificationCodeEnum.ComputerSmartphoneOrTablet;\n * console.log(code); // Output: \"003\"\n */\nexport enum ClassificationCodeEnum {\n BreastfeedingEquipment = '001',\n ChildCareCentresAndKindergartensFees = '002',\n ComputerSmartphoneOrTablet = '003',\n ConsolidatedEInvoice = '004',\n ConstructionMaterials = '005',\n Disbursement = '006',\n Donation = '007',\n ECommerceEInvoiceToBuyer = '008',\n ECommerceSelfBilledToSellerLogistics = '009',\n EducationFees = '010',\n GoodsOnConsignmentConsignor = '011',\n GoodsOnConsignmentConsignee = '012',\n GymMembership = '013',\n InsuranceEducationMedicalBenefits = '014',\n InsuranceTakafulLife = '015',\n InterestFinancingExpenses = '016',\n InternetSubscription = '017',\n LandAndBuilding = '018',\n MedicalExamLearningDisabilities = '019',\n MedicalExamVaccination = '020',\n MedicalExpensesSeriousDiseases = '021',\n Others = '022',\n PetroleumOperations = '023',\n PrivateRetirementSchemeDeferredAnnuity = '024',\n MotorVehicle = '025',\n SubscriptionBooksJournalsEtc = '026',\n Reimbursement = '027',\n RentalOfMotorVehicle = '028',\n EVChargingFacilities = '029',\n RepairAndMaintenance = '030',\n ResearchAndDevelopment = '031',\n ForeignIncome = '032',\n SelfBilledBettingGaming = '033',\n SelfBilledImportationGoods = '034',\n SelfBilledImportationServices = '035',\n SelfBilledOthers = '036',\n SelfBilledMonetaryPaymentToAgents = '037',\n SportsEquipmentRentalFeesEtc = '038',\n SupportingEquipmentDisabledPerson = '039',\n VoluntaryContributionProvidentFund = '040',\n DentalExamTreatment = '041',\n FertilityTreatment = '042',\n TreatmentHomeCareNursingEtc = '043',\n VouchersGiftCardsLoyaltyPoints = '044',\n SelfBilledNonMonetaryPaymentToAgents = '045',\n}\n\n/**\n * Interface representing a classification code entry.\n * Contains the code and its corresponding description.\n */\nexport interface Classification {\n code: ClassificationCode\n description: string\n}\n"],"mappings":";;;;;;;;;;AA2DA,IAAY,4EAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}