@logismix/mydata-client
Version:
Greek myDATA (AADE) API client library
336 lines (335 loc) • 12 kB
TypeScript
import { AmountType, CountryType, CurrencyType, ExchangeRateType, FeesType, FuelCodes, InvoiceDetailType, InvoiceType, InvoiceVariationType, OtherTaxesType, // Imported for use in PaymentMethodDetailType definition
QuantityType, SpecialInvoiceCategoryType, StampDutyType, VatExemptionType, VatType, WithheldType } from './simple-types.model';
import { IncomeClassificationType } from './incomeClassification.model';
import { ExpensesClassificationType } from './expensesClassification.model';
import { PaymentMethodDetailType } from './paymentMethods.model';
export interface AadeBookInvoiceDocType {
InvoicesDoc: {
invoice: AadeBookInvoiceType[];
};
}
/**
* Represents the main AADE Book Invoice structure.
* Corresponds to <inv:AadeBookInvoiceType>
*/
export interface AadeBookInvoiceType {
/** Invoice Identifier (calculated by service) */
uid?: string;
/** Unique Invoice Registration Number (MARK) (assigned by service) */
mark?: number;
/** MARK of the cancellation invoice, if this invoice was cancelled */
cancelledByMark?: number;
/** Provider Authentication String (assigned by service if submitted by provider) */
authenticationCode?: string;
/** Indicator for transmission failure (1, 2 for provider; 3 for ERP) */
transmissionFailure?: 1 | 2 | 3;
/** Issuer details */
issuer?: PartyType;
/** Counterpart (Recipient) details */
counterpart?: PartyType;
/** Invoice header details */
invoiceHeader: InvoiceHeaderType;
/** Payment methods used */
paymentMethods?: PaymentMethods;
/** Invoice line item details */
invoiceDetails: InvoiceRowType[];
/** Tax totals applied to the whole invoice (excluding VAT) */
taxesTotals?: TaxesTotals;
/** Summary of the invoice values */
invoiceSummary: InvoiceSummaryType;
/** URL for the QR Code (generated by service) */
qrCodeUrl?: string;
/** Additional transport details (e.g., change of means) */
otherTransportDetails?: TransportDetailType[];
}
/**
* Represents the invoice header.
* Corresponds to <inv:InvoiceHeaderType>
*/
export interface InvoiceHeaderType {
/** Invoice Series */
series: string;
/** Invoice Sequential Number (AA) */
aa: string;
/** Invoice Issue Date */
issueDate: Date;
/** Invoice Type */
invoiceType: InvoiceType;
/** VAT Payment Suspension indicator */
vatPaymentSuspension?: boolean;
/** Currency code (ISO 4217) */
currency?: CurrencyType;
/** Exchange rate relative to EUR (if currency is not EUR) */
exchangeRate?: ExchangeRateType;
/** List of MARKs of correlated invoices */
correlatedInvoices?: number[];
/** Self-Pricing (Self-Billing) indicator */
selfPricing?: boolean;
/** Dispatch Start Date */
dispatchDate?: Date;
/** Dispatch Start Time */
dispatchTime?: Date;
/** Transport Vehicle Number */
vehicleNumber?: string;
/** Movement Purpose Code */
movePurpose?: number;
/** Fuel invoice indicator */
fuelInvoice?: boolean;
/** Special Invoice Category Code */
specialInvoiceCategory?: SpecialInvoiceCategoryType;
/** Invoice Variation (Deviation) Type Code */
invoiceVariationType?: InvoiceVariationType;
/** Other correlated entities involved */
otherCorrelatedEntities?: EntityType[];
/** Additional general delivery details */
otherDeliveryNoteHeader?: OtherDeliveryNoteHeaderType;
/** Indicates if the invoice also serves as a delivery note */
isDeliveryNote?: boolean;
/** Title for 'Other' movement purpose (if movePurpose = 19) */
otherMovePurposeTitle?: string;
/** Third-Party Collection indicator (for types 8.4, 8.5) */
thirdPartyCollection?: boolean;
/** Multiple Connected MARKs (e.g., for consolidating restaurant orders) */
multipleConnectedMarks?: number[];
/** Table Sequential Number (AA) (for type 8.6) */
tableAA?: string;
/** Indicator for total cancellation of Order Slips (for type 8.6) */
totalCancelDeliveryOrders?: boolean;
}
/**
* Represents a single line item on the invoice.
* Corresponds to <inv:InvoiceRowType>
*/
export interface InvoiceRowType {
/** Line Sequential Number (AA) */
lineNumber: number;
/** Line Type Code (e.g., Fee, Other Tax) */
recType?: RecType;
/** TARIC Code (for delivery notes) */
TaricNo?: string;
/** Item Code (for delivery notes) */
itemCode?: string;
/** Item Description (for delivery notes, tax-free) */
itemDescr?: string;
/** Fuel Code (if fuelInvoice = true) */
fuelCode?: FuelCodes;
/** Quantity */
quantity?: number;
/** Measurement Unit Code */
measurementUnit?: QuantityType;
/** Special Line Marking (Third Party Sales) */
invoiceDetailType?: InvoiceDetailType;
/** Net Value of the line */
netValue: AmountType;
/** VAT Category Code */
vatCategory: VatType;
/** VAT Amount for the line */
vatAmount: AmountType;
/** VAT Exemption Reason Code (if vatCategory is 0% type) */
vatExemptionCategory?: VatExemptionType;
/** Declaration of Activity Details (POL 1177/2018 Art. 27) */
dienergia?: ShipType;
/** VAT Discount Right indicator */
discountOption?: boolean;
/** Withheld Tax Amount */
withheldAmount?: AmountType;
/** Withheld Tax Rate Category Code */
withheldPercentCategory?: WithheldType;
/** Stamp Duty Amount */
stampDutyAmount?: AmountType;
/** Stamp Duty Rate Category Code */
stampDutyPercentCategory?: StampDutyType;
/** Fees Amount */
feesAmount?: AmountType;
/** Fees Rate Category Code */
feesPercentCategory?: FeesType;
/** Other Taxes Rate Category Code */
otherTaxesPercentCategory?: OtherTaxesType;
/** Other Taxes Amount */
otherTaxesAmount?: AmountType;
/** Deductions Amount */
deductionsAmount?: AmountType;
/** Comments specific to this line */
lineComments?: string;
/** Income classifications for this line */
incomeClassification?: IncomeClassificationType[];
/** Expense classifications for this line */
expensesClassification?: ExpensesClassificationType[];
/** Quantity at 15 degrees Celsius (for fuel) */
quantity15?: number;
/** Quantity for 'Other' measurement unit (if measurementUnit = 7) */
otherMeasurementUnitQuantity?: number;
/** Title for 'Other' measurement unit (if measurementUnit = 7) */
otherMeasurementUnitTitle?: string;
/** Indicator of non-participation in VAT (revenue – outflows) */
notVAT195?: boolean;
}
/**
* Represents the summary section of the invoice.
* Corresponds to <inv:InvoiceSummaryType>
*/
export interface InvoiceSummaryType {
/** Total Net Value of the invoice */
totalNetValue: AmountType;
/** Total VAT Amount of the invoice */
totalVatAmount: AmountType;
/** Total Withheld Tax Amount */
totalWithheldAmount: AmountType;
/** Total Fees Amount */
totalFeesAmount: AmountType;
/** Total Stamp Duty Amount */
totalStampDutyAmount: AmountType;
/** Total Other Taxes Amount */
totalOtherTaxesAmount: AmountType;
/** Total Deductions Amount */
totalDeductionsAmount: AmountType;
/** Total Gross Value of the invoice */
totalGrossValue: AmountType;
/** Aggregated income classifications */
incomeClassification?: IncomeClassificationType[];
/** Aggregated expense classifications */
expensesClassification?: ExpensesClassificationType[];
}
/**
* Represents details of a party (issuer or counterpart).
* Corresponds to <inv:PartyType>
*/
export interface PartyType {
/** VAT Number */
vatNumber: string;
/** Country Code (ISO 3166) */
country: CountryType;
/** Branch Number (0 for headquarters or no branch) */
branch: number;
/** Name (only for non-GR entities) */
name?: string;
/** Address details (only for non-GR entities or loading/delivery) */
address?: AddressType;
/** Official Document Number (e.g., passport for Tax-free) */
documentIdNo?: string;
/** Electricity Supply Account Number (for fuel invoices) */
supplyAccountNo?: string;
/** Country Code of Official Document Issue (for Tax-free) */
countryDocumentId?: CountryType;
}
/**
* Represents address details.
* Corresponds to <inv:AddressType>
*/
export interface AddressType {
/** Street Name */
street?: string;
/** Street Number */
number?: string;
/** Postal Code */
postalCode: string;
/** City Name */
city: string;
}
/**
* Represents details related to POL 1177/2018 Art. 27.
* Corresponds to <inv:ShipType>
*/
export interface ShipType {
/** Activity Declaration Number */
applicationId: string;
/** Declaration Date */
applicationDate: Date;
/** Tax Office (DOY) of Declaration */
doy?: string;
/** Ship Details identifier */
shipId: string;
}
/**
* Represents tax totals applied at the invoice level.
* Corresponds to <inv:TaxTotalsType>
*/
export interface TaxTotalsType {
/** Tax Type Code (1: Withheld, 2: Fees, 3: Other, 4: StampDuty, 5: Deductions) */
taxType: 1 | 2 | 3 | 4 | 5;
/** Tax Category Code (depends on taxType) */
taxCategory?: number;
/** Value upon which the tax is calculated */
underlyingValue?: AmountType;
/** Tax Amount */
taxAmount: AmountType;
/** Line sequential number for this tax total entry */
id?: number;
}
/**
* Represents details of other correlated entities.
* Corresponds to <inv:EntityType>
*/
export interface EntityType {
/** Entity Category Code (1-6) */
type: 1 | 2 | 3 | 4 | 5 | 6;
/** Details of the entity */
entityData: PartyType;
}
/**
* Represents additional transport details (e.g., vehicle change).
* Corresponds to <inv:TransportDetailType>
*/
export interface TransportDetailType {
/** Vehicle Number */
vehicleNumber: string;
}
/**
* Represents additional general delivery details header.
* Corresponds to <inv:OtherDeliveryNoteHeaderType>
*/
export interface OtherDeliveryNoteHeaderType {
/** Loading Address details */
loadingAddress: AddressType;
/** Delivery Address details */
deliveryAddress: AddressType;
/** Issuer's branch where shipping starts (if different from header) */
startShippingBranch?: number;
/** Recipient's branch where shipping completes (if different from header) */
completeShippingBranch?: number;
}
/**
* Represents the signature from an E-Invoicing Provider for payments.
* Corresponds to <inv:ProviderSignatureType>
*/
export interface ProviderSignatureType {
/** Provider's ID (YPAHES Decision Number) */
SigningAuthor: string;
/** Provider generated signature */
Signature: string;
}
/**
* Represents the token/signature from an ECR (Fiscal Device) for payments via ERP.
* Corresponds to <inv:ECRTokenType>
*/
export interface ECRTokenType {
/** ECR ID (Fiscal Mechanism Registry Number) */
SigningAuthor: string;
/** Unique 6-digit session/transaction code */
SessionNumber: string;
}
export interface PaymentMethods {
paymentMethodDetails: PaymentMethodDetailType[];
}
export interface TaxesTotals {
taxes: TaxTotalsType[];
}
/**
* Enum for invoice row types (recType) with their corresponding codes and descriptions
*/
export declare enum RecType {
/** Special Line for Withheld Taxes (Inactive - for future use) */
SPECIAL_WITHHELD_TAXES = 1,
/** Fee Line with VAT */
FEE_WITH_VAT = 2,
/** Other Taxes Line with VAT */
OTHER_TAXES_WITH_VAT = 3,
/** Special Line for Stamp Duty (Inactive - for future use) */
SPECIAL_STAMP_DUTY = 4,
/** Special Line for Deductions (Inactive - for future use) */
SPECIAL_DEDUCTIONS = 5,
/** Gift Voucher */
GIFT_VOUCHER = 6,
/** Negative value sign (Valid only for invoices 17.3, 17.4, 17.5, and 17.6) */
NEGATIVE_VALUE_SIGN = 7
}