$transactionId = $response->getTransactionId(); // each verify response has this method $status = $response->get('status'); // zarinpal provider has status field too. } /** * Work with PaymentNeeds * every Request|Verify need extended `PaymentNeeds` class */ $needs = new PaymentNeeds(); $needs->has('key'); // false $needs->set('key', 'value'); $needs->has('key'); // true $needs->hasAll('key', 'attr', 'foo'); // false $needs->set('attr', 'val'); $needs->hasAll('key', 'attr', 'foo'); // false $needs->set('foo', 'bar'); $needs->hasAll('key', 'attr', 'foo'); // true $value = $needs->get('key'); // value //OR $value = $needs->getKey(); // value $value = $needs->getFoo(); // bar $value = $needs->getWhat();
/** * @param PaymentNeeds $needs * @return array * @throws InvalidPaymentNeedsException */ protected function serializeVerifyPayload(PaymentNeeds $needs) { if ($needs->hasAll('amount', 'authority')) { throw new InvalidPaymentNeedsException(); } return ['MerchantID' => $this->getProviderConfig('api_key'), 'Amount' => $this->calculateAmount($needs->get('amount')), 'Authority' => $needs->get('authority')]; }