From 40f1a5938642375040a9c9464fb85e884110600f Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Thu, 19 Oct 2023 17:45:35 +0900 Subject: [PATCH 01/20] create e-invoice --- .../credentials/EInvoiceCredential.yml | 1258 +++++++++++++++++ 1 file changed, 1258 insertions(+) create mode 100644 docs/openapi/components/schemas/credentials/EInvoiceCredential.yml diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml new file mode 100644 index 000000000..a738c1b35 --- /dev/null +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -0,0 +1,1258 @@ +$linkedData: + term: EInvoiceCredential + '@id': https://w3id.org/traceability#EInvoiceCredential +title: e-Invoice Credential +tags: + - Steel +description: >- + Narrowly defined specific invoice for steel +type: object +properties: + '@context': + type: array + readOnly: true + const: + - https://www.w3.org/2018/credentials/v1 + - https://w3id.org/traceability/v1 + default: + - https://www.w3.org/2018/credentials/v1 + - https://w3id.org/traceability/v1 + items: + type: string + enum: + - https://www.w3.org/2018/credentials/v1 + - https://w3id.org/traceability/v1 + type: + type: array + readOnly: true + const: + - VerifiableCredential + - EInvoiceCredential + default: + - VerifiableCredential + - EInvoiceCredential + items: + type: string + enum: + - VerifiableCredential + - EInvoiceCredential + id: + type: string + issuanceDate: + type: string + expirationDate: + type: string + issuer: + title: Certifier + description: Certifying party of the USMCA which can be the importer, exporter or producer + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier of the issuer such as a url or DID + type: string + format: uri + name: + title: Name + description: Name of the Certifier organization. + type: string + location: + title: Location + description: The location where, for example, an event is happening, an organization is located, or an action takes place. + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + address: + title: Postal Address + description: The postal address for an organization or place. + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street, or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + additionalProperties: false + required: + - type + employee: + title: Certification Manager + description: The employee responsible for this certification. + type: object + properties: + type: + type: array + readOnly: true + const: + - Person + default: + - Person + items: + type: string + enum: + - Person + firstName: + title: First Name + description: Person's first name. + type: string + lastName: + title: Last Name + description: Person's last name. + type: string + jobTitle: + title: Job Title + description: Person's job title. + type: string + email: + title: Person's Email Address + description: Person's email address. + type: string + phoneNumber: + title: Phone Number + description: Person's contact phone number. + type: string + additionalProperties: false + required: + - type + - firstName + - lastName + - jobTitle + - email + additionalProperties: false + required: + - type + - id + - employee + credentialSchema: + type: object + properties: + id: + title: Id + description: The url of the schema file to validate the shape of the json object + type: string + format: uri + example: https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml + default: https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml + readOnly: true + type: + title: Type + description: The type of validation to be run against the defined schema + const: OpenApiSpecificationValidator2022 + credentialSubject: + title: Invoice + description: A statement of the money due for goods or services; a bill. + type: object + properties: + type: + type: array + readOnly: true + const: + - Invoice + default: + - Invoice + items: + type: string + enum: + - Invoice + isProforma: + title: is Pro Forma + description: Indicates if this credential is a Pro Forma Invoice, or a normal invoice. + type: boolean + identifier: + title: Property Identifier + description: Identifiers for a property. + type: string + invoiceNumber: + title: Invoice Number + description: Invoice Number. + type: string + customerReferenceNumber: + title: Customer's Reference Number + description: Oversees customer’s reference number. + type: string + purchaseOrderNumbers: + title: Purchase Order Numbers + description: The Order(s) related to this Invoice. One or more Orders may be combined into a single Invoice. + type: array + items: + type: string + billOfLadingNumber: + title: Bill of Lading Number + description: Carrier-issued number for the associated Bill of Lading or Waybill. + type: string + letterOfCreditNumber: + title: Letter of Credit Number + description: A letter of credit document referenced in the trade agreement or settlement. + type: string + portOfEntry: + title: Port Of Entry + description: Port where the purchased goods will enter first. + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + unLocode: + title: UN Locode + description: LOCODE + type: string + iataAirportCode: + title: IATA Airport Code + description: IATA airport code (3 letter) + type: string + additionalProperties: false + required: + - type + originCountry: + title: Origin Country + description: A country of origin for the consignment, consignment item, or product. + type: string + destinationCountry: + title: Destination Country + description: Country to which the purchased product will be delivered + type: string + invoiceDate: + title: Invoice Date + description: A date, time, date time, or other date time value of the invoice in the trade settlement. + type: string + purchaseDate: + title: Purchase Date + description: The date that payment is made. + type: string + seller: + title: Seller + description: An entity which offers (sells, leases, lends, or loans) the services or goods. A seller may also be a provider. + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier for the seller + type: string + name: + title: Name + description: Name of the seller + type: string + url: + title: URL + description: URL of the seller + type: string + email: + title: Email Address + description: Seller's primary email address. + type: string + phoneNumber: + title: Phone Number + description: Seller's contact phone number. + type: string + location: + title: Location + description: Seller's physical location, such as address or coordinates. + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + address: + title: Postal Address + description: The postal address for an organization or place. + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + buyer: + title: Buyer + description: Importer of record. Party placing the order or paying the invoice. + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier for the buyer + type: string + name: + title: Name + description: Name of the buyer + type: string + url: + title: URL + description: URL of the buyer + type: string + email: + title: Email Address + description: Buyer's primary email address. + type: string + phoneNumber: + title: Phone Number + description: Buyer's contact phone number. + type: string + location: + title: Location + description: Buyer's physical location, such as address or coordinates. + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + address: + title: Postal Address + description: The postal address for an organization or place. + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + consignee: + title: Consignee + description: The consignee party for this supply chain consignment. + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier for the consginee. + type: string + name: + title: Name + description: Name of the consginee. + type: string + url: + title: URL + description: URL of the consignee. + type: string + email: + title: Email Address + description: Consignee's primary email address. + type: string + phoneNumber: + title: Phone Number + description: Consignee's contact phone number. + type: string + location: + title: Location + description: Consignee's physical location, such as address or coordinates. + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + address: + title: Postal Address + description: The postal address for an organization or place. + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + minItems: 0 + maxItems: 1 + itemsShipped: + title: Items Shipped + description: Itemized list of shipped goods. + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - TradeLineItem + default: + - TradeLineItem + items: + type: string + enum: + - TradeLineItem + name: + title: Name + description: Name of the Tradeline item. + type: string + description: + title: Description of product + type: string + product: + title: Product + description: Product details. + type: object + properties: + type: + type: array + readOnly: true + const: + - Product + default: + - Product + items: + type: string + enum: + - Product + id: + title: Product Identifier + description: The product identifier, such as ISBN. + type: string + gtin: + title: Global Trade Item Number (GTIN) + type: string + manufacturer: + title: Manufacturer + description: The manufacturer of the product. + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier for the buyer + type: string + name: + title: Name + description: Name of the buyer + type: string + additionalProperties: false + required: + - type + name: + title: Name + description: Product name. + type: string + description: + title: Description + description: Product description. + type: string + category: + title: Category + description: A category for the item. + type: string + weight: + title: Weight + description: Weight of the product. + type: object + properties: + type: + type: array + readOnly: true + const: + - QuantitativeValue + default: + - QuantitativeValue + items: + type: string + enum: + - QuantitativeValue + unitCode: + title: Unit Code + description: Unit of measurement. + type: string + value: + title: Value + description: Value or amount. + type: string + additionalProperties: false + required: + - type + productPrice: + title: Product Price + description: >- + One or more detailed price specifications, indicating the unit price and + delivery or payment charges. + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + sku: + title: SKU Number + description: >- + The Stock Keeping Unit (SKU), i.e., a merchant-specific identifier for a + product or service, or for the product to which the offer refers. + type: string + batchNumber: + title: Batch Number + description: A tracking number for commodities + type: string + commodity: + title: Commodity + description: Product commodity code, codification system and description + type: object + properties: + type: + type: array + readOnly: true + const: + - Commodity + default: + - Commodity + items: + type: string + enum: + - Commodity + commodityCode: + title: Commodity Code + description: >- + The commodity code at a given granularity, commonly a 6-digit HS or a + 10-digit HTS code. + type: string + commodityCodeType: + title: Commodity Code Type + description: Commodity code type + enum: + - HS + - HTS + description: + title: Commodity Description + description: Description of the commodity. + type: string + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + itemCount: + title: Item Count + description: A quantity despatched in the trade delivery. + type: number + freeTradeAgreement: + title: Free Trade Agreement + description: Relevant Free Trade Agreement + type: string + countryOfOrigin: + title: Country of Origin + description: Identify the 2-digit ISO country code of the country of production. + type: string + netWeight: + title: Trade Line Item Net Weight + description: A measure of the net weight (mass). + type: object + properties: + type: + type: array + readOnly: true + const: + - QuantitativeValue + default: + - QuantitativeValue + items: + type: string + enum: + - QuantitativeValue + unitCode: + title: Unit Code + description: Unit of measurement. + type: string + value: + title: Value + description: Value or amount. + type: string + additionalProperties: false + required: + - type + grossWeight: + title: Trade Line Item Gross Weight + description: >- + A measure of the gross weight (mass) which includes packaging but excludes + any transport equipment. + type: object + properties: + type: + type: array + readOnly: true + const: + - QuantitativeValue + default: + - QuantitativeValue + items: + type: string + enum: + - QuantitativeValue + unitCode: + title: Unit Code + description: Unit of measurement. + type: string + value: + title: Value + description: Value or amount. + type: string + additionalProperties: false + required: + - type + lineItemTotalPrice: + title: Total Price + description: Total line item price. + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + minItems: 1 + comments: + title: Comments + description: Free text comments. + type: array + items: + type: string + packageQuantity: + title: Package Quantity + description: Total number of packages. + type: number + totalWeight: + title: Total Weight + description: Total weight of the products. + type: object + properties: + type: + type: array + readOnly: true + const: + - QuantitativeValue + default: + - QuantitativeValue + items: + type: string + enum: + - QuantitativeValue + unitCode: + title: Unit Code + description: Unit of measurement. + type: string + value: + title: Value + description: Value or amount. + type: string + additionalProperties: false + required: + - type + termsOfDelivery: + title: Terms of Delivery + description: The conditions agreed upon between the parties with regard to the delivery of goods and or services. + type: string + termsOfPayment: + title: Terms of Payment + description: Terms, conditions, and currency of settlement, as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order, and/or the letter of credit. + type: string + currencyOfSettlement: + title: Terms of Settlement + description: Currency agreed upon between seller and buyer as payment. + type: string + invoiceSubtotal: + title: Invoice Subtotal + description: The subtotal of line items. + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + discounts: + title: Discounts + description: Applicable discounts. + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + deductions: + title: Additions + description: Applicable additions. + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + tax: + title: Tax + description: Applicable tax. + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + freightCost: + title: Freight Cost + description: Included cost of freight. + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + insuranceCost: + title: Freight Cost + description: Included cost of insurance. + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + totalPaymentDue: + title: Total Payment Due + description: The total amount due. + type: object + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + additionalProperties: false + required: + - type + - price + - priceCurrency + additionalProperties: false + required: + - type + - invoiceNumber + - seller + - buyer + - itemsShipped + - totalPaymentDue + proof: + title: proof + description: A JSON Web Signature proof for a credential as defined by the VC data model + type: object + properties: + type: + type: string + description: Signature suite for the proof + enum: + - Ed25519Signature2018 + created: + description: Creation timestamp for the proof in the form of an XML datestring + type: string + verificationMethod: + description: The fragment from which the public key can be de-referenced, in the form of a URI + type: string + proofPurpose: + description: In the case of credentials, the proof should be the constant, 'assertionMethod' + const: assertionMethod + jws: + description: The JSON Web Signature for the proof + type: string +additionalProperties: false +required: + - '@context' + - type + - id + - issuanceDate + - issuer + - credentialSubject + - credentialSchema +example: |- + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/traceability/v1" + ], + "id": "urn:uuid:5e45f155-c949-4005-a7e5-26ni58b6a59a", + "type": [ + "VerifiableCredential", + "CommercialInvoiceCredential" + ], + "issuanceDate": "2022-02-23T11:55:00Z", + "issuer": { + "type": [ + "Organization" + ], + "id": "did:web:prime-steel.example.com", + "name": "American Prime Steel Inc.", + "employee": { + "type": [ + "Person" + ], + "firstName": "John", + "lastName": "Doe", + "jobTitle": "Legal Assistant", + "email": "jdoe@example.com", + "phoneNumber": "555-867-5309" + }, + "location": { + "type": [ + "Place" + ], + "address": { + "type": [ + "PostalAddress" + ], + "streetAddress": "1551 Keebler Knoll", + "addressLocality": "Vivianeburgh", + "addressRegion": "Oregon", + "postalCode": "47090", + "addressCountry": "US" + } + } + }, + "credentialSchema": { + "id": "https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml", + "type": "OpenApiSpecificationValidator2022" + } + "credentialSubject": { + "type": [ + "Invoice" + ] + } + } \ No newline at end of file From fd1d5f0154a6dff1f0a6ca91017578900b574e95 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Thu, 19 Oct 2023 22:15:19 +0900 Subject: [PATCH 02/20] feat: add buyer and consignee --- .../credentials/EInvoiceCredential.yml | 848 ++---------------- 1 file changed, 72 insertions(+), 776 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index a738c1b35..210e96c5d 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -43,8 +43,8 @@ properties: expirationDate: type: string issuer: - title: Certifier - description: Certifying party of the USMCA which can be the importer, exporter or producer + title: Seller + description: Selling Party issuing the Commercial Invoice type: object properties: type: @@ -65,7 +65,7 @@ properties: format: uri name: title: Name - description: Name of the Certifier organization. + description: Name of the Seller organization. type: string location: title: Location @@ -194,6 +194,10 @@ properties: credentialSubject: title: Invoice description: A statement of the money due for goods or services; a bill. + additionalProperties: false + required: + - type + - buyer type: object properties: type: @@ -207,185 +211,12 @@ properties: type: string enum: - Invoice - isProforma: - title: is Pro Forma - description: Indicates if this credential is a Pro Forma Invoice, or a normal invoice. - type: boolean - identifier: - title: Property Identifier - description: Identifiers for a property. - type: string - invoiceNumber: - title: Invoice Number - description: Invoice Number. - type: string - customerReferenceNumber: - title: Customer's Reference Number - description: Oversees customer’s reference number. - type: string - purchaseOrderNumbers: - title: Purchase Order Numbers - description: The Order(s) related to this Invoice. One or more Orders may be combined into a single Invoice. - type: array - items: - type: string - billOfLadingNumber: - title: Bill of Lading Number - description: Carrier-issued number for the associated Bill of Lading or Waybill. - type: string - letterOfCreditNumber: - title: Letter of Credit Number - description: A letter of credit document referenced in the trade agreement or settlement. - type: string - portOfEntry: - title: Port Of Entry - description: Port where the purchased goods will enter first. - type: object - properties: - type: - type: array - readOnly: true - const: - - Place - default: - - Place - items: - type: string - enum: - - Place - unLocode: - title: UN Locode - description: LOCODE - type: string - iataAirportCode: - title: IATA Airport Code - description: IATA airport code (3 letter) - type: string - additionalProperties: false - required: - - type - originCountry: - title: Origin Country - description: A country of origin for the consignment, consignment item, or product. - type: string - destinationCountry: - title: Destination Country - description: Country to which the purchased product will be delivered - type: string - invoiceDate: - title: Invoice Date - description: A date, time, date time, or other date time value of the invoice in the trade settlement. - type: string - purchaseDate: - title: Purchase Date - description: The date that payment is made. - type: string - seller: - title: Seller - description: An entity which offers (sells, leases, lends, or loans) the services or goods. A seller may also be a provider. - type: object - properties: - type: - type: array - readOnly: true - const: - - Organization - default: - - Organization - items: - type: string - enum: - - Organization - id: - title: Identifier - description: Identifier for the seller - type: string - name: - title: Name - description: Name of the seller - type: string - url: - title: URL - description: URL of the seller - type: string - email: - title: Email Address - description: Seller's primary email address. - type: string - phoneNumber: - title: Phone Number - description: Seller's contact phone number. - type: string - location: - title: Location - description: Seller's physical location, such as address or coordinates. - type: object - properties: - type: - type: array - readOnly: true - const: - - Place - default: - - Place - items: - type: string - enum: - - Place - address: - title: Postal Address - description: The postal address for an organization or place. - type: object - properties: - type: - type: array - readOnly: true - const: - - PostalAddress - default: - - PostalAddress - items: - type: string - enum: - - PostalAddress - streetAddress: - title: Street Address - description: >- - The street address expressed as free form text. The street address is - printed on paper as the first lines below the name. For example, the name - of the street and the number in the street or the name of a building. - type: string - addressLocality: - title: Address Locality - description: Text specifying the name of the locality; for example, a city. - type: string - addressRegion: - title: Address Region - description: >- - Text specifying a province or state in abbreviated format; for example, - NJ. - type: string - postalCode: - title: Postal Code - description: Text specifying the postal code for an address. - type: string - addressCountry: - title: Address Country - description: >- - The two-letter ISO 3166-1 alpha-2 country code. - type: string - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type buyer: title: Buyer description: Importer of record. Party placing the order or paying the invoice. + additionalProperties: false + required: + - type type: object properties: type: @@ -422,6 +253,9 @@ properties: location: title: Location description: Buyer's physical location, such as address or coordinates. + additionalProperties: false + required: + - type type: object properties: type: @@ -438,6 +272,9 @@ properties: address: title: Postal Address description: The postal address for an organization or place. + additionalProperties: false + required: + - type type: object properties: type: @@ -477,15 +314,6 @@ properties: description: >- The two-letter ISO 3166-1 alpha-2 country code. type: string - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type consignee: title: Consignee description: The consignee party for this supply chain consignment. @@ -593,584 +421,6 @@ properties: - type minItems: 0 maxItems: 1 - itemsShipped: - title: Items Shipped - description: Itemized list of shipped goods. - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - TradeLineItem - default: - - TradeLineItem - items: - type: string - enum: - - TradeLineItem - name: - title: Name - description: Name of the Tradeline item. - type: string - description: - title: Description of product - type: string - product: - title: Product - description: Product details. - type: object - properties: - type: - type: array - readOnly: true - const: - - Product - default: - - Product - items: - type: string - enum: - - Product - id: - title: Product Identifier - description: The product identifier, such as ISBN. - type: string - gtin: - title: Global Trade Item Number (GTIN) - type: string - manufacturer: - title: Manufacturer - description: The manufacturer of the product. - type: object - properties: - type: - type: array - readOnly: true - const: - - Organization - default: - - Organization - items: - type: string - enum: - - Organization - id: - title: Identifier - description: Identifier for the buyer - type: string - name: - title: Name - description: Name of the buyer - type: string - additionalProperties: false - required: - - type - name: - title: Name - description: Product name. - type: string - description: - title: Description - description: Product description. - type: string - category: - title: Category - description: A category for the item. - type: string - weight: - title: Weight - description: Weight of the product. - type: object - properties: - type: - type: array - readOnly: true - const: - - QuantitativeValue - default: - - QuantitativeValue - items: - type: string - enum: - - QuantitativeValue - unitCode: - title: Unit Code - description: Unit of measurement. - type: string - value: - title: Value - description: Value or amount. - type: string - additionalProperties: false - required: - - type - productPrice: - title: Product Price - description: >- - One or more detailed price specifications, indicating the unit price and - delivery or payment charges. - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - sku: - title: SKU Number - description: >- - The Stock Keeping Unit (SKU), i.e., a merchant-specific identifier for a - product or service, or for the product to which the offer refers. - type: string - batchNumber: - title: Batch Number - description: A tracking number for commodities - type: string - commodity: - title: Commodity - description: Product commodity code, codification system and description - type: object - properties: - type: - type: array - readOnly: true - const: - - Commodity - default: - - Commodity - items: - type: string - enum: - - Commodity - commodityCode: - title: Commodity Code - description: >- - The commodity code at a given granularity, commonly a 6-digit HS or a - 10-digit HTS code. - type: string - commodityCodeType: - title: Commodity Code Type - description: Commodity code type - enum: - - HS - - HTS - description: - title: Commodity Description - description: Description of the commodity. - type: string - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - itemCount: - title: Item Count - description: A quantity despatched in the trade delivery. - type: number - freeTradeAgreement: - title: Free Trade Agreement - description: Relevant Free Trade Agreement - type: string - countryOfOrigin: - title: Country of Origin - description: Identify the 2-digit ISO country code of the country of production. - type: string - netWeight: - title: Trade Line Item Net Weight - description: A measure of the net weight (mass). - type: object - properties: - type: - type: array - readOnly: true - const: - - QuantitativeValue - default: - - QuantitativeValue - items: - type: string - enum: - - QuantitativeValue - unitCode: - title: Unit Code - description: Unit of measurement. - type: string - value: - title: Value - description: Value or amount. - type: string - additionalProperties: false - required: - - type - grossWeight: - title: Trade Line Item Gross Weight - description: >- - A measure of the gross weight (mass) which includes packaging but excludes - any transport equipment. - type: object - properties: - type: - type: array - readOnly: true - const: - - QuantitativeValue - default: - - QuantitativeValue - items: - type: string - enum: - - QuantitativeValue - unitCode: - title: Unit Code - description: Unit of measurement. - type: string - value: - title: Value - description: Value or amount. - type: string - additionalProperties: false - required: - - type - lineItemTotalPrice: - title: Total Price - description: Total line item price. - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - minItems: 1 - comments: - title: Comments - description: Free text comments. - type: array - items: - type: string - packageQuantity: - title: Package Quantity - description: Total number of packages. - type: number - totalWeight: - title: Total Weight - description: Total weight of the products. - type: object - properties: - type: - type: array - readOnly: true - const: - - QuantitativeValue - default: - - QuantitativeValue - items: - type: string - enum: - - QuantitativeValue - unitCode: - title: Unit Code - description: Unit of measurement. - type: string - value: - title: Value - description: Value or amount. - type: string - additionalProperties: false - required: - - type - termsOfDelivery: - title: Terms of Delivery - description: The conditions agreed upon between the parties with regard to the delivery of goods and or services. - type: string - termsOfPayment: - title: Terms of Payment - description: Terms, conditions, and currency of settlement, as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order, and/or the letter of credit. - type: string - currencyOfSettlement: - title: Terms of Settlement - description: Currency agreed upon between seller and buyer as payment. - type: string - invoiceSubtotal: - title: Invoice Subtotal - description: The subtotal of line items. - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - discounts: - title: Discounts - description: Applicable discounts. - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - deductions: - title: Additions - description: Applicable additions. - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - tax: - title: Tax - description: Applicable tax. - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - freightCost: - title: Freight Cost - description: Included cost of freight. - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - insuranceCost: - title: Freight Cost - description: Included cost of insurance. - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - totalPaymentDue: - title: Total Payment Due - description: The total amount due. - type: object - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - additionalProperties: false - required: - - type - - price - - priceCurrency - additionalProperties: false - required: - - type - - invoiceNumber - - seller - - buyer - - itemsShipped - - totalPaymentDue proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model @@ -1220,16 +470,6 @@ example: |- ], "id": "did:web:prime-steel.example.com", "name": "American Prime Steel Inc.", - "employee": { - "type": [ - "Person" - ], - "firstName": "John", - "lastName": "Doe", - "jobTitle": "Legal Assistant", - "email": "jdoe@example.com", - "phoneNumber": "555-867-5309" - }, "location": { "type": [ "Place" @@ -1244,6 +484,16 @@ example: |- "postalCode": "47090", "addressCountry": "US" } + }, + "employee": { + "type": [ + "Person" + ], + "firstName": "John", + "lastName": "Doe", + "jobTitle": "Legal Assistant", + "email": "jdoe@example.com", + "phoneNumber": "555-867-5309" } }, "credentialSchema": { @@ -1253,6 +503,52 @@ example: |- "credentialSubject": { "type": [ "Invoice" + ], + "buyer": { + "type": [ + "Organization" + ], + "id": "did:web:generic-motors.example.com", + "name": "Generic Motors of America", + "location": { + "type": [ + "Place" + ], + "address": { + "type": [ + "PostalAddress" + ], + "streetAddress": "12 Generic Motors Dr", + "addressLocality": "Detroit", + "addressRegion": "Michigan", + "postalCode": "48232-5170", + "addressCountry": "US" + } + } + }, + "consignee": [ + { + "type": [ + "Organization" + ], + "id": "did:web:generic-motors.example.com", + "name": "Generic Motors of America", + "location": { + "type": [ + "Place" + ], + "address": { + "type": [ + "PostalAddress" + ], + "streetAddress": "12 Generic Motors Dr", + "addressLocality": "Detroit", + "addressRegion": "Michigan", + "postalCode": "48232-5170", + "addressCountry": "US" + } + } + } ] } } \ No newline at end of file From dc91cb71f46b7e473f42c0648bca59b1bc57b9c1 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Fri, 20 Oct 2023 04:05:47 +0900 Subject: [PATCH 03/20] feat: add items shipped --- .../credentials/EInvoiceCredential.yml | 123 +++++++++++++++++- 1 file changed, 122 insertions(+), 1 deletion(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 210e96c5d..230d8041a 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -197,7 +197,10 @@ properties: additionalProperties: false required: - type + - linkedDocuments - buyer + - consignee + - itemsShipped type: object properties: type: @@ -211,6 +214,36 @@ properties: type: string enum: - Invoice + linkedDocuments: + title: Documents Linked or Referenced + description: References to other documents which can be used to support the claims of the current document + type: array + minItems: 0 + maxItems: 10 + items: + type: object + additionalProperties: false + required: + - type + - documentId + - documentType + properties: + type: + const: LinkedDocument + default: LinkedDocument + documentId: + title: Document Identifier + description: The Identifier of the document being referenced + type: string + documentType: + title: Document Type + description: The type of the document being referenced + type: enum + - MillTestReport + - PurchaseOrder + - PackingList + - BillOfLading + - CertificationOfOrigin buyer: title: Buyer description: Importer of record. Party placing the order or paying the invoice. @@ -421,6 +454,65 @@ properties: - type minItems: 0 maxItems: 1 + itemsShipped: + title: Items Shipped + description: Itemized list of shipped goods. + type: array + items: + type: object + additionalProperties: false + properties: + type: + type: array + readOnly: true + const: + - TradeLineItem + default: + - TradeLineItem + items: + type: string + enum: + - TradeLineItem + name: + title: Name + description: Name of the Tradeline item. + type: string + description: + title: Description of product + type: string + productIdentifier: + title: Product Identifier + description: The product identifier, such as ISBN. + type: string + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + netWeight: + title: Trade Line Item Net Weight + description: A measure of the net weight (mass). + type: number + netWeightUnit: + title: Net Weight Unit + description: Unit of measurement for Mass + enum: + - gram + - kilogram + - tonne + - pounds + additionalProperties: false + required: + - type + minItems: 1 + maxItems: 1000 proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model @@ -468,7 +560,24 @@ example: |- "type": [ "Organization" ], - "id": "did:web:prime-steel.example.com", + "linkedDocuments" : [ + { + "type": "LinkedDocument", + "documentId": "a5d1ca6c-2c06-4039-9ff9-a75d7a695c8d", + "documentType": "PurchaseOrder" + }, + { + "type": "LinkedDocument", + "documentId": "63153", + "documentType": "MillTestReport" + }, + { + "type": "LinkedDocument", + "documentId": "63153", + "documentType": "CertificationOfOrigin" + } + ], + "id": "urn:uuid:9dae7ea0-25f7-4a59-b95d-8a5599a40311", "name": "American Prime Steel Inc.", "location": { "type": [ @@ -549,6 +658,18 @@ example: |- } } } + ], + "itemsShipped" : [ + { + "type": "TradeLineItem", + "name": "Rebar", + "description": "Round Rebar used for Construction", + "productIdentifier": "rn19082-a", + "price": 1000, + "priceCurrency": "USD", + "netWeight": 1, + "netWeightUnit": "tonne" + } ] } } \ No newline at end of file From 5bdbaf125e9852efce86980c42f945d9452094ad Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Fri, 20 Oct 2023 04:09:44 +0900 Subject: [PATCH 04/20] feat: add linked documents --- .../credentials/EInvoiceCredential.yml | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 230d8041a..47563e27d 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -560,23 +560,6 @@ example: |- "type": [ "Organization" ], - "linkedDocuments" : [ - { - "type": "LinkedDocument", - "documentId": "a5d1ca6c-2c06-4039-9ff9-a75d7a695c8d", - "documentType": "PurchaseOrder" - }, - { - "type": "LinkedDocument", - "documentId": "63153", - "documentType": "MillTestReport" - }, - { - "type": "LinkedDocument", - "documentId": "63153", - "documentType": "CertificationOfOrigin" - } - ], "id": "urn:uuid:9dae7ea0-25f7-4a59-b95d-8a5599a40311", "name": "American Prime Steel Inc.", "location": { @@ -613,6 +596,23 @@ example: |- "type": [ "Invoice" ], + "linkedDocuments" : [ + { + "type": "LinkedDocument", + "documentId": "a5d1ca6c-2c06-4039-9ff9-a75d7a695c8d", + "documentType": "PurchaseOrder" + }, + { + "type": "LinkedDocument", + "documentId": "63153", + "documentType": "MillTestReport" + }, + { + "type": "LinkedDocument", + "documentId": "63153", + "documentType": "CertificationOfOrigin" + } + ], "buyer": { "type": [ "Organization" From efc92d9ef962f6f94ef7a83914a64fff4f0c3d02 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Fri, 20 Oct 2023 21:26:21 +0900 Subject: [PATCH 05/20] feat: group shipment and shipTo information --- .../credentials/EInvoiceCredential.yml | 323 ++++++++++-------- packages/traceability-tests/examples/v2.json | 4 +- 2 files changed, 181 insertions(+), 146 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 47563e27d..b21cf8104 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -129,8 +129,8 @@ properties: required: - type employee: - title: Certification Manager - description: The employee responsible for this certification. + title: Sales Representative + description: The employee responsible for this invoice type: object properties: type: @@ -200,7 +200,6 @@ properties: - linkedDocuments - buyer - consignee - - itemsShipped type: object properties: type: @@ -214,7 +213,7 @@ properties: type: string enum: - Invoice - linkedDocuments: + relatedDocuments: title: Documents Linked or Referenced description: References to other documents which can be used to support the claims of the current document type: array @@ -238,7 +237,7 @@ properties: documentType: title: Document Type description: The type of the document being referenced - type: enum + enum: - MillTestReport - PurchaseOrder - PackingList @@ -347,113 +346,6 @@ properties: description: >- The two-letter ISO 3166-1 alpha-2 country code. type: string - consignee: - title: Consignee - description: The consignee party for this supply chain consignment. - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - Organization - default: - - Organization - items: - type: string - enum: - - Organization - id: - title: Identifier - description: Identifier for the consginee. - type: string - name: - title: Name - description: Name of the consginee. - type: string - url: - title: URL - description: URL of the consignee. - type: string - email: - title: Email Address - description: Consignee's primary email address. - type: string - phoneNumber: - title: Phone Number - description: Consignee's contact phone number. - type: string - location: - title: Location - description: Consignee's physical location, such as address or coordinates. - type: object - properties: - type: - type: array - readOnly: true - const: - - Place - default: - - Place - items: - type: string - enum: - - Place - address: - title: Postal Address - description: The postal address for an organization or place. - type: object - properties: - type: - type: array - readOnly: true - const: - - PostalAddress - default: - - PostalAddress - items: - type: string - enum: - - PostalAddress - streetAddress: - title: Street Address - description: >- - The street address expressed as free form text. The street address is - printed on paper as the first lines below the name. For example, the name - of the street and the number in the street or the name of a building. - type: string - addressLocality: - title: Address Locality - description: Text specifying the name of the locality; for example, a city. - type: string - addressRegion: - title: Address Region - description: >- - Text specifying a province or state in abbreviated format; for example, - NJ. - type: string - addressCountry: - title: Address Country - description: >- - The two-letter ISO 3166-1 alpha-2 country code. - type: string - postalCode: - title: Postal Code - description: Text specifying the postal code for an address. - type: string - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - minItems: 0 - maxItems: 1 itemsShipped: title: Items Shipped description: Itemized list of shipped goods. @@ -513,6 +405,142 @@ properties: - type minItems: 1 maxItems: 1000 + shipment: + title: Shipment + description: Details about the shipment being made + type: object + properties: + type: + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Shipment + default: + - Shipment + items: + type: string + enum: + - Shipment + termsOfDelivery: + title: Terms of Delivery + description: The conditions agreed upon between the parties with regard to the delivery of goods and or services. + type: string + shipmentMethod: + title: Shipment Method + description: The method in which the goods in the invoice are being shipped + type: string + shipTo: + title: Ship To (optional) + description: The organization of the party receiving the products (consignee) and their address if different from the buyer + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier for the consginee. + type: string + name: + title: Name + description: Name of the consginee. + type: string + url: + title: URL + description: URL of the consignee. + type: string + email: + title: Email Address + description: Consignee's primary email address. + type: string + phoneNumber: + title: Phone Number + description: Consignee's contact phone number. + type: string + location: + title: Location + description: Consignee's physical location, such as address or coordinates. + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + address: + title: Postal Address + description: The postal address for an organization or place. + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + minItems: 0 + maxItems: 1 proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model @@ -550,11 +578,11 @@ example: |- "https://www.w3.org/2018/credentials/v1", "https://w3id.org/traceability/v1" ], - "id": "urn:uuid:5e45f155-c949-4005-a7e5-26ni58b6a59a", "type": [ "VerifiableCredential", "CommercialInvoiceCredential" ], + "id": "urn:uuid:5e45f155-c949-4005-a7e5-26ni58b6a59a", "issuanceDate": "2022-02-23T11:55:00Z", "issuer": { "type": [ @@ -588,15 +616,11 @@ example: |- "phoneNumber": "555-867-5309" } }, - "credentialSchema": { - "id": "https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml", - "type": "OpenApiSpecificationValidator2022" - } "credentialSubject": { "type": [ "Invoice" ], - "linkedDocuments" : [ + "relatedDocuments" : [ { "type": "LinkedDocument", "documentId": "a5d1ca6c-2c06-4039-9ff9-a75d7a695c8d", @@ -635,33 +659,9 @@ example: |- } } }, - "consignee": [ - { - "type": [ - "Organization" - ], - "id": "did:web:generic-motors.example.com", - "name": "Generic Motors of America", - "location": { - "type": [ - "Place" - ], - "address": { - "type": [ - "PostalAddress" - ], - "streetAddress": "12 Generic Motors Dr", - "addressLocality": "Detroit", - "addressRegion": "Michigan", - "postalCode": "48232-5170", - "addressCountry": "US" - } - } - } - ], "itemsShipped" : [ { - "type": "TradeLineItem", + "type": ["TradeLineItem"], "name": "Rebar", "description": "Round Rebar used for Construction", "productIdentifier": "rn19082-a", @@ -670,6 +670,41 @@ example: |- "netWeight": 1, "netWeightUnit": "tonne" } - ] + ], + "shipment": { + "type" : [ + "Shipment" + ], + "termsOfDelivery": "full payment before shipment", + "shipmentMethod": "Tailer No. 53103", + "shipTo": [ + { + "type": [ + "Organization" + ], + "id": "did:web:generic-motors.example.com", + "name": "Generic Motors of America", + "location": { + "type": [ + "Place" + ], + "address": { + "type": [ + "PostalAddress" + ], + "streetAddress": "12 Generic Motors Dr", + "addressLocality": "Detroit", + "addressRegion": "Michigan", + "postalCode": "48232-5170", + "addressCountry": "US" + } + } + } + ] + } + }, + "credentialSchema": { + "id": "https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml", + "type": "OpenApiSpecificationValidator2022" } } \ No newline at end of file diff --git a/packages/traceability-tests/examples/v2.json b/packages/traceability-tests/examples/v2.json index b0b682f03..60d5a0411 100644 --- a/packages/traceability-tests/examples/v2.json +++ b/packages/traceability-tests/examples/v2.json @@ -9,7 +9,7 @@ }, "examples": [ { - "issued": "eyJpc3MiOiJkaWQ6andrOmV5SnJkSGtpT2lKRlF5SXNJbU55ZGlJNklsQXRNemcwSWl3aVlXeG5Jam9pUlZNek9EUWlMQ0o0SWpvaU9XcHpSbEpXVm1weFNsazFTa2w1U25JMU9HZEZRblZ5YW10emFreHdUVUp2V1ZaRFpUWmxNRUo2VXpoQlV6Tk1RWGx5TjNoTGVGTm5VRTlwVUdOSFRTSXNJbmtpT2lKaWRIUk1YMlpWYTNSa2NpMU1hSGhOWTNwSmFtbDBaRnBXY0c5cGFYcHBVR2xuT0cxbk9ERmlkR1ZVVW0welFtcGFMV3c0ZFU1cWRrcExZV3RuVWpOQ0luMCIsImtpZCI6IiMwIiwiYWxnIjoiRVMzODQiLCJjdHkiOiJ2YytsZCtqc29uIn0.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy9ucy9hY3Rpdml0eXN0cmVhbXMiXSwiaWQiOiJ1cm46dXVpZDo0OWRmODliNC03NjYyLTQxOGUtYjIzYi1mYmVmZTgyMWZiMGQiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiQWN0aXZpdHlQdWJBY3RvckNhcmQiXSwiY3JlZGVudGlhbFNjaGVtYSI6eyJpZCI6Imh0dHBzOi8vdzNjLWNjZy5naXRodWIuaW8vdHJhY2VhYmlsaXR5LXZvY2FiL29wZW5hcGkvY29tcG9uZW50cy9zY2hlbWFzL2NyZWRlbnRpYWxzL0FjdGl2aXR5UHViQWN0b3JDYXJkLnltbCIsInR5cGUiOiJKc29uU2NoZW1hIn0sImlzc3VhbmNlRGF0ZSI6IjIwMjMtMDUtMjFUMTU6Mzk6NTcuOTQ0WiIsImlzc3VlciI6eyJpZCI6ImRpZDpqd2s6ZXlKcmRIa2lPaUpGUXlJc0ltTnlkaUk2SWxBdE16ZzBJaXdpWVd4bklqb2lSVk16T0RRaUxDSjRJam9pT1dwelJsSldWbXB4U2xrMVNrbDVTbkkxT0dkRlFuVnlhbXR6YWt4d1RVSnZXVlpEWlRabE1FSjZVemhCVXpOTVFYbHlOM2hMZUZOblVFOXBVR05IVFNJc0lua2lPaUppZEhSTVgyWlZhM1JrY2kxTWFIaE5ZM3BKYW1sMFpGcFdjRzlwYVhwcFVHbG5PRzFuT0RGaWRHVlVVbTB6UW1wYUxXdzRkVTVxZGtwTFlXdG5Vak5DSW4wIn0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7InR5cGUiOlsiUGVyc29uIl0sImlkIjoiaHR0cHM6Ly9rZW56b2lzaGlpLmV4YW1wbGUuY29tLyIsImZvbGxvd2luZyI6Imh0dHBzOi8va2Vuem9pc2hpaS5leGFtcGxlLmNvbS9mb2xsb3dpbmcuanNvbiIsImZvbGxvd2VycyI6Imh0dHBzOi8va2Vuem9pc2hpaS5leGFtcGxlLmNvbS9mb2xsb3dlcnMuanNvbiIsImxpa2VkIjoiaHR0cHM6Ly9rZW56b2lzaGlpLmV4YW1wbGUuY29tL2xpa2VkLmpzb24iLCJpbmJveCI6Imh0dHBzOi8va2Vuem9pc2hpaS5leGFtcGxlLmNvbS9pbmJveC5qc29uIiwib3V0Ym94IjoiaHR0cHM6Ly9rZW56b2lzaGlpLmV4YW1wbGUuY29tL2ZlZWQuanNvbiIsInByZWZlcnJlZFVzZXJuYW1lIjoia2Vuem9pc2hpaSIsIm5hbWUiOiLnn7PkupXlgaXolLUiLCJzdW1tYXJ5Ijoi44GT44Gu5pa544Gv44Gf44Gg44Gu5L6L44Gn44GZIiwiaWNvbiI6WyJodHRwczovL2tlbnpvaXNoaWkuZXhhbXBsZS5jb20vaW1hZ2UvMTY1OTg3YWtscmU0Il19fQ.UhvmXt2KE9O3LeIAKCiav5UZwcMznEuOtARVncoPuerqv6jAK27kFkKkKH5GAdgBKhnpUPn0IuBqxqUQFrHCUhdp5qBJuWcYozJaCk5uncUd6sRdCDH6hONTZTLiERoM", + "issued": "eyJpc3MiOiJkaWQ6andrOmV5SnJkSGtpT2lKRlF5SXNJbU55ZGlJNklsQXRNemcwSWl3aVlXeG5Jam9pUlZNek9EUWlMQ0o0SWpvaU9XcHpSbEpXVm1weFNsazFTa2w1U25JMU9HZEZRblZ5YW10emFreHdUVUp2V1ZaRFpUWmxNRUo2VXpoQlV6Tk1RWGx5TjNoTGVGTm5VRTlwVUdOSFRTSXNJbmtpT2lKaWRIUk1YMlpWYTNSa2NpMU1hSGhOWTNwSmFtbDBaRnBXY0c5cGFYcHBVR2xuT0cxbk9ERmlkR1ZVVW0welFtcGFMV3c0ZFU1cWRrcExZV3RuVWpOQ0luMCIsImtpZCI6IiMwIiwiYWxnIjoiRVMzODQiLCJjdHkiOiJ2YytsZCtqc29uIn0.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy9ucy9hY3Rpdml0eXN0cmVhbXMiXSwiaWQiOiJ1cm46dXVpZDpjNjc3ZmNhOS1jOTU1LTQxM2MtYWVmMy00YTM4ZDUzMzAyYTkiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiQWN0aXZpdHlQdWJBY3RvckNhcmQiXSwiY3JlZGVudGlhbFNjaGVtYSI6eyJpZCI6Imh0dHBzOi8vdzNjLWNjZy5naXRodWIuaW8vdHJhY2VhYmlsaXR5LXZvY2FiL29wZW5hcGkvY29tcG9uZW50cy9zY2hlbWFzL2NyZWRlbnRpYWxzL0FjdGl2aXR5UHViQWN0b3JDYXJkLnltbCIsInR5cGUiOiJKc29uU2NoZW1hIn0sImlzc3VhbmNlRGF0ZSI6IjIwMjMtMDUtMjFUMTU6Mzk6NTcuOTQ0WiIsImlzc3VlciI6eyJpZCI6ImRpZDpqd2s6ZXlKcmRIa2lPaUpGUXlJc0ltTnlkaUk2SWxBdE16ZzBJaXdpWVd4bklqb2lSVk16T0RRaUxDSjRJam9pT1dwelJsSldWbXB4U2xrMVNrbDVTbkkxT0dkRlFuVnlhbXR6YWt4d1RVSnZXVlpEWlRabE1FSjZVemhCVXpOTVFYbHlOM2hMZUZOblVFOXBVR05IVFNJc0lua2lPaUppZEhSTVgyWlZhM1JrY2kxTWFIaE5ZM3BKYW1sMFpGcFdjRzlwYVhwcFVHbG5PRzFuT0RGaWRHVlVVbTB6UW1wYUxXdzRkVTVxZGtwTFlXdG5Vak5DSW4wIn0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7InR5cGUiOlsiUGVyc29uIl0sImlkIjoiaHR0cHM6Ly9rZW56b2lzaGlpLmV4YW1wbGUuY29tLyIsImZvbGxvd2luZyI6Imh0dHBzOi8va2Vuem9pc2hpaS5leGFtcGxlLmNvbS9mb2xsb3dpbmcuanNvbiIsImZvbGxvd2VycyI6Imh0dHBzOi8va2Vuem9pc2hpaS5leGFtcGxlLmNvbS9mb2xsb3dlcnMuanNvbiIsImxpa2VkIjoiaHR0cHM6Ly9rZW56b2lzaGlpLmV4YW1wbGUuY29tL2xpa2VkLmpzb24iLCJpbmJveCI6Imh0dHBzOi8va2Vuem9pc2hpaS5leGFtcGxlLmNvbS9pbmJveC5qc29uIiwib3V0Ym94IjoiaHR0cHM6Ly9rZW56b2lzaGlpLmV4YW1wbGUuY29tL2ZlZWQuanNvbiIsInByZWZlcnJlZFVzZXJuYW1lIjoia2Vuem9pc2hpaSIsIm5hbWUiOiLnn7PkupXlgaXolLUiLCJzdW1tYXJ5Ijoi44GT44Gu5pa544Gv44Gf44Gg44Gu5L6L44Gn44GZIiwiaWNvbiI6WyJodHRwczovL2tlbnpvaXNoaWkuZXhhbXBsZS5jb20vaW1hZ2UvMTY1OTg3YWtscmU0Il19fQ.UZ6CHaJ43KMUvc-3J91fAsKeZVCQdodBnj_6439fHHuH8xlSAWv-naZGpfADakzBXKAOwlkTLzm83EXY2AioxvB8IB4zciFN6_NsNYODjaoMPTCclJLxaTpCgppdu_iR", "verified": { "protectedHeader": { "iss": "did:jwk:eyJrdHkiOiJFQyIsImNydiI6IlAtMzg0IiwiYWxnIjoiRVMzODQiLCJ4IjoiOWpzRlJWVmpxSlk1Skl5SnI1OGdFQnVyamtzakxwTUJvWVZDZTZlMEJ6UzhBUzNMQXlyN3hLeFNnUE9pUGNHTSIsInkiOiJidHRMX2ZVa3Rkci1MaHhNY3pJaml0ZFpWcG9paXppUGlnOG1nODFidGVUUm0zQmpaLWw4dU5qdkpLYWtnUjNCIn0", @@ -22,7 +22,7 @@ "https://www.w3.org/2018/credentials/v1", "https://www.w3.org/ns/activitystreams" ], - "id": "urn:uuid:49df89b4-7662-418e-b23b-fbefe821fb0d", + "id": "urn:uuid:c677fca9-c955-413c-aef3-4a38d53302a9", "type": [ "VerifiableCredential", "ActivityPubActorCard" From 2c8fa719b9d07827b9557ebfa2567af693e32808 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Fri, 20 Oct 2023 21:41:54 +0900 Subject: [PATCH 06/20] feat: fix syntax in document --- .../schemas/credentials/EInvoiceCredential.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index b21cf8104..ca43ac435 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -197,9 +197,8 @@ properties: additionalProperties: false required: - type - - linkedDocuments + - relatedDocuments - buyer - - consignee type: object properties: type: @@ -350,9 +349,13 @@ properties: title: Items Shipped description: Itemized list of shipped goods. type: array + minItems: 1 + maxItems: 1000 items: type: object - additionalProperties: false + additionalProperties: false + required: + - type properties: type: type: array @@ -400,11 +403,8 @@ properties: - kilogram - tonne - pounds - additionalProperties: false - required: - - type - minItems: 1 - maxItems: 1000 + + shipment: title: Shipment description: Details about the shipment being made @@ -541,6 +541,8 @@ properties: - type minItems: 0 maxItems: 1 + + proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model From 02af96ddb118c9fd248c0cabbe245102a993210b Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Sat, 21 Oct 2023 01:08:56 +0900 Subject: [PATCH 07/20] feat: add payment information to schema --- .../credentials/EInvoiceCredential.yml | 143 +++++++++++++++++- 1 file changed, 140 insertions(+), 3 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index ca43ac435..d23d3d4e5 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -199,6 +199,8 @@ properties: - type - relatedDocuments - buyer + - shipment + - payment type: object properties: type: @@ -242,6 +244,7 @@ properties: - PackingList - BillOfLading - CertificationOfOrigin + - LetterOfCredit buyer: title: Buyer description: Importer of record. Party placing the order or paying the invoice. @@ -385,6 +388,10 @@ properties: The offer price of a product, or of a price component when attached to PriceSpecification and its subtypes. type: number + count: + title: Count + description: The number of products included in the line item + type: number priceCurrency: title: Price Currency description: >- @@ -403,8 +410,6 @@ properties: - kilogram - tonne - pounds - - shipment: title: Shipment description: Details about the shipment being made @@ -434,6 +439,14 @@ properties: title: Shipment Method description: The method in which the goods in the invoice are being shipped type: string + freightCost: + title: Freight Cost + description: Included cost of freight + type: number + freightCostCurrency: + title: Frieght Cost Currency + description: Currency in which frieght cost is calculated + type: string shipTo: title: Ship To (optional) description: The organization of the party receiving the products (consignee) and their address if different from the buyer @@ -542,7 +555,104 @@ properties: minItems: 0 maxItems: 1 - + payment: + title: Payment + description: Information about payment + type: object + properties: + type: + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Payment + default: + - Payment + items: + type: string + enum: + - Payment + termsOfPayment: + title: Terms of Payment + description: Terms, conditions, and currency of settlement, as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order, and/or the letter of credit. + type: string + payTo: + title: Pay To + description: Information about the account in which to deposit the funds + type: string + currencyOfSettlement: + title: Terms of Settlement + description: Currency agreed upon between seller and buyer as payment. + type: string + totalDue: + title: Price + description: The total sum of the invoice due + type: number + invoiceSubtotal: + title: Invoice Subtotal + description: The subtotal of line items. + type: object + additionalProperties: false + required: + - type + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + discounts: + title: Discounts (optional) + description: Reductions in price applied to the subtotal + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Discount + default: + - Discount + items: + type: string + enum: + - Discount + appliedTo: + title: Applied To + description: Defines if the discount is applied to a specific product or the subtotal + type: string + discount: + title: Discount + description: The percent or currency amount the above is reduced by + type: string + reason: + title: Reason + description: The reason the discount was applied + type: string proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model @@ -668,6 +778,7 @@ example: |- "description": "Round Rebar used for Construction", "productIdentifier": "rn19082-a", "price": 1000, + "count": 5, "priceCurrency": "USD", "netWeight": 1, "netWeightUnit": "tonne" @@ -679,6 +790,8 @@ example: |- ], "termsOfDelivery": "full payment before shipment", "shipmentMethod": "Tailer No. 53103", + "freightCost": 200, + "freightCostCurrency": "USD", "shipTo": [ { "type": [ @@ -703,6 +816,30 @@ example: |- } } ] + }, + "payment": { + "type": [ + "Payment" + ], + "termsOfPayment": "Payment made to bank account within 30 days of invoice", + "payTo": "Example Bank Acct. 1234567 Routing Number 123456789", + "currencyOfSettlement": "USD", + "totalDue": 4700, + "invoiceSubtotal": { + "type": [ + "PriceSpecification" + ], + "price": 5000, + "priceCurrency": "USD", + "discounts": [ + { + "type": ["Discount"], + "appliedTo": "subtotal", + "discount": "10%", + "reason": "First time customer" + } + ] + } } }, "credentialSchema": { From 06fa087be4a3d54821ede2a551de7be9a761ed98 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Tue, 24 Oct 2023 22:38:52 +0900 Subject: [PATCH 08/20] feat: add payment information --- .../credentials/EInvoiceCredential.yml | 159 +++++++++++++++++- 1 file changed, 155 insertions(+), 4 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index d23d3d4e5..6bf125f87 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -214,6 +214,10 @@ properties: type: string enum: - Invoice + taxIdNumber: + title: Tax Id Number + description: Tax Id for Documents such as SAT + type: string relatedDocuments: title: Documents Linked or Referenced description: References to other documents which can be used to support the claims of the current document @@ -231,10 +235,6 @@ properties: type: const: LinkedDocument default: LinkedDocument - documentId: - title: Document Identifier - description: The Identifier of the document being referenced - type: string documentType: title: Document Type description: The type of the document being referenced @@ -245,6 +245,12 @@ properties: - BillOfLading - CertificationOfOrigin - LetterOfCredit + - ProFormaInvoice + - Other + documentId: + title: Document Identifier + description: The Identifier of the document being referenced + type: string buyer: title: Buyer description: Importer of record. Party placing the order or paying the invoice. @@ -382,6 +388,10 @@ properties: title: Product Identifier description: The product identifier, such as ISBN. type: string + batchNumber: + title: Batch Number + description: A tracking number for commodities + type: string price: title: Price description: >- @@ -623,6 +633,147 @@ properties: The currency of the price, or a price component when attached to PriceSpecification and its subtypes. type: string + paymentDetails: + title: Payment Details (optional) + description: Information on the payment details to the beneficiary + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - PaymentDetails + default: + - PaymentDetails + items: + type: string + enum: + - PaymentDetails + beneficiaryName: + title: Beneficiary Name + description: Name of the Beneficiary + type: string + beneficiaryAddress: + title: Beneficiary Address + description: The postal address of the Beneficiary + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + additionalProperties: false + required: + - type + bankName: + title: Bank Name + description: Name of the bank + type: string + bankAddress: + title: Bank Address + description: The postal address of the bank + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + additionalProperties: false + required: + - type + transitNumber: + title: Transit Number + description: A nine-digit number that helps financial institutions identify what institution issued checks or other documents financial documents + type: string + institutionNumber: + title: Institution Number + description: A unique code assigned to a certain bank or financial institution to identify them + type: string + accountNumber: + title: Account Number + description: The account number of the beneficiary at the bank + type: string + swiftCode: + title: Swift Code + description: Swift code for the financial institution + type: string + routingNumber: + title: Routing Number + description: Routing Number for the institution + type: string + additionalProperties: false + required: + - type + minItems: 0 + maxItems: 1 discounts: title: Discounts (optional) description: Reductions in price applied to the subtotal From 1688a7cf44d57593545c5d67087ef95e48018272 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 02:14:24 +0900 Subject: [PATCH 09/20] fix: update example to fill schema --- .../credentials/EInvoiceCredential.yml | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 6bf125f87..3c7f23f1e 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -990,7 +990,39 @@ example: |- "reason": "First time customer" } ] - } + }, + "paymentDetails" : [ + { + "type":["PaymentDetails"], + "beneficiaryName": "American Prime Steel Inc.", + "beneficiaryAddress": { + "type": [ + "PostalAddress" + ], + "streetAddress": "1551 Keebler Knoll", + "addressLocality": "Vivianeburgh", + "addressRegion": "Oregon", + "postalCode": "47090", + "addressCountry": "US" + }, + "bankName": "Example Bank", + "bankAddress": { + "type": [ + "PostalAddress" + ], + "streetAddress": "17101 SW SUGAR PLUM LN", + "addressLocality": "BEAVERTON", + "addressRegion": "Oregon", + "postalCode": "97007", + "addressCountry": "US" + }, + "transitNumber": "123456789", + "institutionNumber": "000", + "accountNumber": "123456789", + "swiftCode": "AAAA-BB-CC-123", + "routingNumber": "123456789" + } + ] } }, "credentialSchema": { From 687aea5e2b0c83dc84df93b2aae5a4fc13a2b1e4 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 05:28:43 +0900 Subject: [PATCH 10/20] debug: remove required type for array --- .../schemas/credentials/EInvoiceCredential.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 3c7f23f1e..092432ae0 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -564,7 +564,6 @@ properties: - type minItems: 0 maxItems: 1 - payment: title: Payment description: Information about payment @@ -659,6 +658,9 @@ properties: title: Beneficiary Address description: The postal address of the Beneficiary type: object + additionalProperties: false + required: + - type properties: type: type: array @@ -697,9 +699,6 @@ properties: title: Postal Code description: Text specifying the postal code for an address. type: string - additionalProperties: false - required: - - type bankName: title: Bank Name description: Name of the bank @@ -708,6 +707,9 @@ properties: title: Bank Address description: The postal address of the bank type: object + additionalProperties: false + required: + - type properties: type: type: array @@ -746,9 +748,6 @@ properties: title: Postal Code description: Text specifying the postal code for an address. type: string - additionalProperties: false - required: - - type transitNumber: title: Transit Number description: A nine-digit number that helps financial institutions identify what institution issued checks or other documents financial documents @@ -769,9 +768,6 @@ properties: title: Routing Number description: Routing Number for the institution type: string - additionalProperties: false - required: - - type minItems: 0 maxItems: 1 discounts: @@ -846,6 +842,7 @@ example: |- "CommercialInvoiceCredential" ], "id": "urn:uuid:5e45f155-c949-4005-a7e5-26ni58b6a59a", + "taxIdNumber": "88800012345", "issuanceDate": "2022-02-23T11:55:00Z", "issuer": { "type": [ @@ -928,6 +925,7 @@ example: |- "name": "Rebar", "description": "Round Rebar used for Construction", "productIdentifier": "rn19082-a", + "batchNumber": "010", "price": 1000, "count": 5, "priceCurrency": "USD", From e24cacb52a06ce2c9c9c3c7157775d0b8cf1c11f Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 05:32:35 +0900 Subject: [PATCH 11/20] fix: tax id number location --- .../components/schemas/credentials/EInvoiceCredential.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 092432ae0..b3ae400cb 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -842,7 +842,6 @@ example: |- "CommercialInvoiceCredential" ], "id": "urn:uuid:5e45f155-c949-4005-a7e5-26ni58b6a59a", - "taxIdNumber": "88800012345", "issuanceDate": "2022-02-23T11:55:00Z", "issuer": { "type": [ @@ -880,6 +879,7 @@ example: |- "type": [ "Invoice" ], + "taxIdNumber": "88800012345", "relatedDocuments" : [ { "type": "LinkedDocument", From 73b91f40eacca9e3a08d0a866dc13b7a76f77412 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 13:33:55 +0900 Subject: [PATCH 12/20] fix: go back to safety --- .../credentials/EInvoiceCredential.yml | 193 +----------------- 1 file changed, 6 insertions(+), 187 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index b3ae400cb..d23d3d4e5 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -214,10 +214,6 @@ properties: type: string enum: - Invoice - taxIdNumber: - title: Tax Id Number - description: Tax Id for Documents such as SAT - type: string relatedDocuments: title: Documents Linked or Referenced description: References to other documents which can be used to support the claims of the current document @@ -235,6 +231,10 @@ properties: type: const: LinkedDocument default: LinkedDocument + documentId: + title: Document Identifier + description: The Identifier of the document being referenced + type: string documentType: title: Document Type description: The type of the document being referenced @@ -245,12 +245,6 @@ properties: - BillOfLading - CertificationOfOrigin - LetterOfCredit - - ProFormaInvoice - - Other - documentId: - title: Document Identifier - description: The Identifier of the document being referenced - type: string buyer: title: Buyer description: Importer of record. Party placing the order or paying the invoice. @@ -388,10 +382,6 @@ properties: title: Product Identifier description: The product identifier, such as ISBN. type: string - batchNumber: - title: Batch Number - description: A tracking number for commodities - type: string price: title: Price description: >- @@ -564,6 +554,7 @@ properties: - type minItems: 0 maxItems: 1 + payment: title: Payment description: Information about payment @@ -632,144 +623,6 @@ properties: The currency of the price, or a price component when attached to PriceSpecification and its subtypes. type: string - paymentDetails: - title: Payment Details (optional) - description: Information on the payment details to the beneficiary - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - PaymentDetails - default: - - PaymentDetails - items: - type: string - enum: - - PaymentDetails - beneficiaryName: - title: Beneficiary Name - description: Name of the Beneficiary - type: string - beneficiaryAddress: - title: Beneficiary Address - description: The postal address of the Beneficiary - type: object - additionalProperties: false - required: - - type - properties: - type: - type: array - readOnly: true - const: - - PostalAddress - default: - - PostalAddress - items: - type: string - enum: - - PostalAddress - streetAddress: - title: Street Address - description: >- - The street address expressed as free form text. The street address is - printed on paper as the first lines below the name. For example, the name - of the street and the number in the street or the name of a building. - type: string - addressLocality: - title: Address Locality - description: Text specifying the name of the locality; for example, a city. - type: string - addressRegion: - title: Address Region - description: >- - Text specifying a province or state in abbreviated format; for example, - NJ. - type: string - addressCountry: - title: Address Country - description: >- - The two-letter ISO 3166-1 alpha-2 country code. - type: string - postalCode: - title: Postal Code - description: Text specifying the postal code for an address. - type: string - bankName: - title: Bank Name - description: Name of the bank - type: string - bankAddress: - title: Bank Address - description: The postal address of the bank - type: object - additionalProperties: false - required: - - type - properties: - type: - type: array - readOnly: true - const: - - PostalAddress - default: - - PostalAddress - items: - type: string - enum: - - PostalAddress - streetAddress: - title: Street Address - description: >- - The street address expressed as free form text. The street address is - printed on paper as the first lines below the name. For example, the name - of the street and the number in the street or the name of a building. - type: string - addressLocality: - title: Address Locality - description: Text specifying the name of the locality; for example, a city. - type: string - addressRegion: - title: Address Region - description: >- - Text specifying a province or state in abbreviated format; for example, - NJ. - type: string - addressCountry: - title: Address Country - description: >- - The two-letter ISO 3166-1 alpha-2 country code. - type: string - postalCode: - title: Postal Code - description: Text specifying the postal code for an address. - type: string - transitNumber: - title: Transit Number - description: A nine-digit number that helps financial institutions identify what institution issued checks or other documents financial documents - type: string - institutionNumber: - title: Institution Number - description: A unique code assigned to a certain bank or financial institution to identify them - type: string - accountNumber: - title: Account Number - description: The account number of the beneficiary at the bank - type: string - swiftCode: - title: Swift Code - description: Swift code for the financial institution - type: string - routingNumber: - title: Routing Number - description: Routing Number for the institution - type: string - minItems: 0 - maxItems: 1 discounts: title: Discounts (optional) description: Reductions in price applied to the subtotal @@ -879,7 +732,6 @@ example: |- "type": [ "Invoice" ], - "taxIdNumber": "88800012345", "relatedDocuments" : [ { "type": "LinkedDocument", @@ -925,7 +777,6 @@ example: |- "name": "Rebar", "description": "Round Rebar used for Construction", "productIdentifier": "rn19082-a", - "batchNumber": "010", "price": 1000, "count": 5, "priceCurrency": "USD", @@ -988,39 +839,7 @@ example: |- "reason": "First time customer" } ] - }, - "paymentDetails" : [ - { - "type":["PaymentDetails"], - "beneficiaryName": "American Prime Steel Inc.", - "beneficiaryAddress": { - "type": [ - "PostalAddress" - ], - "streetAddress": "1551 Keebler Knoll", - "addressLocality": "Vivianeburgh", - "addressRegion": "Oregon", - "postalCode": "47090", - "addressCountry": "US" - }, - "bankName": "Example Bank", - "bankAddress": { - "type": [ - "PostalAddress" - ], - "streetAddress": "17101 SW SUGAR PLUM LN", - "addressLocality": "BEAVERTON", - "addressRegion": "Oregon", - "postalCode": "97007", - "addressCountry": "US" - }, - "transitNumber": "123456789", - "institutionNumber": "000", - "accountNumber": "123456789", - "swiftCode": "AAAA-BB-CC-123", - "routingNumber": "123456789" - } - ] + } } }, "credentialSchema": { From 48bcaa75bfff6fcdda25ea8f5e4dd90cd33f0ece Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 13:41:02 +0900 Subject: [PATCH 13/20] debug: is anything working --- .../credentials/EInvoiceCredential.yml | 554 +----------------- 1 file changed, 1 insertion(+), 553 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index d23d3d4e5..4b111a64c 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -197,10 +197,6 @@ properties: additionalProperties: false required: - type - - relatedDocuments - - buyer - - shipment - - payment type: object properties: type: @@ -214,445 +210,6 @@ properties: type: string enum: - Invoice - relatedDocuments: - title: Documents Linked or Referenced - description: References to other documents which can be used to support the claims of the current document - type: array - minItems: 0 - maxItems: 10 - items: - type: object - additionalProperties: false - required: - - type - - documentId - - documentType - properties: - type: - const: LinkedDocument - default: LinkedDocument - documentId: - title: Document Identifier - description: The Identifier of the document being referenced - type: string - documentType: - title: Document Type - description: The type of the document being referenced - enum: - - MillTestReport - - PurchaseOrder - - PackingList - - BillOfLading - - CertificationOfOrigin - - LetterOfCredit - buyer: - title: Buyer - description: Importer of record. Party placing the order or paying the invoice. - additionalProperties: false - required: - - type - type: object - properties: - type: - type: array - readOnly: true - const: - - Organization - default: - - Organization - items: - type: string - enum: - - Organization - id: - title: Identifier - description: Identifier for the buyer - type: string - name: - title: Name - description: Name of the buyer - type: string - url: - title: URL - description: URL of the buyer - type: string - email: - title: Email Address - description: Buyer's primary email address. - type: string - phoneNumber: - title: Phone Number - description: Buyer's contact phone number. - type: string - location: - title: Location - description: Buyer's physical location, such as address or coordinates. - additionalProperties: false - required: - - type - type: object - properties: - type: - type: array - readOnly: true - const: - - Place - default: - - Place - items: - type: string - enum: - - Place - address: - title: Postal Address - description: The postal address for an organization or place. - additionalProperties: false - required: - - type - type: object - properties: - type: - type: array - readOnly: true - const: - - PostalAddress - default: - - PostalAddress - items: - type: string - enum: - - PostalAddress - streetAddress: - title: Street Address - description: >- - The street address expressed as free form text. The street address is - printed on paper as the first lines below the name. For example, the name - of the street and the number in the street or the name of a building. - type: string - addressLocality: - title: Address Locality - description: Text specifying the name of the locality; for example, a city. - type: string - addressRegion: - title: Address Region - description: >- - Text specifying a province or state in abbreviated format; for example, - NJ. - type: string - postalCode: - title: Postal Code - description: Text specifying the postal code for an address. - type: string - addressCountry: - title: Address Country - description: >- - The two-letter ISO 3166-1 alpha-2 country code. - type: string - itemsShipped: - title: Items Shipped - description: Itemized list of shipped goods. - type: array - minItems: 1 - maxItems: 1000 - items: - type: object - additionalProperties: false - required: - - type - properties: - type: - type: array - readOnly: true - const: - - TradeLineItem - default: - - TradeLineItem - items: - type: string - enum: - - TradeLineItem - name: - title: Name - description: Name of the Tradeline item. - type: string - description: - title: Description of product - type: string - productIdentifier: - title: Product Identifier - description: The product identifier, such as ISBN. - type: string - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - count: - title: Count - description: The number of products included in the line item - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - netWeight: - title: Trade Line Item Net Weight - description: A measure of the net weight (mass). - type: number - netWeightUnit: - title: Net Weight Unit - description: Unit of measurement for Mass - enum: - - gram - - kilogram - - tonne - - pounds - shipment: - title: Shipment - description: Details about the shipment being made - type: object - properties: - type: - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - Shipment - default: - - Shipment - items: - type: string - enum: - - Shipment - termsOfDelivery: - title: Terms of Delivery - description: The conditions agreed upon between the parties with regard to the delivery of goods and or services. - type: string - shipmentMethod: - title: Shipment Method - description: The method in which the goods in the invoice are being shipped - type: string - freightCost: - title: Freight Cost - description: Included cost of freight - type: number - freightCostCurrency: - title: Frieght Cost Currency - description: Currency in which frieght cost is calculated - type: string - shipTo: - title: Ship To (optional) - description: The organization of the party receiving the products (consignee) and their address if different from the buyer - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - Organization - default: - - Organization - items: - type: string - enum: - - Organization - id: - title: Identifier - description: Identifier for the consginee. - type: string - name: - title: Name - description: Name of the consginee. - type: string - url: - title: URL - description: URL of the consignee. - type: string - email: - title: Email Address - description: Consignee's primary email address. - type: string - phoneNumber: - title: Phone Number - description: Consignee's contact phone number. - type: string - location: - title: Location - description: Consignee's physical location, such as address or coordinates. - type: object - properties: - type: - type: array - readOnly: true - const: - - Place - default: - - Place - items: - type: string - enum: - - Place - address: - title: Postal Address - description: The postal address for an organization or place. - type: object - properties: - type: - type: array - readOnly: true - const: - - PostalAddress - default: - - PostalAddress - items: - type: string - enum: - - PostalAddress - streetAddress: - title: Street Address - description: >- - The street address expressed as free form text. The street address is - printed on paper as the first lines below the name. For example, the name - of the street and the number in the street or the name of a building. - type: string - addressLocality: - title: Address Locality - description: Text specifying the name of the locality; for example, a city. - type: string - addressRegion: - title: Address Region - description: >- - Text specifying a province or state in abbreviated format; for example, - NJ. - type: string - addressCountry: - title: Address Country - description: >- - The two-letter ISO 3166-1 alpha-2 country code. - type: string - postalCode: - title: Postal Code - description: Text specifying the postal code for an address. - type: string - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - additionalProperties: false - required: - - type - minItems: 0 - maxItems: 1 - - payment: - title: Payment - description: Information about payment - type: object - properties: - type: - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - Payment - default: - - Payment - items: - type: string - enum: - - Payment - termsOfPayment: - title: Terms of Payment - description: Terms, conditions, and currency of settlement, as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order, and/or the letter of credit. - type: string - payTo: - title: Pay To - description: Information about the account in which to deposit the funds - type: string - currencyOfSettlement: - title: Terms of Settlement - description: Currency agreed upon between seller and buyer as payment. - type: string - totalDue: - title: Price - description: The total sum of the invoice due - type: number - invoiceSubtotal: - title: Invoice Subtotal - description: The subtotal of line items. - type: object - additionalProperties: false - required: - - type - properties: - type: - type: array - readOnly: true - const: - - PriceSpecification - default: - - PriceSpecification - items: - type: string - enum: - - PriceSpecification - price: - title: Price - description: >- - The offer price of a product, or of a price component when attached to - PriceSpecification and its subtypes. - type: number - priceCurrency: - title: Price Currency - description: >- - The currency of the price, or a price component when attached to - PriceSpecification and its subtypes. - type: string - discounts: - title: Discounts (optional) - description: Reductions in price applied to the subtotal - type: array - items: - type: object - properties: - type: - type: array - readOnly: true - const: - - Discount - default: - - Discount - items: - type: string - enum: - - Discount - appliedTo: - title: Applied To - description: Defines if the discount is applied to a specific product or the subtotal - type: string - discount: - title: Discount - description: The percent or currency amount the above is reduced by - type: string - reason: - title: Reason - description: The reason the discount was applied - type: string proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model @@ -731,116 +288,7 @@ example: |- "credentialSubject": { "type": [ "Invoice" - ], - "relatedDocuments" : [ - { - "type": "LinkedDocument", - "documentId": "a5d1ca6c-2c06-4039-9ff9-a75d7a695c8d", - "documentType": "PurchaseOrder" - }, - { - "type": "LinkedDocument", - "documentId": "63153", - "documentType": "MillTestReport" - }, - { - "type": "LinkedDocument", - "documentId": "63153", - "documentType": "CertificationOfOrigin" - } - ], - "buyer": { - "type": [ - "Organization" - ], - "id": "did:web:generic-motors.example.com", - "name": "Generic Motors of America", - "location": { - "type": [ - "Place" - ], - "address": { - "type": [ - "PostalAddress" - ], - "streetAddress": "12 Generic Motors Dr", - "addressLocality": "Detroit", - "addressRegion": "Michigan", - "postalCode": "48232-5170", - "addressCountry": "US" - } - } - }, - "itemsShipped" : [ - { - "type": ["TradeLineItem"], - "name": "Rebar", - "description": "Round Rebar used for Construction", - "productIdentifier": "rn19082-a", - "price": 1000, - "count": 5, - "priceCurrency": "USD", - "netWeight": 1, - "netWeightUnit": "tonne" - } - ], - "shipment": { - "type" : [ - "Shipment" - ], - "termsOfDelivery": "full payment before shipment", - "shipmentMethod": "Tailer No. 53103", - "freightCost": 200, - "freightCostCurrency": "USD", - "shipTo": [ - { - "type": [ - "Organization" - ], - "id": "did:web:generic-motors.example.com", - "name": "Generic Motors of America", - "location": { - "type": [ - "Place" - ], - "address": { - "type": [ - "PostalAddress" - ], - "streetAddress": "12 Generic Motors Dr", - "addressLocality": "Detroit", - "addressRegion": "Michigan", - "postalCode": "48232-5170", - "addressCountry": "US" - } - } - } - ] - }, - "payment": { - "type": [ - "Payment" - ], - "termsOfPayment": "Payment made to bank account within 30 days of invoice", - "payTo": "Example Bank Acct. 1234567 Routing Number 123456789", - "currencyOfSettlement": "USD", - "totalDue": 4700, - "invoiceSubtotal": { - "type": [ - "PriceSpecification" - ], - "price": 5000, - "priceCurrency": "USD", - "discounts": [ - { - "type": ["Discount"], - "appliedTo": "subtotal", - "discount": "10%", - "reason": "First time customer" - } - ] - } - } + ] }, "credentialSchema": { "id": "https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml", From 2937f3aad6d1f431395a1a52dc4ee1d945b33caa Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 13:43:55 +0900 Subject: [PATCH 14/20] fix: finally find the bug --- .../components/schemas/credentials/EInvoiceCredential.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 4b111a64c..28aa47dad 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -249,7 +249,7 @@ example: |- ], "type": [ "VerifiableCredential", - "CommercialInvoiceCredential" + "EInvoiceCredential" ], "id": "urn:uuid:5e45f155-c949-4005-a7e5-26ni58b6a59a", "issuanceDate": "2022-02-23T11:55:00Z", From 90d8b43e857be9a65ba366db857902a662b99255 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 13:47:09 +0900 Subject: [PATCH 15/20] feat: adding in payment details --- .../credentials/EInvoiceCredential.yml | 735 +++++++++++++++++- 1 file changed, 734 insertions(+), 1 deletion(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 28aa47dad..57cd88854 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -197,6 +197,10 @@ properties: additionalProperties: false required: - type + - relatedDocuments + - buyer + - shipment + - payment type: object properties: type: @@ -210,6 +214,592 @@ properties: type: string enum: - Invoice + taxIdNumber: + title: Tax Id Number + description: Tax Id for Documents such as SAT + type: string + relatedDocuments: + title: Documents Linked or Referenced + description: References to other documents which can be used to support the claims of the current document + type: array + minItems: 0 + maxItems: 10 + items: + type: object + additionalProperties: false + required: + - type + - documentId + - documentType + properties: + type: + const: LinkedDocument + default: LinkedDocument + documentType: + title: Document Type + description: The type of the document being referenced + enum: + - MillTestReport + - PurchaseOrder + - PackingList + - BillOfLading + - CertificationOfOrigin + - LetterOfCredit + - ProFormaInvoice + - Other + documentId: + title: Document Identifier + description: The Identifier of the document being referenced + type: string + buyer: + title: Buyer + description: Importer of record. Party placing the order or paying the invoice. + additionalProperties: false + required: + - type + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier for the buyer + type: string + name: + title: Name + description: Name of the buyer + type: string + url: + title: URL + description: URL of the buyer + type: string + email: + title: Email Address + description: Buyer's primary email address. + type: string + phoneNumber: + title: Phone Number + description: Buyer's contact phone number. + type: string + location: + title: Location + description: Buyer's physical location, such as address or coordinates. + additionalProperties: false + required: + - type + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + address: + title: Postal Address + description: The postal address for an organization or place. + additionalProperties: false + required: + - type + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + itemsShipped: + title: Items Shipped + description: Itemized list of shipped goods. + type: array + minItems: 1 + maxItems: 1000 + items: + type: object + additionalProperties: false + required: + - type + properties: + type: + type: array + readOnly: true + const: + - TradeLineItem + default: + - TradeLineItem + items: + type: string + enum: + - TradeLineItem + name: + title: Name + description: Name of the Tradeline item. + type: string + description: + title: Description of product + type: string + productIdentifier: + title: Product Identifier + description: The product identifier, such as ISBN. + type: string + batchNumber: + title: Batch Number + description: A tracking number for commodities + type: string + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + count: + title: Count + description: The number of products included in the line item + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + netWeight: + title: Trade Line Item Net Weight + description: A measure of the net weight (mass). + type: number + netWeightUnit: + title: Net Weight Unit + description: Unit of measurement for Mass + enum: + - gram + - kilogram + - tonne + - pounds + shipment: + title: Shipment + description: Details about the shipment being made + type: object + properties: + type: + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Shipment + default: + - Shipment + items: + type: string + enum: + - Shipment + termsOfDelivery: + title: Terms of Delivery + description: The conditions agreed upon between the parties with regard to the delivery of goods and or services. + type: string + shipmentMethod: + title: Shipment Method + description: The method in which the goods in the invoice are being shipped + type: string + freightCost: + title: Freight Cost + description: Included cost of freight + type: number + freightCostCurrency: + title: Frieght Cost Currency + description: Currency in which frieght cost is calculated + type: string + shipTo: + title: Ship To (optional) + description: The organization of the party receiving the products (consignee) and their address if different from the buyer + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Organization + default: + - Organization + items: + type: string + enum: + - Organization + id: + title: Identifier + description: Identifier for the consginee. + type: string + name: + title: Name + description: Name of the consginee. + type: string + url: + title: URL + description: URL of the consignee. + type: string + email: + title: Email Address + description: Consignee's primary email address. + type: string + phoneNumber: + title: Phone Number + description: Consignee's contact phone number. + type: string + location: + title: Location + description: Consignee's physical location, such as address or coordinates. + type: object + properties: + type: + type: array + readOnly: true + const: + - Place + default: + - Place + items: + type: string + enum: + - Place + address: + title: Postal Address + description: The postal address for an organization or place. + type: object + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + additionalProperties: false + required: + - type + minItems: 0 + maxItems: 1 + payment: + title: Payment + description: Information about payment + type: object + properties: + type: + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Payment + default: + - Payment + items: + type: string + enum: + - Payment + termsOfPayment: + title: Terms of Payment + description: Terms, conditions, and currency of settlement, as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order, and/or the letter of credit. + type: string + payTo: + title: Pay To + description: Information about the account in which to deposit the funds + type: string + currencyOfSettlement: + title: Terms of Settlement + description: Currency agreed upon between seller and buyer as payment. + type: string + totalDue: + title: Price + description: The total sum of the invoice due + type: number + invoiceSubtotal: + title: Invoice Subtotal + description: The subtotal of line items. + type: object + additionalProperties: false + required: + - type + properties: + type: + type: array + readOnly: true + const: + - PriceSpecification + default: + - PriceSpecification + items: + type: string + enum: + - PriceSpecification + price: + title: Price + description: >- + The offer price of a product, or of a price component when attached to + PriceSpecification and its subtypes. + type: number + priceCurrency: + title: Price Currency + description: >- + The currency of the price, or a price component when attached to + PriceSpecification and its subtypes. + type: string + paymentDetails: + title: Payment Details (optional) + description: Information on the payment details to the beneficiary + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - PaymentDetails + default: + - PaymentDetails + items: + type: string + enum: + - PaymentDetails + beneficiaryName: + title: Beneficiary Name + description: Name of the Beneficiary + type: string + beneficiaryAddress: + title: Beneficiary Address + description: The postal address of the Beneficiary + type: object + additionalProperties: false + required: + - type + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + bankName: + title: Bank Name + description: Name of the bank + type: string + bankAddress: + title: Bank Address + description: The postal address of the bank + type: object + additionalProperties: false + required: + - type + properties: + type: + type: array + readOnly: true + const: + - PostalAddress + default: + - PostalAddress + items: + type: string + enum: + - PostalAddress + streetAddress: + title: Street Address + description: >- + The street address expressed as free form text. The street address is + printed on paper as the first lines below the name. For example, the name + of the street and the number in the street or the name of a building. + type: string + addressLocality: + title: Address Locality + description: Text specifying the name of the locality; for example, a city. + type: string + addressRegion: + title: Address Region + description: >- + Text specifying a province or state in abbreviated format; for example, + NJ. + type: string + addressCountry: + title: Address Country + description: >- + The two-letter ISO 3166-1 alpha-2 country code. + type: string + postalCode: + title: Postal Code + description: Text specifying the postal code for an address. + type: string + transitNumber: + title: Transit Number + description: A nine-digit number that helps financial institutions identify what institution issued checks or other documents financial documents + type: string + institutionNumber: + title: Institution Number + description: A unique code assigned to a certain bank or financial institution to identify them + type: string + accountNumber: + title: Account Number + description: The account number of the beneficiary at the bank + type: string + swiftCode: + title: Swift Code + description: Swift code for the financial institution + type: string + routingNumber: + title: Routing Number + description: Routing Number for the institution + type: string + minItems: 0 + maxItems: 1 + discounts: + title: Discounts (optional) + description: Reductions in price applied to the subtotal + type: array + items: + type: object + properties: + type: + type: array + readOnly: true + const: + - Discount + default: + - Discount + items: + type: string + enum: + - Discount + appliedTo: + title: Applied To + description: Defines if the discount is applied to a specific product or the subtotal + type: string + discount: + title: Discount + description: The percent or currency amount the above is reduced by + type: string + reason: + title: Reason + description: The reason the discount was applied + type: string proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model @@ -288,7 +878,150 @@ example: |- "credentialSubject": { "type": [ "Invoice" - ] + ], + "taxIdNumber": "88800012345", + "relatedDocuments" : [ + { + "type": "LinkedDocument", + "documentId": "a5d1ca6c-2c06-4039-9ff9-a75d7a695c8d", + "documentType": "PurchaseOrder" + }, + { + "type": "LinkedDocument", + "documentId": "63153", + "documentType": "MillTestReport" + }, + { + "type": "LinkedDocument", + "documentId": "63153", + "documentType": "CertificationOfOrigin" + } + ], + "buyer": { + "type": [ + "Organization" + ], + "id": "did:web:generic-motors.example.com", + "name": "Generic Motors of America", + "location": { + "type": [ + "Place" + ], + "address": { + "type": [ + "PostalAddress" + ], + "streetAddress": "12 Generic Motors Dr", + "addressLocality": "Detroit", + "addressRegion": "Michigan", + "postalCode": "48232-5170", + "addressCountry": "US" + } + } + }, + "itemsShipped" : [ + { + "type": ["TradeLineItem"], + "name": "Rebar", + "description": "Round Rebar used for Construction", + "productIdentifier": "rn19082-a", + "batchNumber": "010", + "price": 1000, + "count": 5, + "priceCurrency": "USD", + "netWeight": 1, + "netWeightUnit": "tonne" + } + ], + "shipment": { + "type" : [ + "Shipment" + ], + "termsOfDelivery": "full payment before shipment", + "shipmentMethod": "Tailer No. 53103", + "freightCost": 200, + "freightCostCurrency": "USD", + "shipTo": [ + { + "type": [ + "Organization" + ], + "id": "did:web:generic-motors.example.com", + "name": "Generic Motors of America", + "location": { + "type": [ + "Place" + ], + "address": { + "type": [ + "PostalAddress" + ], + "streetAddress": "12 Generic Motors Dr", + "addressLocality": "Detroit", + "addressRegion": "Michigan", + "postalCode": "48232-5170", + "addressCountry": "US" + } + } + } + ] + }, + "payment": { + "type": [ + "Payment" + ], + "termsOfPayment": "Payment made to bank account within 30 days of invoice", + "payTo": "Example Bank Acct. 1234567 Routing Number 123456789", + "currencyOfSettlement": "USD", + "totalDue": 4700, + "invoiceSubtotal": { + "type": [ + "PriceSpecification" + ], + "price": 5000, + "priceCurrency": "USD", + "discounts": [ + { + "type": ["Discount"], + "appliedTo": "subtotal", + "discount": "10%", + "reason": "First time customer" + } + ] + }, + "paymentDetails" : [ + { + "type":["PaymentDetails"], + "beneficiaryName": "American Prime Steel Inc.", + "beneficiaryAddress": { + "type": [ + "PostalAddress" + ], + "streetAddress": "1551 Keebler Knoll", + "addressLocality": "Vivianeburgh", + "addressRegion": "Oregon", + "postalCode": "47090", + "addressCountry": "US" + }, + "bankName": "Example Bank", + "bankAddress": { + "type": [ + "PostalAddress" + ], + "streetAddress": "17101 SW SUGAR PLUM LN", + "addressLocality": "BEAVERTON", + "addressRegion": "Oregon", + "postalCode": "97007", + "addressCountry": "US" + }, + "transitNumber": "123456789", + "institutionNumber": "000", + "accountNumber": "123456789", + "swiftCode": "AAAA-BB-CC-123", + "routingNumber": "123456789" + } + ] + } }, "credentialSchema": { "id": "https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml", From 23c9b9a0eea448b54b6c94af230cec7a1a7c9788 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 13:55:45 +0900 Subject: [PATCH 16/20] fix: messing up the type array --- .../credentials/EInvoiceCredential.yml | 42 +++++++------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 57cd88854..54f75272f 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -427,20 +427,15 @@ properties: properties: type: type: array + readOnly: true + const: + - Shipment + default: + - Shipment items: - type: object - properties: - type: - type: array - readOnly: true - const: - - Shipment - default: - - Shipment - items: - type: string - enum: - - Shipment + type: string + enum: + - Shipment termsOfDelivery: title: Terms of Delivery description: The conditions agreed upon between the parties with regard to the delivery of goods and or services. @@ -571,20 +566,15 @@ properties: properties: type: type: array + readOnly: true + const: + - Payment + default: + - Payment items: - type: object - properties: - type: - type: array - readOnly: true - const: - - Payment - default: - - Payment - items: - type: string - enum: - - Payment + type: string + enum: + - Payment termsOfPayment: title: Terms of Payment description: Terms, conditions, and currency of settlement, as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order, and/or the letter of credit. From ecda1540f21907e8f551bea3a03762a73ceff04b Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 17:49:11 +0900 Subject: [PATCH 17/20] feat: add currency conversion --- .../schemas/credentials/EInvoiceCredential.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index 54f75272f..d8661c0aa 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -579,14 +579,18 @@ properties: title: Terms of Payment description: Terms, conditions, and currency of settlement, as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order, and/or the letter of credit. type: string - payTo: - title: Pay To - description: Information about the account in which to deposit the funds - type: string currencyOfSettlement: title: Terms of Settlement description: Currency agreed upon between seller and buyer as payment. type: string + localCurrency: + title: Local Currency + description: Currency in the case the requested and local currency are different + type: string + conversionRate: + title: Conversion Rate + description: The rate at which the currency conversion is pegged for the transaction + type: string totalDue: title: Price description: The total sum of the invoice due @@ -961,8 +965,9 @@ example: |- "Payment" ], "termsOfPayment": "Payment made to bank account within 30 days of invoice", - "payTo": "Example Bank Acct. 1234567 Routing Number 123456789", "currencyOfSettlement": "USD", + "localCurrency": "MXN", + "conversionRate": "1 USD = 18.25 MXN", "totalDue": 4700, "invoiceSubtotal": { "type": [ From ee3ba8777a4cda784ef2df8562071773a517bc0d Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 21:22:31 +0900 Subject: [PATCH 18/20] feat: add digital signature section --- .../credentials/EInvoiceCredential.yml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml index d8661c0aa..e50c16476 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml @@ -794,6 +794,29 @@ properties: title: Reason description: The reason the discount was applied type: string + cfdi: + title: Comprobantes Fiscal Digital por Internet + description: Requirements for the CFDI digital certificate standard + type: object + properties: + taxUuid: + title: Tax UUID (folio fiscal) + description: Unique number provided by an authorized PAC that makes an invoice unique and allows the SAT to track the electronic invoice + type: string + digitalSignature: + title: Digital Signature + description: electronic signature key (FIEL) + type: string + digitalCertificate: + title: Digital Cerificate + description: digital stamp (Certificado de Sello Digital – CSD) + type: string + version: + title: Version + description: Version of the CFDI standard being used + default: v4.0 + enum: + - v4.0 proof: title: proof description: A JSON Web Signature proof for a credential as defined by the VC data model From 5a7b840d2b7dfb5d2f49d9ba41c4d26fc6d2ff72 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Wed, 25 Oct 2023 23:18:08 +0900 Subject: [PATCH 19/20] feat: change name to mexico e-invoice cred --- ...ntial.yml => MexicoEInvoiceCredential.yml} | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename docs/openapi/components/schemas/credentials/{EInvoiceCredential.yml => MexicoEInvoiceCredential.yml} (98%) diff --git a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml similarity index 98% rename from docs/openapi/components/schemas/credentials/EInvoiceCredential.yml rename to docs/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml index e50c16476..f7ede9b4e 100644 --- a/docs/openapi/components/schemas/credentials/EInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml @@ -1,7 +1,7 @@ $linkedData: - term: EInvoiceCredential - '@id': https://w3id.org/traceability#EInvoiceCredential -title: e-Invoice Credential + term: MexicoEInvoiceCredential + '@id': https://w3id.org/traceability#MexicoEInvoiceCredential +title: Mexico e-Invoice Credential tags: - Steel description: >- @@ -27,15 +27,15 @@ properties: readOnly: true const: - VerifiableCredential - - EInvoiceCredential + - MexicoEInvoiceCredential default: - VerifiableCredential - - EInvoiceCredential + - MexicoEInvoiceCredential items: type: string enum: - VerifiableCredential - - EInvoiceCredential + - MexicoEInvoiceCredential id: type: string issuanceDate: @@ -184,8 +184,8 @@ properties: description: The url of the schema file to validate the shape of the json object type: string format: uri - example: https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml - default: https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml + example: https://w3id.org/traceability/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml + default: https://w3id.org/traceability/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml readOnly: true type: title: Type @@ -856,7 +856,7 @@ example: |- ], "type": [ "VerifiableCredential", - "EInvoiceCredential" + "MexicoEInvoiceCredential" ], "id": "urn:uuid:5e45f155-c949-4005-a7e5-26ni58b6a59a", "issuanceDate": "2022-02-23T11:55:00Z", @@ -1042,7 +1042,7 @@ example: |- } }, "credentialSchema": { - "id": "https://w3id.org/traceability/openapi/components/schemas/credentials/EInvoiceCredential.yml", + "id": "https://w3id.org/traceability/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml", "type": "OpenApiSpecificationValidator2022" } } \ No newline at end of file From 69dff571a0ba5108700859e6a5dfedb548fb6229 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Thu, 26 Oct 2023 22:16:04 +0900 Subject: [PATCH 20/20] fix: update description --- .../components/schemas/credentials/MexicoEInvoiceCredential.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml b/docs/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml index f7ede9b4e..c2108c39e 100644 --- a/docs/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml +++ b/docs/openapi/components/schemas/credentials/MexicoEInvoiceCredential.yml @@ -5,7 +5,7 @@ title: Mexico e-Invoice Credential tags: - Steel description: >- - Narrowly defined specific invoice for steel + CFDI stands for Digital Fiscal Receipt over the Internet. It is the official electronic invoice format in Mexico and must comply with the requirements established by the SAT (Mexican tax authority). https://edicomgroup.com/electronic-invoicing/mexico type: object properties: '@context':