@unimaze/billing 0.2.2 → 0.2.4

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.
@@ -82,7 +82,7 @@ var Supplier = function (props) {
82
82
  // receiverRequirements={receiverRequirementsObject}
83
83
  receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.identifier"],
84
84
  // props.intl.formatMessage(translationMessages.supplier_identifier)
85
- defaultLabel: "Kenni", defaultIsRequired: true, fieldName: ["invoice", "supplier", "identifier"] },
85
+ defaultLabel: "Kennitala", defaultIsRequired: true, fieldName: ["invoice", "supplier", "identifier"] },
86
86
  React.createElement(antd_1.Input, null)),
87
87
  React.createElement(form_item_1.default
88
88
  // receiverRequirements={receiverRequirementsObject}
@@ -106,7 +106,7 @@ exports.receiverRequirementsObject = {
106
106
  buyerReference: {
107
107
  isRequired: true,
108
108
  key: "",
109
- label: "Kröfunúmer"
109
+ label: "Tjónsnúmer"
110
110
  },
111
111
  "orderReference.documentNo": {
112
112
  isRequired: true,
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { InjectedIntlProps } from "react-intl";
3
+ import { FormInstance } from "antd/es/form";
4
+ interface Props extends InjectedIntlProps {
5
+ formInstance: FormInstance;
6
+ }
7
+ declare const _default: React.ComponentClass<Pick<Props, "formInstance">, any> & {
8
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
+ };
10
+ export default _default;
@@ -17,7 +17,7 @@ interface Props extends InjectedIntlProps {
17
17
  onlyLabelOnFirstInList?: boolean;
18
18
  index?: number;
19
19
  }
20
- declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "fieldName" | "receiverRequirementsKey" | "defaultLabel" | "defaultIsRequired" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList" | "index">, any> & {
20
+ declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "receiverRequirementsKey" | "defaultLabel" | "defaultIsRequired" | "fieldName" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList" | "index">, any> & {
21
21
  WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
22
22
  };
23
23
  export default _default;
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ var antd_1 = require("antd");
14
15
  var removeEmpty = function (obj) {
15
16
  return Object.keys(obj)
16
17
  .filter(function (k) { return obj[k] != null; }) // Remove undef. and null.
@@ -34,12 +35,15 @@ var isEmpty = function (map) {
34
35
  };
35
36
  var getIdentifierWithPrefix = function (identifier) {
36
37
  if (!identifier.startsWith("0196:")) {
37
- return "0196:" + identifier;
38
+ return "0196:" + identifier /*)*/;
38
39
  }
39
40
  else {
40
- return identifier;
41
+ return /*cleanIdentifier*/ (identifier);
41
42
  }
42
43
  };
44
+ // const cleanIdentifier = (identifier: string): string => {
45
+ // return identifier.replace(/[^0-9]/g, "") // replace anything that isn't a numeric character
46
+ // }
43
47
  var convertToInvoiceMetadataInput = function (formValues, billingLines, paymentMethod, customer) {
44
48
  var issueDate = convertDates(formValues.invoice.issueDate);
45
49
  var dueDate = convertDates(formValues.invoice.dueDate);
@@ -64,12 +68,19 @@ var convertToInvoiceMetadataInput = function (formValues, billingLines, paymentM
64
68
  value: referenceId.value
65
69
  }); })
66
70
  : null;
71
+ var getMessageHandling = function (profileOutput) {
72
+ if (!(profileOutput && profileOutput.participantLegalIsoIdentifier && profileOutput.email)) {
73
+ antd_1.message.error("There is an error in the configuration file for the receiver information");
74
+ throw new Error("There is an error in the configuration file for the receiver information");
75
+ }
76
+ return {
77
+ receiverIdentifier: profileOutput.participantLegalIsoIdentifier,
78
+ fallbackEmailAddress: profileOutput.email,
79
+ fallbackContactName: profileOutput.name
80
+ };
81
+ };
67
82
  var resp = {
68
- messageHandling: {
69
- receiverIdentifier: customer.participantLegalIsoIdentifier,
70
- fallbackEmailAddress: customer.email,
71
- fallbackContactName: customer.name,
72
- },
83
+ messageHandling: getMessageHandling(customer),
73
84
  invoice: {
74
85
  customer: {
75
86
  identifier: getIdentifierWithPrefix(invoice.customer.identifier),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",