(index ("make-request" 0) ("update-request" 2821) ("process-request" 3277) ("request-service" 3823) ("request-from-zip" 3823) ("request-to-zip" 3823) ("request-company" 3823) ("request-password" 3823) ("request-pkg-weight" 3823) ("request-pkg-format" 3823) ("request-pkg-length" 3823) ("request-pkg-height" 3823) ("request-pkg-breadth" 3823) ("request-pkg-diameter" 3823) ("request-receiver-id-check" 3823) ("request-declared-value" 3823) ("request-return-receipt" 3823) ("request-return-url" 3823) ("response" 5062) ("response-service" 5404) ("response-cost" 5609) ("response-delivery-time" 5785) ("response-receiver-id-check-cost" 5943) ("response-return-receipt-cost" 6211) ("response-declared-value-cost" 6472) ("response-home-delivery" 6715) ("response-saturday-delivery" 6992) ("response-error" 7214) ("response-error-msg" 7611) ("valid-response?" 7914))
(def (sig (procedure "(make-request #!key service from-zip to-zip (company \"\") (password \"\") (pkg-weight 0.3) (pkg-format 1) (pkg-length 16) (pkg-height 2) (pkg-breadth 11) (pkg-diameter 0) (receiver-id-check #f) (declared-value 0) (return-receipt #f) (return-url \"XML\"))" (id make-request))) (p "Create a correios " (tt "request") " object (a " (int-link "defstruct") " record) to be processed. It has many attributes that correspond to the official " (link "http://www.correios.com.br/webServices/PDF/SCPP_manual_implementacao_calculo_remoto_de_precos_e_prazos.pdf" "Correios web service specification") ":") (dl (dt "SERVICE") (dd "available delivery services: " (tt "'PAC") ", " (tt "'SEDEX") ", " (tt "'SEDEX-10") ", " (tt "'SEDEX-HOJE") " and " (tt "'SEDEX-A-COBRAR") ". It can also be a list combining one or more of these symbols (ie. " (tt "'(PAC SEDEX SEDEX-10)") ").") (dt "FROM-ZIP") (dd "sender's zip code and should be a string with 8 digits (only numbers allowed).") (dt "TO-ZIP") (dd "receiver's zip code and should be a string with 8 digits (only numbers allowed).") (dt "COMPANY") (dd "company code, if yours has one. It should be a string.") (dt "PASSWORD") (dd "company password, only if a company code is provided. It should be a string.") (dt "PKG-WEIGHT") (dd "package weight in kilograms. Should be a number.") (dt "PKG-FORMAT") (dd "package format and should be a number: 1 for box/package, 2 for roller/prism and 3 for envelope.") (dt "PKG-LENGTH") (dd "package length in centimeters (including packing size) and should be a number.") (dt "PKG-HEIGHT") (dd "package height in centimeters (including packing size) and should be a number.") (dt "PKG-BREADTH") (dd "package breadth in centimeters (including packing size) and should be a number.") (dt "PKG-DIAMETER") (dd "package diameter in centimeters (including packing size) and should be a number.") (dt "RECEIVER-ID-CHECK") (dd "a boolean and determines whether the package should be delivered only to the receiver's hand (Correios calls this service \"Mão própria\").") (dt "DECLARED-VALUE") (dd "package declared value in Brazillian Reais, to be returned in case of miscarriage. It should be a number - ex.: " (tt "33.50") " (default is " (tt "0") ", which means no use of service).") (dt "RETURN-RECEIPT") (dd "a boolean and determines whether the package should be delivered with additional service of a return receipt (" (tt "#f") " means no use of the service).") (dt "RETURN-URL") (dd "request return URL or type - at the moment can only be \"XML\".")) (p (b "Note:") " although all values returned use Brazillian decimal notation with a comma separating cents from integers (ex.: " (tt "3,25") "), all the decimal values provided to " (tt "make-request") " should have a dot (ex.: " (tt "3.25") ") separating those parts."))
(def (sig (procedure "(update-request old-request #!key service from-zip to-zip company password pkg-weight pkg-format pkg-length pkg-height pkg-breadth pkg-diameter receiver-id-check declared-value return-receipt return-url)" (id update-request))) (p "Like make-request, except this takes an old-request object as a template for values which are missing from the parameter list, thereby providing a way to do a purely functional update of that object."))
(def (sig (procedure "(process-request REQUEST)" (id process-request))) (p "This is the core procedure for shipping cost calculation. It accepts a " (tt "request") " object as a parameter and returns a " (i "list") " of " (tt "response") " objects. The list can be processed (see " (int-link "#examples" "Examples") " below) and data can be extracted from each response using its accessors (see " (int-link "#responses" ((tt "response"))) " details below).") (p "For each " (tt "request") " attribute there is a respective accessor procedure:"))
(def (sig (procedure "(request-service REQUEST) => SERVICE" (id request-service)) (procedure "(request-from-zip REQUEST) => FROM-ZIP" (id request-from-zip)) (procedure "(request-to-zip REQUEST) => TO-ZIP" (id request-to-zip)) (procedure "(request-company REQUEST) => COMPANY" (id request-company)) (procedure "(request-password REQUEST) => PASSWORD" (id request-password)) (procedure "(request-pkg-weight REQUEST) => PKG-WEIGHT" (id request-pkg-weight)) (procedure "(request-pkg-format REQUEST) => PKG-FORMAT" (id request-pkg-format)) (procedure "(request-pkg-length REQUEST) => PKG-LENGTH" (id request-pkg-length)) (procedure "(request-pkg-height REQUEST) => PKG-HEIGHT" (id request-pkg-height)) (procedure "(request-pkg-breadth REQUEST) => PKG-BREADTH" (id request-pkg-breadth)) (procedure "(request-pkg-diameter REQUEST) => PKG-DIAMETER" (id request-pkg-diameter)) (procedure "(request-receiver-id-check REQUEST) => RECEIVER-ID-CHECK" (id request-receiver-id-check)) (procedure "(request-declared-value REQUEST) => DECLARED-VALUE" (id request-declared-value)) (procedure "(request-return-receipt REQUEST) => RETURN-RECEIPT" (id request-return-receipt)) (procedure "(request-return-url REQUEST) => RETURN-URL" (id request-return-url))))
(def (sig (record "response" (id response))) (p "This is a correios shipping response object that is generated by " (tt "process-request") ". It is a " (int-link "defstruct") " record and has a constructor " (tt "make-response") " (used only internally). It has 10 attributes that can be retrieved using the respective accessor procedure:"))
(def (sig (procedure "(response-service RESPONSE) => SERVICE" (id response-service))) (p "Returns the delivery service type as a symbol - ie. " (tt "'PAC") ", " (tt "'SEDEX") " or " (tt "SEDEX-10)") "."))
(def (sig (procedure "(response-cost RESPONSE) => COST" (id response-cost))) (p "Returns the total delivery cost in Brazillian Reais as a string - ie. " (tt "\"15,80\"") "."))
(def (sig (procedure "(response-delivery-time RESPONSE) => DELIVERY-TIME" (id response-delivery-time))) (p "Returns the delivery time in days as a number."))
(def (sig (procedure "(response-receiver-id-check-cost RESPONSE) => RECEIVER-ID-CHECK-COST" (id response-receiver-id-check-cost))) (p "Returns the cost of the " (tt "receiver-id-check") " service (if used) in Brazillian Reais as a string - ie. " (tt "\"3,20\"") "."))
(def (sig (procedure "(response-return-receipt-cost RESPONSE) => RETURN-RECEIPT-COST" (id response-return-receipt-cost))) (p "Returns the cost of the " (tt "return-receipt-cost") " service (if used) in Brazillian Reais as a string - ie. " (tt "\"2,90\"") "."))
(def (sig (procedure "(response-declared-value-cost RESPONSE) => DECLARED-VALUE-COST" (id response-declared-value-cost))) (p "Returns the cost of " (tt "declared-value") " service in Brazillian Reais as a string - ie. " (tt "\"32,50\"") "."))
(def (sig (procedure "(response-home-delivery RESPONSE) => HOME-DELIVERY" (id response-home-delivery))) (p "Returns a boolean indicating whether or not the " (tt "home-delivery") " service is available (believe it or not there are still many inaccessible areas in Brazil!)."))
(def (sig (procedure "(response-saturday-delivery RESPONSE) => SATURDAY-DELIVERY" (id response-saturday-delivery))) (p "Returns a boolean indicating whether or not the " (tt "saturday-delivery") " service is available."))
(def (sig (procedure "(response-error RESPONSE) => ERROR" (id response-error))) (p "Returns " (tt "\"0\"") " if there were no errors or other number (in a string format) if so (see pages 14 and 15 of the " (link "http://www.correios.com.br/webServices/PDF/SCPP_manual_implementacao_calculo_remoto_de_precos_e_prazos.pdf" "Correios web service specification") " for a complete error code list)."))
(def (sig (procedure "(response-error-msg RESPONSE) => ERROR-MSG" (id response-error-msg))) (p "Returns a " (tt "#f") " if there were no errors or a string with the error message.") (p "There is also a procedure to check if there " (tt "response") " generated by " (tt "process-request") " is valid:"))
(def (sig (procedure "(valid-response? RESPONSE)" (id valid-response?))) (p "Check if a specific response has generated errors. Returns a boolean."))
