Untitled
unknown
plain_text
a year ago
1.4 kB
3
Indexable
Never
protected function action(): Response { $data = $this->getFormData(); $body = []; // bank $bank = $this->bankRepository->findByUuid($data->bankId); foreach ($data as $k => $v) { $body[$k] = $v; } if (empty($body["vaId"])) { $body["vaId"] = Uuid::uuid4();; } unset($body["bankId"]); $body["bank"] = $bank; $va = new Va($body); $va = $this->vaRepository->add($va); $this->logger->info("Bank `" . $va->getAccountNumber() . " was created."); // $now = new \DateTime(); $newExpiredDate = new \DateTime('now + 3 week'); $institutionCode = $_ENV["BRI_INSTITUTION_CODE"]; $briva = new Briva([ "clientId" => $_ENV['BRI_CLIENT_ID'], "clientSecret" => $_ENV['BRI_CLIENT_SECRET'], "institutionCode" => $institutionCode, "brivaNo" => $va->getBank()->getVaCode(), "endpoint" => $_ENV["BRIVA_ENDPOINT"], "nama" => $va->getAccountName(), "custCode" => $va->getPhone(), "keterangan" => "perubahan expire", "amount" => "0", "expiredDate" => $newExpiredDate->format("Y-m-d H:i:s") ]); $queryResult = $briva->registerVA(); $this->logger->info($queryResult); // $brivaAccount = json_decode($queryResult); return $this->respondWithData($va, 201); // $this->respondWithData(json_encode($brivaAccount, JSON_PRETTY_PRINT)); }