Invoice
Finvoice
Finvoice
$Invoice = $this->get('webservice','Finvoice')->getResource('Invoice'); $MessageTransmissionDetails = $Invoice->addMessageTransmissionDetails(); $MessageSenderDetails = $MessageTransmissionDetails->addMessageSenderDetails(); $MessageReceiverDetails = $MessageTransmissionDetails->addMessageReceiverDetails(); $MessageReceiverDetails->ToIdentifier = ''; $MessageReceiverDetails->ToIntermediator = ''; $MessageDetails = $MessageTransmissionDetails->addMessageDetails(); $SellerPartyDetails = $Invoice->addSellerPartyDetails(); $SellerPartyDetails->SellerPartyIdentifier = '1849792-4'; $SellerPartyDetails->SellerOrganisationName = 'Pingvin Designs Oy'; $SellerPartyDetails->SellerOrganisationDepartment = 'Kirjanpito'; $SellerPartyDetails->SellerOrganisationTaxCode = 'FI18497924'; $SellerPostalAddressDetails = $SellerPartyDetails->addSellerPostalAddressDetails(); $SellerPostalAddressDetails->SellerStreetName = 'Lapintie 28'; // Postal address $SellerPostalAddressDetails->SellerTownName = 'Tampere'; $SellerPostalAddressDetails->SellerPostCodeIdentifier = '33210'; // Post code $SellerPostalAddressDetails->CountryCode = 'FI'; $SellerPostalAddressDetails->CountryName = 'Finland'; // Post code $SellerPostalAddressDetails->SellerPostOfficeBoxIdentifier = '12'; $Invoice->SellerOrganisationUnitNumber = ''; $Invoice->SellerContactPersonName = 'Palveluvastaava Nimi'; $Invoice->SellerContactPersonFunction = ''; $Invoice->SellerContactPersonDepartment = ''; $SellerCommunicationDetails = $Invoice->addSellerCommunicationDetails(); $SellerCommunicationDetails->SellerPhoneNumberIdentifier = '(03) 348 8823'; $SellerCommunicationDetails->SellerEmailaddressIdentifier = 'toimisto@seller.fi'; $SellerInformationDetails = $Invoice->addSellerInformationDetails(); $SellerInformationDetails->SellerHomeTownName = 'Tampere'; $SellerInformationDetails->SellerPhoneNumber = '(03) 348 8800'; $SellerInformationDetails->SellerFaxNumber = '(03) 348 8858'; $SellerInformationDetails->SellerCommonEmailaddressIdentifier = 'toimisto@ekansio.fi'; $SellerInformationDetails->SellerWebaddressIdentifier = 'www.ekansio.fi'; $SellerInformationDetails->SellerFreeText = 'IT company'; $SellerAccountDetails = $SellerInformationDetails->addSellerAccountDetails(); $SellerAccountDetails->SellerAccountID = 'FI0822361800060111 XXX'; $SellerAccountDetails->SellerBic = 'NDEAFIHH XXX'; $BuyerPartyDetails = $Invoice->addBuyerPartyDetails(); $BuyerPartyDetails->BuyerPartyIdentifier = '1849792-4'; $BuyerPartyDetails->BuyerOrganisationName = 'Pingvin Designs Oy'; $BuyerPartyDetails->BuyerOrganisationDepartment = 'Kirjanpito'; $BuyerPartyDetails->BuyerOrganisationTaxCode = 'FI18497924'; $BuyerPostalAddressDetails = $BuyerPartyDetails->addBuyerPostalAddressDetails(); $BuyerPostalAddressDetails->BuyerStreetName = 'Lapintie 28'; $BuyerPostalAddressDetails->BuyerTownName = 'Tampere'; $BuyerPostalAddressDetails->BuyerPostCodeIdentifier = '33210'; // Post Code $BuyerPostalAddressDetails->CountryCode = 'FI'; $BuyerPostalAddressDetails->CountryName = 'Finland'; // Post code $BuyerPostalAddressDetails->BuyerPostOfficeBoxIdentifier = '12'; $BuyerPartyDetails->BuyerCode = ''; $Invoice->BuyerOrganisationUnitNumber = ''; $Invoice->BuyerContactPersonName = 'Meikäläinen Matti'; $Invoice->BuyerContactPersonFunction = ''; $Invoice->BuyerContactPersonDepartment = ''; $BuyerCommunicationDetails = $Invoice->addBuyerCommunicationDetails(); $BuyerCommunicationDetails->BuyerPhoneNumberIdentifier = '(03) 348 8800'; $BuyerCommunicationDetails->BuyerEmailaddressIdentifier = 'toimisto@buyer.fi'; $InvoiceRecipientPartyDetails = $Invoice->addInvoiceRecipientPartyDetails(); $InvoiceRecipientPartyDetails->InvoiceRecipientPartyIdentifier = '1849792-4'; $InvoiceRecipientPartyDetails->InvoiceRecipientOrganisationName = 'Pingvin Designs Oy'; $InvoiceRecipientPartyDetails->InvoiceRecipientDepartment = 'Kirjanpito'; $InvoiceRecipientPartyDetails->InvoiceRecipientOrganisationTaxCode = 'FI18497924'; $InvoiceRecipientPostalAddressDetails = $InvoiceRecipientPartyDetails->addInvoiceRecipientPostalAddressDetails(); $InvoiceRecipientPostalAddressDetails->InvoiceRecipientStreetName = 'Lapintie 28'; // Postal address $InvoiceRecipientPostalAddressDetails->InvoiceRecipientTownName = 'Tampere'; $InvoiceRecipientPostalAddressDetails->InvoiceRecipientPostCodeIdentifier = '33210'; // Post code $InvoiceRecipientPostalAddressDetails->CountryCode = 'FI'; $InvoiceRecipientPostalAddressDetails->CountryName = 'Finland'; // Post code $InvoiceRecipientPostalAddressDetails->InvoiceRecipientPostOfficeBoxIdentifier = '12'; $DeliveryPartyDetails = $Invoice->addDeliveryPartyDetails(); $DeliveryPartyDetails->DeliveryPartyIdentifier = '1849792-4'; $DeliveryPartyDetails->DeliveryOrganisationName = 'Pingvin Designs Oy'; $DeliveryPartyDetails->DeliveryOrganisationDepartment = 'Kirjanpito'; $DeliveryPartyDetails->DeliveryOrganisationTaxCode = 'FI18497924'; $DeliveryPostalAddressDetails = $DeliveryPartyDetails->addDeliveryPostalAddressDetails(); $DeliveryPostalAddressDetails->DeliveryStreetName = 'Lapintie 28'; // Postal address $DeliveryPostalAddressDetails->DeliveryTownName = 'Tampere'; $DeliveryPostalAddressDetails->DeliveryPostCodeIdentifier = '33210'; // Post code $DeliveryPostalAddressDetails->CountryCode = 'FI'; $DeliveryPostalAddressDetails->CountryName = 'Finland'; // Post code $DeliveryPostalAddressDetails->DeliveryPostOfficeBoxIdentifier = '12'; $DeliveryDetails = $Invoice->addDeliveryDetails(); $DeliveryDetails->DeliveryDate = ''; $DeliveryPeriodDetails = $DeliveryDetails->addDeliveryPeriodDetails(); $DeliveryPeriodDetails->StartDate = ''; $DeliveryPeriodDetails->EndDate = ''; $DeliveryDetails->DeliveryMethodText = ''; $DeliveryDetails->DeliveryTermsText = ''; $InvoiceDetails = $Invoice->addInvoiceDetails(); $InvoiceDetails->InvoiceTypeCode = '*INV01'; $InvoiceDetails->InvoiceTypeText = '*LASKU'; $InvoiceDetails->OriginCode = '*Original'; $InvoiceDetails->InvoiceNumber = '12345678'; $InvoiceDetails->InvoiceDate = ''; $InvoiceDetails->SellerReferenceIdentifier = '123456'; $InvoiceDetails->BuyersSellerIdentifier = '123456'; $InvoiceDetails->SellersBuyerIdentifier = ''; $InvoiceDetails->OrderIdentifier = ''; $InvoiceDetails->OrderDate = ''; $InvoiceDetails->OrdererName = ''; $InvoiceDetails->SalesPersonName = ''; $InvoiceDetails->OrderConfirmationDate = ''; $InvoiceDetails->BuyerReferenceIdentifier = ''; $InvoiceDetails->InvoiceTotalVatExcludedAmount = '100'; $InvoiceDetails->InvoiceTotalVatAmount = '24'; $InvoiceDetails->InvoiceTotalVatIncludedAmount = '124'; $InvoiceDetails->AccountDimensionText = ''; $InvoiceDetails->SellerAccountText = ''; $VatSpecificationDetails = $InvoiceDetails->addVatSpecificationDetails(); $VatSpecificationDetails->VatBaseAmount = '24'; $VatSpecificationDetails->VatRatePercent = ''; $VatSpecificationDetails->VatRateAmount = '24'; $VatSpecificationDetails->VatFreeText = ''; $InvoiceDetails->InvoiceFreeText = ''; $PaymentTermsDetails = $InvoiceDetails->addPaymentTermsDetails(); $PaymentTermsDetails->PaymentTermsFreeText = '14 pv netto'; $PaymentTermsDetails->InvoiceDueDate = ''; $PaymentTermsDetails->CashDiscountPercent = ''; $PaymentOverDueFineDetails = $PaymentTermsDetails->addPaymentOverDueFineDetails(); $PaymentOverDueFineDetails->PaymentOverDueFineFreeText = 'Yliaikakorko 8,0 %'; $PaymentOverDueFineDetails->PaymentOverDueFinePercent = '8,0'; $PaymentStatusDetails = $Invoice->addPaymentStatusDetails(); $PaymentStatusDetails->PaymentStatusCode = ''; // - , , $PaymentStatusDetails->PaymentMethodText = ''; $FactoringAgreementDetails = $Invoice->addFactoringAgreementDetails(); $FactoringAgreementDetails->FactoringAgreementIdentifier = '*'; $FactoringAgreementDetails->FactoringTypeCode = 'NRAH'; $InvoiceRow = $Invoice->addInvoiceRow(); $InvoiceRow->ArticleIdentifier = ''; $InvoiceRow->ArticleGroupIdentifier = ''; $InvoiceRow->ArticleName = 'Name of the product or service'; $InvoiceRow->BuyerArticleIdentifier = 'Given by byer. Ean etc.'; $InvoiceRow->EanCode = ''; $InvoiceRow->SerialNumberIdentifier = ''; $InvoiceRow->InvoicedQuantity = '2'; $InvoiceRow->OrderedQuantity = '2'; $InvoiceRow->UnitPriceAmount = '100.00'; $InvoiceRow->UnitPriceVatIncludedAmount = '124.00'; $InvoiceRow->RowNormalProposedAccountIdentifier = ''; $InvoiceRow->RowAccountDimensionText = ''; $InvoiceRow->RowSellerAccountText = ''; $InvoiceRow->RowFreeText = ''; $InvoiceRow->RowDiscountPercent = ''; $InvoiceRow->RowVatRatePercent = '24'; $InvoiceRow->RowVatAmount = '48.00'; $InvoiceRow->RowVatExcludedAmount = '200.00'; $InvoiceRow->RowAmount = '248.00'; $EpiDetails = $Invoice->addEpiDetails(); $EpiIdentificationDetails = $EpiDetails->addEpiIdentificationDetails(); $EpiIdentificationDetails->EpiDate = ''; $EpiPartyDetails = $EpiDetails->addEpiPartyDetails(); $EpiBfiPartyDetails = $EpiPartyDetails->addEpiBfiPartyDetails(); $EpiBfiPartyDetails->EpiBfiIdentifier = 'NDEAFIHH'; $EpiBfiPartyDetails->EpiBfiName = ''; $EpiBeneficiaryPartyDetails = $EpiPartyDetails->addEpiBeneficiaryPartyDetails(); $EpiBeneficiaryPartyDetails->EpiNameAddressDetails = '*'; $EpiBeneficiaryPartyDetails->EpiBei = ''; $EpiBeneficiaryPartyDetails->EpiAccountID = 'FI0 XXX 822361800060111'; $EpiPaymentInstructionDetails = $EpiDetails->addEpiPaymentInstructionDetails(); $EpiPaymentInstructionDetails->EpiRemittanceInfoIdentifier = '464099'; $EpiPaymentInstructionDetails->EpiInstructedAmount = ''; $EpiPaymentInstructionDetails->EpiCharge = '*'; $EpiPaymentInstructionDetails->EpiDateOptionDate = ''; $Invoice->sendRequest(); $Invoice->getSuccess(); // Tosi, jos onnistui $Invoice->getStatus(); // Vastauksen status tekstimuodossa $Invoice->getMessage(); // Vastauksen lisätieto $result = $Invoice->getResult(); // Vastauksen sisältö // TAI $response = $Invoice->getResponse(); // Vastauksen sisältö