示例#1
0
 /**
  * Constructor for purchase
  *
  * @param array $purchase
  */
 public function __construct(array $purchase = [])
 {
     $this->amount = Utils::value($purchase, 'amount', 0);
     $this->rial = Utils::value($purchase, 'rial', true);
     $this->invoice = Utils::value($purchase, 'invoice', '');
     $this->options = Utils::value($purchase, 'options', []);
 }
示例#2
0
 public function __construct($result)
 {
     $this->state = Utils::value($result, 'state', 'OK');
     $this->merchantId = Utils::value($result, 'merchant', '');
     $this->reference = Utils::value($result, 'reference', '');
     $this->invoice = Utils::value($result, 'invoice', '');
     $this->traceNumber = Utils::value($result, 'trace', '');
     $this->amount = Utils::value($result, 'amount', 0);
 }
示例#3
0
 /**
  * Generate config object from array
  *
  * @param array $config
  * @return self
  */
 public static function generateFromArray(array $config)
 {
     return (new SamanConfig())->setUsername(Utils::value($config, 'username', ''))->setPassword(Utils::value($config, 'password', ''))->setMerchantId(Utils::value($config, 'merchant', ''))->setGatewayUrl(Utils::value($config, 'gateway'))->setWebServiceUrl(Utils::value($config, 'webservice'))->setTokenUrl(Utils::value($config, 'token_url'))->setSoapOptions(Utils::value($config, 'soap_options'))->setRedirectUrl(Utils::value($config, 'redirect_url'));
 }