Пример #1
0
 function testNotificationMissingPasswordThrows()
 {
     $postData = $this->schemaNotification('payment_notification.json');
     Config::set('username', '', Config::ENV_SANDBOX);
     $this->assertEqual('', Config::getPassword());
     try {
         Payment::notification($postData);
         $this->fail('Errors\\ArgumentError expected!');
     } catch (Errors\ArgumentError $exe) {
         $this->assertEqual('password is not configured! See Hypercharge\\Config::set()', $exe->getMessage());
         return;
     } catch (Exception $exe) {
         $this->fail('unexpected Exception: ' . $exe->toString());
     }
 }
 function testMobileRefund()
 {
     $payment = $this->testMobileSubmit();
     $response = Payment::refund($payment->unique_id);
     $this->assertNull($response->error, "error %s . error:\n" . $response->error);
     $this->assertIsA($response, 'Hypercharge\\Payment');
     $this->assertEqual($response->type, 'MobilePayment');
     $this->assertEqual($response->status, 'refunded', 'status %s');
     $this->assertTrue($response->isRefunded(), 'isRefunded() %s');
     $this->assertEqual($response->unique_id, $payment->unique_id, 'unique_id %s');
     $this->assertEqual($response->transaction_id, $payment->transaction_id);
     $this->assertFalse(empty($response->timestamp));
     //$this->assertEqual($response->descriptor, 'sankyu.com/bogus +49123456789');
     $this->assertIsA($response->transactions, 'array');
     $this->assertIsA($response->transactions[0], 'Hypercharge\\Transaction');
     $trx = $response->transactions[0];
     $this->assertEqual($trx->getType(), 'sale');
     $this->assertTrue($trx->isRefunded());
     $this->assertEqual($trx->amount, $payment->amount);
     $this->assertEqual($trx->currency, $payment->currency);
     $this->assertEqual($trx->transaction_id, $payment->transaction_id);
 }