/**
  * 取引登録を実行する
  *
  * @param  EntryTranInput $input  入力パラメータ
  * @return EntryTranOutput $output 出力パラメータ
  * @exception GPayException
  */
 function exec(&$input)
 {
     // 元の店舗名を退避
     $tdTenantName = $input->getTdTenantName();
     // 3Dセキュア店舗名をBASE64暗号化
     $encrypt = new Cryptgram();
     $encodeTdTenantName = $encrypt->encodeBase64($input->getTdTenantName());
     if (!is_null($encodeTdTenantName) && strlen($encodeTdTenantName) > 25) {
         $this->exception = new GPayException("3Dセキュア店舗名のBASE64暗号化後の長さが25Byteを超えています。", $this->exception);
         return null;
     }
     // 暗号化文字列を再セット
     $input->setTdTenantName($encodeTdTenantName);
     // 接続しプロトコル呼び出し・結果取得
     $resultMap = $this->callProtocol($input->toString());
     // 店舗名を退避しておいた元の文字列に戻す
     $input->setTdTenantName($tdTenantName);
     // 戻り値がnullの場合、nullを戻す
     if (is_null($resultMap)) {
         return null;
     }
     // EntryTranOutput作成し、戻す
     return new EntryTranOutput($resultMap);
 }
function execTran($member_id, $order_id, $amount)
{
    global $log;
    $entryInput = new EntryTranInput();
    $entryInput->setShopId(PGCARD_SHOP_ID);
    $entryInput->setShopPass(PGCARD_SHOP_PASS);
    $entryInput->setJobCd(JOB_CODE_CAPTURE);
    $entryInput->setOrderId($order_id);
    $entryInput->setAmount($amount);
    $execInput = new ExecTranInput();
    $execInput->setOrderId($order_id);
    $execInput->setMethod(1);
    $execInput->setSiteId(PGCARD_SITE_ID);
    $execInput->setSitePass(PGCARD_SITE_PASS);
    $execInput->setMemberId($member_id);
    $execInput->setCardSeq(CARD_SEQ_DEFAULT);
    $input = new EntryExecTranInput();
    /* @var $input EntryExecTranInput */
    $input->setEntryTranInput($entryInput);
    $input->setExecTranInput($execInput);
    $exe = new EntryExecTran();
    /* @var $exec EntryExecTran */
    $output = $exe->exec($input);
    /* @var $output EntryExecTranOutput */
    $log->info(serialize($input));
    $log->info(serialize($output));
    foreach ($output->getEntryErrList() as $err) {
        $log->error(serialize($input));
        $log->error(serialize($output));
        $errInfo = $err->getErrInfo();
        throw new Exception($errInfo);
    }
    foreach ($output->getExecErrList() as $err) {
        $log->error(serialize($input));
        $log->error(serialize($output));
        $errInfo = $err->getErrInfo();
        throw new Exception($errInfo);
    }
    return $output;
}