Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • PostalMethods

Class PostalMethods

PostalMethods service for physically mailing letters

Package: blesta\components\delivery\postal\methods
Copyright: Copyright (c) 2011, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at components/delivery/postal_methods/postal_methods.php

Methods summary

public
# __construct( )

Constructs a new PostalMethods component

Constructs a new PostalMethods component

public
# setApiKey( string $api_key )

Sets the Postal Methods API Key required for making requests

Sets the Postal Methods API Key required for making requests

Parameters

$api_key
string
$api_key The Postal Methods API key
public
# setTestMode( boolean $test_mode )

Sets whether Postal Methods should physically mail the document, or simulate it

Sets whether Postal Methods should physically mail the document, or simulate it

Parameters

$test_mode
boolean
$test_mode False to physically mail documents, true to only simulate it
public
# setFile( array $file )

Sets the file and file type of the file to be mailed

Sets the file and file type of the file to be mailed

Parameters

$file
array
$file A key=>value array of the file and it's extension -file The bitstream of the file to send in binary -type The type of file this is (i.e. HTML, DOC, DOCX, or PDF), (optional, default PDF)
public
# setToAddress( array $address )

Sets the outside address

Sets the outside address

Parameters

$address
array
$address A list of attributes attributes including: -name The name of the recipient -company The company name -address1 Address1 -address2 Address2 -city The city -state The ISO 3166-2 subdivision code -zip The postal code -country_code The ISO 3166-1 alpha3 country code
public
# setReplyEnvelope( boolean $include_reply_envelope )

Sets a reply envelope to be included in the mail

Sets a reply envelope to be included in the mail

Parameters

$include_reply_envelope
boolean
$include_reply_envelope True to include a reply envelope in the mail, false to not include a reply envelope

See

PostalMethods::setToAddress()

Notes

An address must be explicitly set in order to include a reply envelope
public
# setPerforated( boolean $perforated )

Sets whether the bottom-third of the letter sent to PostalMethods should be perforated

Sets whether the bottom-third of the letter sent to PostalMethods should be perforated

Parameters

$perforated
boolean
$perforated True to have the bottom-third of the letter perforated, false to not perforate the letter

See

PostalMethods::setToAddress()

Notes

An address must be explicitly set in order to have this letter perforated
public
# setDescription( string $description )

Sets a description to associate with this letter in the PostalMethods account

Sets a description to associate with this letter in the PostalMethods account

Parameters

$description
string
$description A description to associate with this letter. Limit 100 characters
public array
# getFileTypes( )

Retrieves a list of available file types accepted by Postal Methods

Retrieves a list of available file types accepted by Postal Methods

Returns

array
A numerically-indexed array of available file types
public
# resetAll( )

Resets all settings back to default except for the account username and password

Resets all settings back to default except for the account username and password

public
# send( )

Sends the document to Postal Methods for mailing

Sends the document to Postal Methods for mailing

private boolean
# parseResponse( string $response )

Parses the SOAP response from PostalMethods, sets any errors that may have been generated

Parses the SOAP response from PostalMethods, sets any errors that may have been generated

Parameters

$response
string
$response The SOAP response from PostalMethods

Returns

boolean
true on success, false on error
private
# buildXml( mixed $action = "SendLetter" )

Builds the data to be sent to Postal Methods

Builds the data to be sent to Postal Methods

private string
# buildAdvancedLetter( array $settings )

Builds the XML for the advanced letter type

Builds the XML for the advanced letter type

Parameters

$settings
array
$settings A list of input settings including: -file The file -file_type The file type -work_mode The work/test mode (Production or Development)

Returns

string
The formatted XML
private string
# buildAddressXml( array $address )

Builds the XML for addresses given the address key=>value pairs as XML fields

Builds the XML for addresses given the address key=>value pairs as XML fields

Returns

string
The formatted XML
public array
# errors( )

Returns all errors set in this object

Returns all errors set in this object

Returns

array
An array of error info

Magic methods summary

Properties summary

private static string $url
#

The URL to submit requests to

The URL to submit requests to

private string $api_key
#

The account API key

The account API key

private array $file
#

An array of a file's bitstream data and file type

An array of a file's bitstream data and file type

private string $description
#

An optional description to associate with this letter

An optional description to associate with this letter

private boolean $test_mode
#

Whether or not documents should be mailed, or simply simulated

Whether or not documents should be mailed, or simply simulated

private array $to_address
#

A list of address fields to send to

A list of address fields to send to

private boolean $include_reply_envelope
#

Whether or not to include a reply envelope

Whether or not to include a reply envelope

private boolean $perforate_document
#

Whether or not the bottom-third of the letter should be perforated

Whether or not the bottom-third of the letter should be perforated

private array $available_file_types
#

An array of available file types accepted by Postal Methods NOTE: These file types are acceptable when the address is inside of the document

An array of available file types accepted by Postal Methods NOTE: These file types are acceptable when the address is inside of the document

Blesta API documentation generated by ApiGen 2.8.0