/** * 登録・決済を実行する * * @param EntryExecTranInput $input 入力パラメータ * @return EntryExecTranOutput 登録・決済出力パラメータ * @exception GPayException */ function exec(&$input) { // 取引登録入力パラメータを取得 $entryTranInput =& $input->getEntryTranInput(); // 決済実行入力パラメータを取得 $execTranInput =& $input->getExecTranInput(); // 登録・決済出力パラメータを生成 $output = new EntryExecTranOutput(); // 取引ID、取引パスワードを取得 $accessId = $execTranInput->getAccessId(); $accessPass = $execTranInput->getAccessPass(); // 取引ID、取引パスワードが設定されていないとき if (is_null($accessId) || 0 == strlen($accessId) || is_null($accessPass)) { // 取引登録を実行 $this->log->debug("取引登録実行"); $entryTran = new EntryTran(); $entryTranOutput = $entryTran->exec($entryTranInput); if ($this->errorTrap($entryTran)) { return $output; } // 取引ID、取引パスワードを決済実行用のパラメータに設定 $accessId = $entryTranOutput->getAccessId(); $accessPass = $entryTranOutput->getAccessPass(); $execTranInput->setAccessId($accessId); $execTranInput->setAccessPass($accessPass); $output->setEntryTranOutput($entryTranOutput); } $this->log->debug("取引ID : [{$accessId}] 取引パスワード : [{$accessPass}]"); // 取引登録でエラーが起きたとき決済を実行せずに戻る if ($output->isEntryErrorOccurred()) { $this->log->debug("<<<取引登録失敗>>>"); return $output; } // 決済実行 $this->log->debug("決済実行"); $execTran = new ExecTran(); $execTranOutput = $execTran->exec($execTranInput); $output->setExecTranOutput($execTranOutput); $this->errorTrap($execTran); return $output; }