Ejemplo n.º 1
0
 public function responseBniEcollection($response, $clientId, $secretKey)
 {
     if (v::json()->validate($response) === false) {
         throw new BillingException('Format response from bni ecollection is invalid');
     }
     $responseArray = json_decode($response, true);
     if ($responseArray['status'] != '000') {
         throw new BillingException($responseArray['message']);
     }
     $decryptData = DclHashing::parseData($responseArray['data'], $clientId, $secretKey);
     if ($decryptData == null) {
         throw new BillingException('Failed decrypt response from bni ecollection');
     }
     return json_encode(['status' => true, 'data' => $decryptData]);
 }
 /**
  * Set the value of Request
  *
  * @return self
  */
 public function setRequest()
 {
     $requestArray = ["client_id" => $this->getClientId(), "trx_amount" => $this->getTrxAmount(), "customer_name" => $this->getCustomerName(), "customer_email" => $this->getCustomerEmail(), "customer_phone" => $this->getCustomerPhone(), "virtual_account" => $this->getVirtualAccount(), "trx_id" => $this->getTrxId(), "datetime_expired" => $this->getDateTimeExpired(), "description" => $this->getDescription(), "type" => $this->getTypeTransaction(), "billing_type" => $this->getBillingType()];
     $requestHash = DclHashing::hashData($requestArray, $this->getClientId(), $this->getSecretKey());
     if (is_null($requestHash)) {
         throw new BillingException("Hashing data is fail");
     }
     $this->request = json_encode(['client_id' => $this->getClientId(), 'data' => $requestHash]);
     return $this;
 }