Ejemplo n.º 1
0
 /**
  * Constructor.
  *
  * @param string $input Optional, a string with DTAZV data to import.
  *
  * @access public
  */
 function __construct($input = null)
 {
     parent::__construct();
     $this->max_amount = 12500 * 100;
     if (is_string($input)) {
         try {
             $this->parse($input);
         } catch (Payment_DTA_FatalParseException $e) {
             // cannot construct this object, reset everything
             parent::__construct();
             $this->max_amount = 12500 * 100;
             $this->allerrors[] = $e;
         } catch (Payment_DTA_Exception $e) {
             // object is valid, but save the error
             $this->allerrors[] = $e;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructor. Creates an empty DTA object or imports one.
  *
  * If the parameter is a string, then it is expected to be in DTA format
  * an its content (sender and transactions) is imported. If the string cannot
  * be parsed at all then an empty DTA object with type DTA_CREDIT is returned.
  * If only parts of the string can be parsed, then all transactions before the
  * error are included into the object.
  * The user should use getParsingError() to check whether a parsing error occured.
  *
  * Otherwise the parameter has to be the type of the new DTA object,
  * either DTA_CREDIT or DTA_DEBIT. In this case exceptions are never
  * thrown to ensure compatibility.
  *
  * @param integer|string $type Either a string with DTA data or the type of the
  *                       new DTA file (DTA_CREDIT or DTA_DEBIT). Must be set.
  *
  * @access public
  */
 function __construct($type)
 {
     parent::__construct();
     $this->sum_bankcodes = 0;
     $this->sum_accounts = 0;
     if (is_int($type)) {
         $this->type = $type;
     } else {
         try {
             $this->parse($type);
         } catch (Payment_DTA_FatalParseException $e) {
             // cannot construct this object, reset everything
             parent::__construct();
             $this->sum_bankcodes = 0;
             $this->sum_accounts = 0;
             $this->type = DTA_CREDIT;
             $this->allerrors[] = $e;
         } catch (Payment_DTA_Exception $e) {
             // object is valid, but save the error
             $this->allerrors[] = $e;
         }
     }
 }