/** * @param array $params simply pass $_POST into * @return Hypercharge\PaymentNotification * @throws Hypercharge\Errors\ArgumentError if $params empty or merchant password not set with Config::set() */ static function notification($params) { $pn = new PaymentNotification($params); $passw = Config::getPassword(); if (empty($passw)) { throw new Errors\ArgumentError('password is not configured! See Hypercharge\\Config::set()'); } $pn->verify($passw); return $pn; }
/** * The factory method that constructs the API resource. * * @param array $attributes the default attributes. * * @return PaymentNotification The new resource. */ public static function fromAttributes(array $attributes) { $object = new PaymentNotification(); $object->initialize($attributes); return $object; }
public function testCreateNotificationFromAttributes() { $notification = PaymentNotification::fromAttributes(array('url' => 'https://www.example.net/payplug_notification.html', 'response_code' => 200)); $this->assertEquals('https://www.example.net/payplug_notification.html', $notification->url); $this->assertEquals(200, $notification->response_code); }