czech_post_b2b_client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +40 -0
- data/CHANGELOG.md +14 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +281 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/certs/postsignum_qca4_root.pem +41 -0
- data/certs/postsignum_vca5_sub.pem +44 -0
- data/doc/CzechPostB2bClient.html +479 -0
- data/doc/CzechPostB2bClient/B2BErrors.html +242 -0
- data/doc/CzechPostB2bClient/B2BErrors/BadRequestError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/BaseError.html +376 -0
- data/doc/CzechPostB2bClient/B2BErrors/CustomerRequestsCountOverflowError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/InternalB2BServerError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/InternalBackendServerError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/InternalDataPersistenceServerError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/ProcessingUnfinishedYetError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/ServiceBusyError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/UnauthorizedContractAccessError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/UnauthorizedRoleAccessError.html +145 -0
- data/doc/CzechPostB2bClient/Configuration.html +1005 -0
- data/doc/CzechPostB2bClient/Error.html +128 -0
- data/doc/CzechPostB2bClient/PrintingTemplates.html +199 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AddressData3x8.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel.html +117 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/Blank.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/Blank4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/BlankLandscape.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage.html +115 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/EMS.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/EMS2x4.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Standard.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Standard4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Valuable.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Valuable4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/Simple.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/SimpleWithCODVoucherA.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Base.html +279 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherA.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherA3OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherC.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherForCSOB.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CustomDeclarationCN22.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CustomDeclarationCN23.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/DeliveryTicket.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope.html +115 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeB4.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeC5.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeC6.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeDL.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/HarmonizedLabel.html +141 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/HarmonizedLabel4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/IntegratedDocument.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/RRLabels3x8.html +129 -0
- data/doc/CzechPostB2bClient/RequestBuilders.html +117 -0
- data/doc/CzechPostB2bClient/RequestBuilders/BaseBuilder.html +396 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetParcelStateBuilder.html +329 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetParcelsPrintingBuilder.html +470 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetResultParcelsBuilder.html +329 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetStatsBuilder.html +403 -0
- data/doc/CzechPostB2bClient/RequestBuilders/SendParcelsBuilder.html +403 -0
- data/doc/CzechPostB2bClient/ResponseCodes.html +242 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressAllowedForBalikovnaOnly.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressIsNotValidForSubject.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressNeedsPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressSuitableForLocalDelivery.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressValidOnlyForNaPostu.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressValidOnlyForNaPostuDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddresseeCityRequired.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AlreadyAssignedOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadAddressee.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadFormatReturnNumberDays.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadPrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadPrefixForAddress.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadVariableSymbol.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BaseCode.html +550 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BatchClosed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BatchInvalid.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BatchUnfinished.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CODAmountOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CODAmountTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CanceledOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CustomGoodQuantityOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CustomerIDNotInAccordanceWithParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DensityOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicateDuplicateParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicateParcel.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicateParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicitParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/FullSequence.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/FullSequenceDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/IllegalCombinationOfServices.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddRequiredService75.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService1A.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService1B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService1D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService9.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddressWasModified.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddresseeToLong.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelCustCardNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelCustCardNumberAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelMobilePhoneOrEmailAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelPalettsNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelPersonalIdentificationNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AB.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1ABForService40.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AForPostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AForService40.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AWith1B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1BAddService1A.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1BForPostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1BWith1A.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1E.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1V.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService25.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService27.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService29.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService30.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService31.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService34.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService34InvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService45.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService45InvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService46.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService47.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5BAnd5C.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5BAnd5D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5C.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5CAnd5D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelVSVoucher.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCityChanged.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInexactAddress.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidAccount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidBankCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidBirthDay.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidCategoryCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidMobilePhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidPrefixAccount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidSpecificSymbol.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidTelephoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoMissingPartCityServiceDeliveryOnSundayOrHolidayMayNotBeRealized.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoPriceIsNotNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoPriceIsTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoService29And47.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoSpecialPackagingRequest.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InternalApplicationError.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressAddresseeDocumentForParcelType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressAddresseeDocumentObjectNotFound.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressAddresseeDocumentWrongCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForBalikovna.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForBigPackage.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForCODAmountOver20000.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForParcelType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressee.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAmountCurrency.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAmountType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCODCurrency.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCODCurrencyAccordance.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCategoryCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidContentCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCurrencyCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCustomGoodNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCustomerCardNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCustomerId.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidDensity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidHsCodeCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidIsoCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidIsoCustomGoodFormat.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidLocation.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidMRNCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidMRNCodeControl.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidNumberClosure.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelBarcode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelBarcodeDuplicate.html +145 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelCodeControl.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelResponseCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelTypeForID.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPartnerCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPayday.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrefixAccordance.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrefixCombination.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrefixForDimensionsAndFragile.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPriceCurrency.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPriceCurrencyAccordance.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPriceCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidQuantityCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidResponsibleConsignmentNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidReturnNumberDays.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidService18.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidService19.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidServiceCombination.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidServicesForDimensions.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidSignNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidSubisoCountry.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTareWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTiming.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTransmissionDate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTypePrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidUseOfService36.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidUseOfService37.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidUseOfService38.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeightCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeightCustomGoodSummary.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeightForService11.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidZPROOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidZPROOrderNumberFormat.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidostCodeOrCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MIssingParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddressee.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddresseeCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddresseeStreet.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddresseeZipCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCODAmountType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCategoryCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCompanyName.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingContentCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCurrencyCustomDeclaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingHandlingInstructions.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingHsCodeCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingIsoCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPalettsNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingParcelCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingParcelCustomGoods.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPriceCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingQuantityCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredAddresseeDocumentDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredAddresseeEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredFirstNameAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredMRNCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredMobileNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredMobileNumberOrEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPayday.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPhoneNumberOrEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPhoneNumberOrWhat.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService10.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService1AB.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService1X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService2X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService3X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService3XTrinity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService4.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService4X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService4x.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredVoucherPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredZPROOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingReturnInstructions.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingReturnNumberDays.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingSenderEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingSizeCategory.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingSurname.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingVariableSymbol.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingVariableSymbolDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingWeightCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NfoCancelService9.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NoContractService41.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NoContractServiceReturnReceipt.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NotExistingOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/Ok.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/OverenoVecerniDorucovani.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PalettsNumberOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ParcelCodeNotAllowed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ParcelCodeNotInAssignedRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ParcelDoesNotMeetTheRequirementsForm.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceAndCODAmountTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceTooLow.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ResponsibleConsignmentNumberCannotBeImported.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ResponsibleConsignmentNumberOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ServicesCombinationNotAllowed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionAlreadyClosed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionNotExists.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionOpened.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionUnfinished.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnauthorizedAccess.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnknownAddresseeCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnknownAddresseePostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnknownPrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/VariableSymbolIsNotNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/WeightCustomGoodOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/WeightIsOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/WeightIsOutOfRangeDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseParsers.html +117 -0
- data/doc/CzechPostB2bClient/ResponseParsers/BaseParser.html +283 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetParcelStateParser.html +533 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetParcelsPrintingParser.html +463 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetResultParcelsParser.html +625 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetStatsParser.html +347 -0
- data/doc/CzechPostB2bClient/ResponseParsers/SendParcelsParser.html +231 -0
- data/doc/CzechPostB2bClient/Services.html +117 -0
- data/doc/CzechPostB2bClient/Services/AddressSheetsGenerator.html +451 -0
- data/doc/CzechPostB2bClient/Services/ApiCaller.html +307 -0
- data/doc/CzechPostB2bClient/Services/Communicator.html +220 -0
- data/doc/CzechPostB2bClient/Services/DeliveringInspector.html +324 -0
- data/doc/CzechPostB2bClient/Services/Orchestrator.html +143 -0
- data/doc/CzechPostB2bClient/Services/ParcelsSendProcessUpdater.html +377 -0
- data/doc/CzechPostB2bClient/Services/ParcelsSender.html +402 -0
- data/doc/CzechPostB2bClient/Services/ParcelsSubmissionCloser.html +337 -0
- data/doc/CzechPostB2bClient/Services/TimePeriodStatisticator.html +398 -0
- data/doc/SteppedService.html +224 -0
- data/doc/SteppedService/Base.html +706 -0
- data/doc/SteppedService/Errors.html +365 -0
- data/doc/_index.html +2607 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +357 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +357 -0
- data/doc/js/app.js +303 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +923 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/czech_post_b2b_client.rb +37 -0
- data/lib/czech_post_b2b_client/b2b_errors.rb +105 -0
- data/lib/czech_post_b2b_client/configuration.rb +34 -0
- data/lib/czech_post_b2b_client/printing_templates.rb +166 -0
- data/lib/czech_post_b2b_client/request_builders.rb +8 -0
- data/lib/czech_post_b2b_client/request_builders/base_builder.rb +90 -0
- data/lib/czech_post_b2b_client/request_builders/get_parcel_state_builder.rb +44 -0
- data/lib/czech_post_b2b_client/request_builders/get_parcels_printing_builder.rb +79 -0
- data/lib/czech_post_b2b_client/request_builders/get_result_parcels_builder.rb +28 -0
- data/lib/czech_post_b2b_client/request_builders/get_stats_builder.rb +30 -0
- data/lib/czech_post_b2b_client/request_builders/send_parcels_builder.rb +294 -0
- data/lib/czech_post_b2b_client/response_codes.rb +1900 -0
- data/lib/czech_post_b2b_client/response_parsers.rb +8 -0
- data/lib/czech_post_b2b_client/response_parsers/base_parser.rb +95 -0
- data/lib/czech_post_b2b_client/response_parsers/get_parcel_state_parser.rb +54 -0
- data/lib/czech_post_b2b_client/response_parsers/get_parcels_printing_parser.rb +42 -0
- data/lib/czech_post_b2b_client/response_parsers/get_result_parcels_parser.rb +56 -0
- data/lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb +27 -0
- data/lib/czech_post_b2b_client/response_parsers/send_parcels_parser.rb +13 -0
- data/lib/czech_post_b2b_client/services.rb +10 -0
- data/lib/czech_post_b2b_client/services/address_sheets_generator.rb +55 -0
- data/lib/czech_post_b2b_client/services/api_caller.rb +115 -0
- data/lib/czech_post_b2b_client/services/communicator.rb +28 -0
- data/lib/czech_post_b2b_client/services/delivering_inspector.rb +50 -0
- data/lib/czech_post_b2b_client/services/orchestrator.rb +27 -0
- data/lib/czech_post_b2b_client/services/parcels_send_process_updater.rb +71 -0
- data/lib/czech_post_b2b_client/services/parcels_sender.rb +53 -0
- data/lib/czech_post_b2b_client/services/parcels_submission_closer.rb +23 -0
- data/lib/czech_post_b2b_client/services/time_period_statisticator.rb +44 -0
- data/lib/czech_post_b2b_client/version.rb +5 -0
- data/lib/stepped_service.rb +4 -0
- data/lib/stepped_service/base.rb +139 -0
- data/lib/stepped_service/errors.rb +29 -0
- metadata +571 -0
@@ -0,0 +1,357 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.19
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="czechpostb2bclient">CzechPostB2bClient</h1>
|
61
|
+
<p>Accessing B2B API of Czech Post for bulk processing of parcels (“B2B - WS PodáníOnline”).</p>
|
62
|
+
|
63
|
+
<p>There are these supported operations of API:
|
64
|
+
- <em>sendParcels</em> - stores data of parcels for async processing [HTTP POST - async response]
|
65
|
+
- <em>getResultParcels</em> - return results of such processing [HTTP GET - sync response]
|
66
|
+
- <em>getStats</em> - returns statistics of parcels sent in time period [HTTP GET - sync response]
|
67
|
+
- <em>getParcelState</em> - returns all known states for listed parcels [HTTP GET - sync response]
|
68
|
+
- <em>getParcelsPrinting</em> - returns PDF with address labels/stickers for listed parcels [HTTP GET - sync response]</p>
|
69
|
+
|
70
|
+
<h2 id="installation">Installation</h2>
|
71
|
+
<p>### 1) Registration at Czech Post (CP)
|
72
|
+
The longterm and hardest part.
|
73
|
+
- Connect Czech Post representative and make a contract with them.
|
74
|
+
- Ask them for ALL documentation!(I have to ask 3 times to collect enough of it). They like to put files into DOCX file, so click on file icons!
|
75
|
+
- You have to obtain “komerční certifikát PostSignum”.</p>
|
76
|
+
|
77
|
+
<p>Instructions (in czech) are in <a href="./documents/Postup_pro_zavedení_API_služeb_České_pošty.docx"><code>documents/Postup_pro_zavedení_API_služeb_České_pošty.docx</code></a></p>
|
78
|
+
|
79
|
+
<h3 id="preparations-on-podanionline-app">2) Preparations on PodaniOnline app</h3>
|
80
|
+
<p>1) Sign in to <a href="https://www.postaonline.cz/rap/prihlaseni">PostaOnline</a>
|
81
|
+
2) Go to <a href="https://www.postaonline.cz/klientskazona?p_p_id=clientzone_WAR_clientZoneportlet&p_p_lifecycle=0&_clientzone_WAR_clientZoneportlet_action=showPol&_clientzone_WAR_clientZoneportlet_implicitModel=true">“Podání Online”</a>
|
82
|
+
3) When You are in, select tab <strong>Nastavení</strong> and menu <strong>Podací místa</strong>
|
83
|
+
4) Add <em>Podací místo</em> and write down it’s ID (will be used in <code>sending_post_office_location_number</code>)
|
84
|
+
5) Switch tab to <strong>Zásilky</strong> and go to menu <strong>Zásilky => Přednastavení údajů</strong>
|
85
|
+
6) Write down value(s) in <em>Výběr technologického čísla</em> (it will be used as <code>customer_id</code>).</p>
|
86
|
+
|
87
|
+
<h3 id="gem-installation">3) Gem installation</h3>
|
88
|
+
<p>Add this line to your application’s Gemfile:</p>
|
89
|
+
|
90
|
+
<p><code>ruby
|
91
|
+
gem 'czech_post_b2b_client'
|
92
|
+
</code></p>
|
93
|
+
|
94
|
+
<p>And then execute:</p>
|
95
|
+
|
96
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
97
|
+
</code></pre>
|
98
|
+
|
99
|
+
<p>Or install it yourself as:</p>
|
100
|
+
|
101
|
+
<pre class="code ruby"><code class="ruby">$ gem install czech_post_b2b_client
|
102
|
+
</code></pre>
|
103
|
+
|
104
|
+
<h3 id="setting-up-gem">4) Setting up gem</h3>
|
105
|
+
<p>Set up your <code>contract_id</code>, <code>customer_id</code> (both from CP signed contract), <code>certificate_path</code>, <code>private_key_path</code> and <code>private_key_password</code> in configuration:
|
106
|
+
```
|
107
|
+
CzechPostB2bClient.configure do |config|
|
108
|
+
config.contract_id = ‘contract_id’
|
109
|
+
config.customer_id = ‘customer_id’
|
110
|
+
config.certificate_path = ‘full_path/to/your/postsignum_certificate.pem’
|
111
|
+
config.private_key_path = ‘full_path/to/your/postsignum_private.key’
|
112
|
+
config.private_key_password = ‘your_password or nil’</p>
|
113
|
+
|
114
|
+
<pre class="code ruby"><code class="ruby"> # this actually do not work, I have to use `sending_post_office_location_number`. But it is REQUIRED!
|
115
|
+
config.sending_post_office_code = 12_345 # PSC of post office where parcels will be physically delivered and submitted
|
116
|
+
|
117
|
+
# and You can override defaults
|
118
|
+
# config.sending_post_office_location_number => 1
|
119
|
+
# config.namespaces #XML namespaces
|
120
|
+
# config.language => :cs # other languages are not supported now
|
121
|
+
# config.logger => ::Rails.logger or ::Logger.new(STDOUT),
|
122
|
+
# config.b2b_api_base_uri => 'https://b2b.postaonline.cz/services/POLService/v1'
|
123
|
+
end ```
|
124
|
+
</code></pre>
|
125
|
+
|
126
|
+
<ul>
|
127
|
+
<li><code>contract_id</code> is <em>“ID CČK”</em> (can be found in contract; eg.: <em>“2511327004”</em>)</li>
|
128
|
+
<li><code>customer_id</code> is <em>“Technologické číslo”</em> (can be found in contract; eg.: <em>“U123”</em> or <em>“L03022”</em>; also is visible at <a href="https://www.postaonline.cz/podanionline/PrednastaveniUdajuZasilky.action">PodaníOnline</a></li>
|
129
|
+
</ul>
|
130
|
+
|
131
|
+
<p>Because PostSignum Certificate Authority is not trusted by default, correct certificate chain is in <code>certs/</code> folder. If You have problem with them, create a issue here. Maybe they are outdated now.</p>
|
132
|
+
|
133
|
+
<h2 id="usage">Usage</h2>
|
134
|
+
<p><strong>You have to know which parcel type (according to CP) you sending!</strong> Eg. ‘BA’ or ‘RR’. See <a href="./documents/parcel_types.md"><code>documents/parcel_types.md</code></a>.</p>
|
135
|
+
|
136
|
+
<p><strong>And what services You will use for each parcel</strong>, see <a href="./documents/services_list.md"><code>documents/services_list.md</code></a> and <a href="./documents/parcels_type_and_services_restrictions.md"><code>documents/parcels_type_and_services_restrictions.md</code></a>.</p>
|
137
|
+
|
138
|
+
<p>Hashes used is service calls bellow:
|
139
|
+
```
|
140
|
+
short_sender_data = { address: {
|
141
|
+
company_name: ‘Oriflame’,
|
142
|
+
addition_to_name: ‘perfume’, # optional
|
143
|
+
street: ‘V olšinách’,
|
144
|
+
house_number: ‘16’,
|
145
|
+
city_part: ‘Strašnice’,
|
146
|
+
city: ‘Praha’,
|
147
|
+
post_code: 10_000,
|
148
|
+
},
|
149
|
+
mobile_phone: ‘+420777888999’,
|
150
|
+
email: ‘rehor.jan@cpost.cz’ }
|
151
|
+
sending_data = { contract_id: configuration.contract_id,
|
152
|
+
parcels_sending_date: Date.today,
|
153
|
+
sending_post_office_location_number: 1,
|
154
|
+
sender: short_sender_data,
|
155
|
+
cash_on_delivery: {
|
156
|
+
address: short_sender_data[:address]
|
157
|
+
bank_account: ‘123456-1234567890/1234’
|
158
|
+
} }</p>
|
159
|
+
|
160
|
+
<pre class="code ruby"><code class="ruby">short_addressee_data = { address: {
|
161
|
+
first_name: 'Petr',
|
162
|
+
last_name: 'Foton',
|
163
|
+
street: 'Fischerova',
|
164
|
+
house_number: '686',
|
165
|
+
sequence_number: '32',
|
166
|
+
city_part: 'Nové Sady',
|
167
|
+
city: 'Olomouc',
|
168
|
+
post_code: 77_900
|
169
|
+
},
|
170
|
+
email: 'foton@github.com',
|
171
|
+
mobile_phone: '+420777888999' }
|
172
|
+
|
173
|
+
parcels = [
|
174
|
+
{
|
175
|
+
addressee: short_addressee_data,
|
176
|
+
params: { parcel_id: 'package_1of2',
|
177
|
+
parcel_code_prefix: 'BA',
|
178
|
+
weight_in_kg: 1.0,
|
179
|
+
parcel_order: 1,
|
180
|
+
parcels_count: 2 },
|
181
|
+
services: [70, 7, 'S']
|
182
|
+
},
|
183
|
+
{
|
184
|
+
addressee: short_addressee_data,
|
185
|
+
params: { parcel_id: 'package_2of2',
|
186
|
+
parcel_code_prefix: 'BA',
|
187
|
+
weight_in_kg: 1.6,
|
188
|
+
parcel_order: 2,
|
189
|
+
parcels_count: 2 },
|
190
|
+
services: [70,'S']
|
191
|
+
},
|
192
|
+
{
|
193
|
+
addressee: short_addressee_data,
|
194
|
+
params: { parcel_id: 'package_3',
|
195
|
+
parcel_code_prefix: 'BA',
|
196
|
+
weight_in_kg: 1.9 },
|
197
|
+
services: [7,'M']
|
198
|
+
}
|
199
|
+
] ```
|
200
|
+
</code></pre>
|
201
|
+
|
202
|
+
<p>1) Pack your parcel(s)</p>
|
203
|
+
|
204
|
+
<p>2) Call <code>ParcelsSender</code>, this will store in <code>result</code> <code>transmission_id</code> and expected time to ask for results.
|
205
|
+
```
|
206
|
+
psender = ParcelsSender.call(sending_data: sending_data, parcels: parcels)</p>
|
207
|
+
|
208
|
+
<pre class="code ruby"><code class="ruby"> if psender.success?
|
209
|
+
result = psender.result
|
210
|
+
processing_end_time_utc = (result.processing_end_expected_at - (60 *60)).utc # API returns time in CET but marked as UTC
|
211
|
+
transaction_id = result.transaction_id
|
212
|
+
else
|
213
|
+
puts psender.errors.full_messages
|
214
|
+
end
|
215
|
+
```
|
216
|
+
For now, `parcels` is array of complicated hashes; each parcel must have `parcel_id` key (your ID of parcel).
|
217
|
+
</code></pre>
|
218
|
+
|
219
|
+
<p>3) When such expected time pass, ask for results by calling <code>ParcelsSendProcessUpdater</code>.</p>
|
220
|
+
|
221
|
+
<pre class="code ruby"><code class="ruby"> You can get error `Processing is not yet finished` or hash based on `parcel_id` keys.
|
222
|
+
Eg. :
|
223
|
+
```
|
224
|
+
pudater = ParcelsSendProcessUpdater.call(transmission_id: transmission_id)
|
225
|
+
|
226
|
+
if pupdater.success?
|
227
|
+
update_my_parcels_with(pupdater.result) # => { 'parcel_1of2' => { parcel_code: 'BA12354678', states: [{ code: 1, text: 'OK' }]},
|
228
|
+
# 'parcel_2of2' => { parcel_code: 'BA12354679', states: [{ code: 1, text: 'OK' }]},
|
229
|
+
# 'parcel_3' => { parcel_code: 'BA12354680', states: [{ code: 1, text: 'OK' }]}
|
230
|
+
else
|
231
|
+
puts psender.errors.full_messages # => "response_state: ResponseCode[19 BATCH_INVALID] V dávce se vyskytují chybné záznamy"
|
232
|
+
# "parcels: Parcel[parcel_2of2] => ResponseCode[104 INVALID_WEIGHT] Hmotnost mimo povolený rozsah"
|
233
|
+
# "parcels: Parcel[parcel_2of2] => ResponseCode[261 MISSING_SIZE_CATEGORY] Neuvedena rozměrová kategorie zásilky"
|
234
|
+
# "parcels: Parcel[parcel_3] => ResponseCode[310 INVALID_PREFIX] Neplatný typ zásilky"
|
235
|
+
end
|
236
|
+
```
|
237
|
+
`parcel_code` is CzechPost ID of parcel and is used in following calls.
|
238
|
+
</code></pre>
|
239
|
+
|
240
|
+
<p>4) Print address sheets of parcels(s) by calling <code>AddressSheetsGenerator</code>.
|
241
|
+
See <a href="./lib/czech_post_b2b_client/printing_templates.rb">template_classes</a> for available templates.
|
242
|
+
Eg. :
|
243
|
+
```
|
244
|
+
parcel_codes = %w[RA123456789 RR123456789F RR123456789G] # beware of parcel_id!
|
245
|
+
options = {
|
246
|
+
customer_id: configuration.customer_id, # required
|
247
|
+
contract_number: configuration.contract_id, # not required
|
248
|
+
template_id: 24, # ‘obalka 3 - B4’ #
|
249
|
+
margin_in_mm: { top: 5, left: 3 } # required
|
250
|
+
}</p>
|
251
|
+
|
252
|
+
<pre class="code ruby"><code class="ruby"> adrprinter = AddressSheetsGenerator.call(parcel_codes: parcel_codes, options: options )
|
253
|
+
|
254
|
+
if adrprinter.success?
|
255
|
+
File.write("adrsheet.pdf", adrprinter.result.pdf_content)
|
256
|
+
else
|
257
|
+
puts(adrprinter.errors.full_messages)
|
258
|
+
end
|
259
|
+
```
|
260
|
+
</code></pre>
|
261
|
+
|
262
|
+
<p>5) Repeat steps 1-4 until You decide to deliver packages to post office.</p>
|
263
|
+
|
264
|
+
<p>6) Close your parcels submission with call <code>ParcelsSubmissionCloser.call(sending_data: sender_data)</code>.</p>
|
265
|
+
|
266
|
+
<p>7) <em>They will await You at post office with warm welcome (hopefully). Parcels which are not delivered within 60 days are removed from CzechPost systems for free :-)</em></p>
|
267
|
+
|
268
|
+
<p>8) You can check current status of delivering with <code>DeliveringInspector</code>, which will return hash based on <code>parcel_code</code> keys.
|
269
|
+
Eg. :
|
270
|
+
```
|
271
|
+
delivery_boy = DeliveringInspector.call(parcel_codes: parcel_codes)</p>
|
272
|
+
|
273
|
+
<pre class="code ruby"><code class="ruby"> if delivery_boy.success?
|
274
|
+
update_my_parcels_delivery_status_with(delivery_boy.result)
|
275
|
+
# result is like:
|
276
|
+
# { 'RA12345687' => { current_state: { id: '91',
|
277
|
+
date: Date.parse('2015-09-04'),
|
278
|
+
text: 'Dodání zásilky.',
|
279
|
+
post_code: '25756',
|
280
|
+
post_name: 'Neveklov'},
|
281
|
+
deposited_until: Date.new(2015, 9, 2),
|
282
|
+
deposited_for_days: 15,
|
283
|
+
all_states: [
|
284
|
+
{ id: '21', date: Date.parse('2015-09-02'), text: 'Podání zásilky.', post_code: '26701', post_name: 'Králův Dvůr u Berouna' },
|
285
|
+
{ id: '-F', date: Date.parse('2015-09-03'), text: 'Vstup zásilky na SPU.', post_code: '22200', post_name: 'SPU Praha 022' },
|
286
|
+
{ id: '-I', date: Date.parse('2015-09-03'), text: 'Výstup zásilky z SPU.', post_code: '22200', post_name: 'SPU Praha 022' },
|
287
|
+
{ id: '-B', date: Date.parse('2015-09-03'), text: 'Přeprava zásilky k dodací poště.', post_code: nil, post_name: nil },
|
288
|
+
{ id: '51', date: Date.parse('2015-09-04'), text: 'Příprava zásilky k doručení.', post_code: '25607', post_name: 'Depo Benešov 70' },
|
289
|
+
{ id: '53', date: Date.parse('2015-09-04'), text: 'Doručování zásilky.', post_code: '25756', post_name: 'Neveklov' },
|
290
|
+
{ id: '91', date: Date.parse('2015-09-04'), text: 'Dodání zásilky.', post_code: '25756', post_name: 'Neveklov' }
|
291
|
+
]},
|
292
|
+
'BA56487125' => {...}
|
293
|
+
}
|
294
|
+
else
|
295
|
+
puts(delivery_boy.errors.full_messages)
|
296
|
+
end
|
297
|
+
```
|
298
|
+
</code></pre>
|
299
|
+
|
300
|
+
<p>9) And You can always ask for statistics!
|
301
|
+
<code>
|
302
|
+
tps = TimePeriodStatisticator.call(from_date: Date.today - 5, to_date: Date.today)
|
303
|
+
if tps.success?
|
304
|
+
result = tps.result
|
305
|
+
result.requests.total # => 26,
|
306
|
+
result.requests.with_errors # => 16
|
307
|
+
result.requests.successful # => 10
|
308
|
+
result.imported_parcels # => 3
|
309
|
+
else
|
310
|
+
puts(tps.errors.full_messages)
|
311
|
+
end
|
312
|
+
</code></p>
|
313
|
+
|
314
|
+
<h3 id="example-usage">Example usage</h3>
|
315
|
+
|
316
|
+
<p>See <code>test/integration_test.rb</code> for almost production usage. HTTP calls to B2B services are blocked and responses from them are stubbed.</p>
|
317
|
+
|
318
|
+
<p>You can quickly check you setup by altering config and run <code>ruby try_api_calls.rb</code> see <a href="./examples/try_api_calls.rb"><code>try_api_calls.rb</code></a>.</p>
|
319
|
+
|
320
|
+
<h2 id="troubleshooting">Troubleshooting</h2>
|
321
|
+
|
322
|
+
<p>1) Read all stuff in <code>doc</code>, maybe it helps.
|
323
|
+
2) If You get “handshake protocol failed” You do not have correct setup for certificates. If You get any xml response (see logger in debug mode) certificates are ok.
|
324
|
+
You can always try <code>TimePeriodStatisticator</code> for that check, it do not need any “before” actions.
|
325
|
+
3) Error <code>UNAUTHORIZED_ROLE_ACCESS</code> means wrong <code>customer_id</code> or You are not yet registered in “PodáníOnline”
|
326
|
+
4) Error <code>11: INVALID_LOCATION</code> was occuring when only <code>sending_post_office_code</code> was used. Try to use <code>sending_post_office_location_number</code>.
|
327
|
+
5) And last tip <code>261 MISSING_SIZE_CATEGORY</code> -> add correct “size service” to services (eg: ‘S’, ‘M’)
|
328
|
+
6) Compare resulting request XML with examples in <code>test/request_builders</code></p>
|
329
|
+
|
330
|
+
<h2 id="development">Development</h2>
|
331
|
+
|
332
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake test</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
333
|
+
|
334
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>lib/czech_post_b2b_client/version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
|
335
|
+
|
336
|
+
<h2 id="contributing">Contributing</h2>
|
337
|
+
|
338
|
+
<p>Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/czech_post_b2b_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the <a href="http://contributor-covenant.org">Contributor Covenant</a> code of conduct.</p>
|
339
|
+
|
340
|
+
<h2 id="license">License</h2>
|
341
|
+
|
342
|
+
<p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
343
|
+
|
344
|
+
<h2 id="code-of-conduct">Code of Conduct</h2>
|
345
|
+
|
346
|
+
<p>Everyone interacting in the CzechPostB2bClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the <a href="https://github.com/[USERNAME]/czech_post_b2b_client/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
|
347
|
+
</div></div>
|
348
|
+
|
349
|
+
<div id="footer">
|
350
|
+
Generated on Fri Mar 20 17:49:05 2020 by
|
351
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
352
|
+
0.9.19 (ruby-2.4.1).
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</div>
|
356
|
+
</body>
|
357
|
+
</html>
|
data/doc/file_list.html
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="content">
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<ul id="full_list" class="file">
|
45
|
+
|
46
|
+
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.19</title>
|
6
|
+
</head>
|
7
|
+
<script type="text/javascript" charset="utf-8">
|
8
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
|
+
var name = match ? match[1] : 'index.html';
|
10
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
11
|
+
window.top.location = name;
|
12
|
+
</script>
|
13
|
+
<noscript>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
16
|
+
</noscript>
|
17
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,357 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.19
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="czechpostb2bclient">CzechPostB2bClient</h1>
|
61
|
+
<p>Accessing B2B API of Czech Post for bulk processing of parcels (“B2B - WS PodáníOnline”).</p>
|
62
|
+
|
63
|
+
<p>There are these supported operations of API:
|
64
|
+
- <em>sendParcels</em> - stores data of parcels for async processing [HTTP POST - async response]
|
65
|
+
- <em>getResultParcels</em> - return results of such processing [HTTP GET - sync response]
|
66
|
+
- <em>getStats</em> - returns statistics of parcels sent in time period [HTTP GET - sync response]
|
67
|
+
- <em>getParcelState</em> - returns all known states for listed parcels [HTTP GET - sync response]
|
68
|
+
- <em>getParcelsPrinting</em> - returns PDF with address labels/stickers for listed parcels [HTTP GET - sync response]</p>
|
69
|
+
|
70
|
+
<h2 id="installation">Installation</h2>
|
71
|
+
<p>### 1) Registration at Czech Post (CP)
|
72
|
+
The longterm and hardest part.
|
73
|
+
- Connect Czech Post representative and make a contract with them.
|
74
|
+
- Ask them for ALL documentation!(I have to ask 3 times to collect enough of it). They like to put files into DOCX file, so click on file icons!
|
75
|
+
- You have to obtain “komerční certifikát PostSignum”.</p>
|
76
|
+
|
77
|
+
<p>Instructions (in czech) are in <a href="./documents/Postup_pro_zavedení_API_služeb_České_pošty.docx"><code>documents/Postup_pro_zavedení_API_služeb_České_pošty.docx</code></a></p>
|
78
|
+
|
79
|
+
<h3 id="preparations-on-podanionline-app">2) Preparations on PodaniOnline app</h3>
|
80
|
+
<p>1) Sign in to <a href="https://www.postaonline.cz/rap/prihlaseni">PostaOnline</a>
|
81
|
+
2) Go to <a href="https://www.postaonline.cz/klientskazona?p_p_id=clientzone_WAR_clientZoneportlet&p_p_lifecycle=0&_clientzone_WAR_clientZoneportlet_action=showPol&_clientzone_WAR_clientZoneportlet_implicitModel=true">“Podání Online”</a>
|
82
|
+
3) When You are in, select tab <strong>Nastavení</strong> and menu <strong>Podací místa</strong>
|
83
|
+
4) Add <em>Podací místo</em> and write down it’s ID (will be used in <code>sending_post_office_location_number</code>)
|
84
|
+
5) Switch tab to <strong>Zásilky</strong> and go to menu <strong>Zásilky => Přednastavení údajů</strong>
|
85
|
+
6) Write down value(s) in <em>Výběr technologického čísla</em> (it will be used as <code>customer_id</code>).</p>
|
86
|
+
|
87
|
+
<h3 id="gem-installation">3) Gem installation</h3>
|
88
|
+
<p>Add this line to your application’s Gemfile:</p>
|
89
|
+
|
90
|
+
<p><code>ruby
|
91
|
+
gem 'czech_post_b2b_client'
|
92
|
+
</code></p>
|
93
|
+
|
94
|
+
<p>And then execute:</p>
|
95
|
+
|
96
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
97
|
+
</code></pre>
|
98
|
+
|
99
|
+
<p>Or install it yourself as:</p>
|
100
|
+
|
101
|
+
<pre class="code ruby"><code class="ruby">$ gem install czech_post_b2b_client
|
102
|
+
</code></pre>
|
103
|
+
|
104
|
+
<h3 id="setting-up-gem">4) Setting up gem</h3>
|
105
|
+
<p>Set up your <code>contract_id</code>, <code>customer_id</code> (both from CP signed contract), <code>certificate_path</code>, <code>private_key_path</code> and <code>private_key_password</code> in configuration:
|
106
|
+
```
|
107
|
+
CzechPostB2bClient.configure do |config|
|
108
|
+
config.contract_id = ‘contract_id’
|
109
|
+
config.customer_id = ‘customer_id’
|
110
|
+
config.certificate_path = ‘full_path/to/your/postsignum_certificate.pem’
|
111
|
+
config.private_key_path = ‘full_path/to/your/postsignum_private.key’
|
112
|
+
config.private_key_password = ‘your_password or nil’</p>
|
113
|
+
|
114
|
+
<pre class="code ruby"><code class="ruby"> # this actually do not work, I have to use `sending_post_office_location_number`. But it is REQUIRED!
|
115
|
+
config.sending_post_office_code = 12_345 # PSC of post office where parcels will be physically delivered and submitted
|
116
|
+
|
117
|
+
# and You can override defaults
|
118
|
+
# config.sending_post_office_location_number => 1
|
119
|
+
# config.namespaces #XML namespaces
|
120
|
+
# config.language => :cs # other languages are not supported now
|
121
|
+
# config.logger => ::Rails.logger or ::Logger.new(STDOUT),
|
122
|
+
# config.b2b_api_base_uri => 'https://b2b.postaonline.cz/services/POLService/v1'
|
123
|
+
end ```
|
124
|
+
</code></pre>
|
125
|
+
|
126
|
+
<ul>
|
127
|
+
<li><code>contract_id</code> is <em>“ID CČK”</em> (can be found in contract; eg.: <em>“2511327004”</em>)</li>
|
128
|
+
<li><code>customer_id</code> is <em>“Technologické číslo”</em> (can be found in contract; eg.: <em>“U123”</em> or <em>“L03022”</em>; also is visible at <a href="https://www.postaonline.cz/podanionline/PrednastaveniUdajuZasilky.action">PodaníOnline</a></li>
|
129
|
+
</ul>
|
130
|
+
|
131
|
+
<p>Because PostSignum Certificate Authority is not trusted by default, correct certificate chain is in <code>certs/</code> folder. If You have problem with them, create a issue here. Maybe they are outdated now.</p>
|
132
|
+
|
133
|
+
<h2 id="usage">Usage</h2>
|
134
|
+
<p><strong>You have to know which parcel type (according to CP) you sending!</strong> Eg. ‘BA’ or ‘RR’. See <a href="./documents/parcel_types.md"><code>documents/parcel_types.md</code></a>.</p>
|
135
|
+
|
136
|
+
<p><strong>And what services You will use for each parcel</strong>, see <a href="./documents/services_list.md"><code>documents/services_list.md</code></a> and <a href="./documents/parcels_type_and_services_restrictions.md"><code>documents/parcels_type_and_services_restrictions.md</code></a>.</p>
|
137
|
+
|
138
|
+
<p>Hashes used is service calls bellow:
|
139
|
+
```
|
140
|
+
short_sender_data = { address: {
|
141
|
+
company_name: ‘Oriflame’,
|
142
|
+
addition_to_name: ‘perfume’, # optional
|
143
|
+
street: ‘V olšinách’,
|
144
|
+
house_number: ‘16’,
|
145
|
+
city_part: ‘Strašnice’,
|
146
|
+
city: ‘Praha’,
|
147
|
+
post_code: 10_000,
|
148
|
+
},
|
149
|
+
mobile_phone: ‘+420777888999’,
|
150
|
+
email: ‘rehor.jan@cpost.cz’ }
|
151
|
+
sending_data = { contract_id: configuration.contract_id,
|
152
|
+
parcels_sending_date: Date.today,
|
153
|
+
sending_post_office_location_number: 1,
|
154
|
+
sender: short_sender_data,
|
155
|
+
cash_on_delivery: {
|
156
|
+
address: short_sender_data[:address]
|
157
|
+
bank_account: ‘123456-1234567890/1234’
|
158
|
+
} }</p>
|
159
|
+
|
160
|
+
<pre class="code ruby"><code class="ruby">short_addressee_data = { address: {
|
161
|
+
first_name: 'Petr',
|
162
|
+
last_name: 'Foton',
|
163
|
+
street: 'Fischerova',
|
164
|
+
house_number: '686',
|
165
|
+
sequence_number: '32',
|
166
|
+
city_part: 'Nové Sady',
|
167
|
+
city: 'Olomouc',
|
168
|
+
post_code: 77_900
|
169
|
+
},
|
170
|
+
email: 'foton@github.com',
|
171
|
+
mobile_phone: '+420777888999' }
|
172
|
+
|
173
|
+
parcels = [
|
174
|
+
{
|
175
|
+
addressee: short_addressee_data,
|
176
|
+
params: { parcel_id: 'package_1of2',
|
177
|
+
parcel_code_prefix: 'BA',
|
178
|
+
weight_in_kg: 1.0,
|
179
|
+
parcel_order: 1,
|
180
|
+
parcels_count: 2 },
|
181
|
+
services: [70, 7, 'S']
|
182
|
+
},
|
183
|
+
{
|
184
|
+
addressee: short_addressee_data,
|
185
|
+
params: { parcel_id: 'package_2of2',
|
186
|
+
parcel_code_prefix: 'BA',
|
187
|
+
weight_in_kg: 1.6,
|
188
|
+
parcel_order: 2,
|
189
|
+
parcels_count: 2 },
|
190
|
+
services: [70,'S']
|
191
|
+
},
|
192
|
+
{
|
193
|
+
addressee: short_addressee_data,
|
194
|
+
params: { parcel_id: 'package_3',
|
195
|
+
parcel_code_prefix: 'BA',
|
196
|
+
weight_in_kg: 1.9 },
|
197
|
+
services: [7,'M']
|
198
|
+
}
|
199
|
+
] ```
|
200
|
+
</code></pre>
|
201
|
+
|
202
|
+
<p>1) Pack your parcel(s)</p>
|
203
|
+
|
204
|
+
<p>2) Call <code>ParcelsSender</code>, this will store in <code>result</code> <code>transmission_id</code> and expected time to ask for results.
|
205
|
+
```
|
206
|
+
psender = ParcelsSender.call(sending_data: sending_data, parcels: parcels)</p>
|
207
|
+
|
208
|
+
<pre class="code ruby"><code class="ruby"> if psender.success?
|
209
|
+
result = psender.result
|
210
|
+
processing_end_time_utc = (result.processing_end_expected_at - (60 *60)).utc # API returns time in CET but marked as UTC
|
211
|
+
transaction_id = result.transaction_id
|
212
|
+
else
|
213
|
+
puts psender.errors.full_messages
|
214
|
+
end
|
215
|
+
```
|
216
|
+
For now, `parcels` is array of complicated hashes; each parcel must have `parcel_id` key (your ID of parcel).
|
217
|
+
</code></pre>
|
218
|
+
|
219
|
+
<p>3) When such expected time pass, ask for results by calling <code>ParcelsSendProcessUpdater</code>.</p>
|
220
|
+
|
221
|
+
<pre class="code ruby"><code class="ruby"> You can get error `Processing is not yet finished` or hash based on `parcel_id` keys.
|
222
|
+
Eg. :
|
223
|
+
```
|
224
|
+
pudater = ParcelsSendProcessUpdater.call(transmission_id: transmission_id)
|
225
|
+
|
226
|
+
if pupdater.success?
|
227
|
+
update_my_parcels_with(pupdater.result) # => { 'parcel_1of2' => { parcel_code: 'BA12354678', states: [{ code: 1, text: 'OK' }]},
|
228
|
+
# 'parcel_2of2' => { parcel_code: 'BA12354679', states: [{ code: 1, text: 'OK' }]},
|
229
|
+
# 'parcel_3' => { parcel_code: 'BA12354680', states: [{ code: 1, text: 'OK' }]}
|
230
|
+
else
|
231
|
+
puts psender.errors.full_messages # => "response_state: ResponseCode[19 BATCH_INVALID] V dávce se vyskytují chybné záznamy"
|
232
|
+
# "parcels: Parcel[parcel_2of2] => ResponseCode[104 INVALID_WEIGHT] Hmotnost mimo povolený rozsah"
|
233
|
+
# "parcels: Parcel[parcel_2of2] => ResponseCode[261 MISSING_SIZE_CATEGORY] Neuvedena rozměrová kategorie zásilky"
|
234
|
+
# "parcels: Parcel[parcel_3] => ResponseCode[310 INVALID_PREFIX] Neplatný typ zásilky"
|
235
|
+
end
|
236
|
+
```
|
237
|
+
`parcel_code` is CzechPost ID of parcel and is used in following calls.
|
238
|
+
</code></pre>
|
239
|
+
|
240
|
+
<p>4) Print address sheets of parcels(s) by calling <code>AddressSheetsGenerator</code>.
|
241
|
+
See <a href="./lib/czech_post_b2b_client/printing_templates.rb">template_classes</a> for available templates.
|
242
|
+
Eg. :
|
243
|
+
```
|
244
|
+
parcel_codes = %w[RA123456789 RR123456789F RR123456789G] # beware of parcel_id!
|
245
|
+
options = {
|
246
|
+
customer_id: configuration.customer_id, # required
|
247
|
+
contract_number: configuration.contract_id, # not required
|
248
|
+
template_id: 24, # ‘obalka 3 - B4’ #
|
249
|
+
margin_in_mm: { top: 5, left: 3 } # required
|
250
|
+
}</p>
|
251
|
+
|
252
|
+
<pre class="code ruby"><code class="ruby"> adrprinter = AddressSheetsGenerator.call(parcel_codes: parcel_codes, options: options )
|
253
|
+
|
254
|
+
if adrprinter.success?
|
255
|
+
File.write("adrsheet.pdf", adrprinter.result.pdf_content)
|
256
|
+
else
|
257
|
+
puts(adrprinter.errors.full_messages)
|
258
|
+
end
|
259
|
+
```
|
260
|
+
</code></pre>
|
261
|
+
|
262
|
+
<p>5) Repeat steps 1-4 until You decide to deliver packages to post office.</p>
|
263
|
+
|
264
|
+
<p>6) Close your parcels submission with call <code>ParcelsSubmissionCloser.call(sending_data: sender_data)</code>.</p>
|
265
|
+
|
266
|
+
<p>7) <em>They will await You at post office with warm welcome (hopefully). Parcels which are not delivered within 60 days are removed from CzechPost systems for free :-)</em></p>
|
267
|
+
|
268
|
+
<p>8) You can check current status of delivering with <code>DeliveringInspector</code>, which will return hash based on <code>parcel_code</code> keys.
|
269
|
+
Eg. :
|
270
|
+
```
|
271
|
+
delivery_boy = DeliveringInspector.call(parcel_codes: parcel_codes)</p>
|
272
|
+
|
273
|
+
<pre class="code ruby"><code class="ruby"> if delivery_boy.success?
|
274
|
+
update_my_parcels_delivery_status_with(delivery_boy.result)
|
275
|
+
# result is like:
|
276
|
+
# { 'RA12345687' => { current_state: { id: '91',
|
277
|
+
date: Date.parse('2015-09-04'),
|
278
|
+
text: 'Dodání zásilky.',
|
279
|
+
post_code: '25756',
|
280
|
+
post_name: 'Neveklov'},
|
281
|
+
deposited_until: Date.new(2015, 9, 2),
|
282
|
+
deposited_for_days: 15,
|
283
|
+
all_states: [
|
284
|
+
{ id: '21', date: Date.parse('2015-09-02'), text: 'Podání zásilky.', post_code: '26701', post_name: 'Králův Dvůr u Berouna' },
|
285
|
+
{ id: '-F', date: Date.parse('2015-09-03'), text: 'Vstup zásilky na SPU.', post_code: '22200', post_name: 'SPU Praha 022' },
|
286
|
+
{ id: '-I', date: Date.parse('2015-09-03'), text: 'Výstup zásilky z SPU.', post_code: '22200', post_name: 'SPU Praha 022' },
|
287
|
+
{ id: '-B', date: Date.parse('2015-09-03'), text: 'Přeprava zásilky k dodací poště.', post_code: nil, post_name: nil },
|
288
|
+
{ id: '51', date: Date.parse('2015-09-04'), text: 'Příprava zásilky k doručení.', post_code: '25607', post_name: 'Depo Benešov 70' },
|
289
|
+
{ id: '53', date: Date.parse('2015-09-04'), text: 'Doručování zásilky.', post_code: '25756', post_name: 'Neveklov' },
|
290
|
+
{ id: '91', date: Date.parse('2015-09-04'), text: 'Dodání zásilky.', post_code: '25756', post_name: 'Neveklov' }
|
291
|
+
]},
|
292
|
+
'BA56487125' => {...}
|
293
|
+
}
|
294
|
+
else
|
295
|
+
puts(delivery_boy.errors.full_messages)
|
296
|
+
end
|
297
|
+
```
|
298
|
+
</code></pre>
|
299
|
+
|
300
|
+
<p>9) And You can always ask for statistics!
|
301
|
+
<code>
|
302
|
+
tps = TimePeriodStatisticator.call(from_date: Date.today - 5, to_date: Date.today)
|
303
|
+
if tps.success?
|
304
|
+
result = tps.result
|
305
|
+
result.requests.total # => 26,
|
306
|
+
result.requests.with_errors # => 16
|
307
|
+
result.requests.successful # => 10
|
308
|
+
result.imported_parcels # => 3
|
309
|
+
else
|
310
|
+
puts(tps.errors.full_messages)
|
311
|
+
end
|
312
|
+
</code></p>
|
313
|
+
|
314
|
+
<h3 id="example-usage">Example usage</h3>
|
315
|
+
|
316
|
+
<p>See <code>test/integration_test.rb</code> for almost production usage. HTTP calls to B2B services are blocked and responses from them are stubbed.</p>
|
317
|
+
|
318
|
+
<p>You can quickly check you setup by altering config and run <code>ruby try_api_calls.rb</code> see <a href="./examples/try_api_calls.rb"><code>try_api_calls.rb</code></a>.</p>
|
319
|
+
|
320
|
+
<h2 id="troubleshooting">Troubleshooting</h2>
|
321
|
+
|
322
|
+
<p>1) Read all stuff in <code>doc</code>, maybe it helps.
|
323
|
+
2) If You get “handshake protocol failed” You do not have correct setup for certificates. If You get any xml response (see logger in debug mode) certificates are ok.
|
324
|
+
You can always try <code>TimePeriodStatisticator</code> for that check, it do not need any “before” actions.
|
325
|
+
3) Error <code>UNAUTHORIZED_ROLE_ACCESS</code> means wrong <code>customer_id</code> or You are not yet registered in “PodáníOnline”
|
326
|
+
4) Error <code>11: INVALID_LOCATION</code> was occuring when only <code>sending_post_office_code</code> was used. Try to use <code>sending_post_office_location_number</code>.
|
327
|
+
5) And last tip <code>261 MISSING_SIZE_CATEGORY</code> -> add correct “size service” to services (eg: ‘S’, ‘M’)
|
328
|
+
6) Compare resulting request XML with examples in <code>test/request_builders</code></p>
|
329
|
+
|
330
|
+
<h2 id="development">Development</h2>
|
331
|
+
|
332
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake test</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
333
|
+
|
334
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>lib/czech_post_b2b_client/version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
|
335
|
+
|
336
|
+
<h2 id="contributing">Contributing</h2>
|
337
|
+
|
338
|
+
<p>Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/czech_post_b2b_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the <a href="http://contributor-covenant.org">Contributor Covenant</a> code of conduct.</p>
|
339
|
+
|
340
|
+
<h2 id="license">License</h2>
|
341
|
+
|
342
|
+
<p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
343
|
+
|
344
|
+
<h2 id="code-of-conduct">Code of Conduct</h2>
|
345
|
+
|
346
|
+
<p>Everyone interacting in the CzechPostB2bClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the <a href="https://github.com/[USERNAME]/czech_post_b2b_client/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
|
347
|
+
</div></div>
|
348
|
+
|
349
|
+
<div id="footer">
|
350
|
+
Generated on Fri Mar 20 17:49:05 2020 by
|
351
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
352
|
+
0.9.19 (ruby-2.4.1).
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</div>
|
356
|
+
</body>
|
357
|
+
</html>
|