Esempio n. 1
0
 /**
  * 
  * @param type $pathName
  * @throws \CityPay\Lib\Exception
  */
 function __construct($pathName)
 {
     try {
         $this->clientAccount = JsonCodec::initialiseFromFile($pathName, Configuration\ClientAccount::class);
     } catch (Exception $ex) {
         throw $ex;
     }
 }
 /**
  *
  */
 public function testPayLinkPostbackNotice_success()
 {
     try {
         $postbackNotice = JsonCodec::initialiseFrom(PayLinkPostbackNoticeTest::postbackResponse_success(), PayLinkPostbackNotice::class)->licenceKey("MTD25HDPUVVBBG23")->validate();
         $this->assertTrue($postbackNotice instanceof PayLinkPostbackNotice, "JSON packet is not of type CityPay\\PayLink\\PayLinkPostbackNotice (" . get_class($postbackNotice) . ")");
     } catch (Exception $e) {
         throw $e;
         $this->assertTrue($e instanceof \RuntimeException, "Exception is not a subclass of 'RuntimeException' (" . get_class($e) . ").");
     }
 }
Esempio n. 3
0
 /**
  * @return mixed|void
  */
 protected function toJson()
 {
     $jsonCodec = new JsonCodec();
     return $jsonCodec->encode($this);
 }
Esempio n. 4
0
 /**
  * 
  * @param type $pathName
  * @throws \CityPay\Lib\Exception
  */
 function __construct($pathName)
 {
     try {
         $this->map = JsonCodec::initialiseFromFile($pathName, JsonConfiguration_inner::class);
     } catch (Exception $ex) {
         throw $ex;
     }
 }
Esempio n. 5
0
 /**
  * Encodes an object as a JSON string.
  *
  * @param $object
  *      the object to be represented as JSON encoded string.
  *
  * @return string
  *      a string containing the JSON representation of the object.
  */
 private static function jsonEncode($object)
 {
     return JsonCodec::encode($object);
 }