go() public method

public go ( )
コード例 #1
0
ファイル: OFX.php プロジェクト: hannenijhuis/invoiceninja
 public function setup($includeTransactions = true)
 {
     $ofxRequest = "OFXHEADER:100\n" . "DATA:OFXSGML\n" . "VERSION:102\n" . "SECURITY:NONE\n" . "ENCODING:USASCII\n" . "CHARSET:1252\n" . "COMPRESSION:NONE\n" . "OLDFILEUID:NONE\n" . "NEWFILEUID:NONE\n" . "\n" . "<OFX>\n" . "<SIGNONMSGSRQV1>\n" . "<SONRQ>\n" . "<DTCLIENT>20110412162900.000[-7:MST]\n" . "<USERID>" . $this->login->id . "\n" . "<USERPASS>" . $this->login->pass . "\n" . "<LANGUAGE>ENG\n" . "<FI>\n" . "<ORG>" . $this->login->bank->org . "\n" . "<FID>" . $this->login->bank->fid . "\n" . "</FI>\n" . "<APPID>QWIN\n" . "<APPVER>2500\n" . "</SONRQ>\n" . "</SIGNONMSGSRQV1>\n";
     if ($this->type == 'BANK') {
         $ofxRequest .= "\t<BANKMSGSRQV1>\n" . "\t\t<STMTTRNRQ>\n" . "\t\t\t<TRNUID>" . md5(time() . $this->login->bank->url . $this->id) . "\n" . "\t\t\t<STMTRQ>\n" . "\t\t\t\t<BANKACCTFROM>\n" . "\t\t\t\t\t<BANKID>" . $this->bankId . "\n" . "\t\t\t\t\t<ACCTID>" . $this->id . "\n" . "\t\t\t\t\t<ACCTTYPE>" . $this->subType . "\n" . "\t\t\t\t</BANKACCTFROM>\n" . "\t\t\t\t<INCTRAN>\n" . "\t\t\t\t\t<DTSTART>20110301\n" . "\t\t\t\t\t<INCLUDE>" . ($includeTransactions ? 'Y' : 'N') . "\n" . "\t\t\t\t</INCTRAN>\n" . "\t\t\t</STMTRQ>\n" . "\t\t</STMTTRNRQ>\n" . "\t</BANKMSGSRQV1>\n";
     } elseif ($this->type == 'CC') {
         $ofxRequest .= "\t<CREDITCARDMSGSRQV1>\n" . "\t\t<CCSTMTTRNRQ>\n" . "\t\t\t<TRNUID>" . md5(time() . $this->login->bank->url . $this->id) . "\n" . "\t\t\t<CCSTMTRQ>\n" . "\t\t\t\t<CCACCTFROM>\n" . "\t\t\t\t\t<ACCTID>" . $this->id . "\n" . "\t\t\t\t</CCACCTFROM>\n" . "\t\t\t\t<INCTRAN>\n" . "\t\t\t\t\t<DTSTART>20110320\n" . "\t\t\t\t\t<INCLUDE>" . ($includeTransactions ? 'Y' : 'N') . "\n" . "\t\t\t\t</INCTRAN>\n" . "\t\t\t</CCSTMTRQ>\n" . "\t\t</CCSTMTTRNRQ>\n" . "\t</CREDITCARDMSGSRQV1>\n";
     }
     $ofxRequest .= "</OFX>";
     $o = new OFX($this->login->bank, $ofxRequest);
     $o->go();
     $this->response = $o->response;
     $x = $o->xml();
     $a = $x->xpath('/OFX/*/*/*/LEDGERBAL/BALAMT');
     $this->ledgerBalance = (double) $a[0];
     $a = $x->xpath('/OFX/*/*/*/AVAILBAL/BALAMT');
     if (isset($a[0])) {
         $this->availableBalance = (double) $a[0];
     }
 }