/** * Valida que el cliente pueda realizar transacciones * * @param Client $client * @return bool * @throws \Exception */ public static function validateGateway(Client $client) { if (empty($client)) { throw new \Exception("El objecto Client no es valido"); } $clientMode = $client->getMode(); $authinfo = self::evalAuth($client); if ($authinfo->mode_key != $authinfo->livemode) { throw new \Exception("Las llaves no corresponden a modo de la tienda"); } if ($clientMode != $authinfo->livemode) { throw new \Exception("El modo del cliente no corresponde al de la tienda"); } if ($clientMode != $authinfo->mode_key) { throw new \Exception("El modo del cliente no corresponde al de las llaves"); } return true; }
/** * Service constructor. * @param Client $client */ public function __construct(Client $client) { $this->client = $client; $this->headers = array('useragent: ' . $client->getContained()); }