function testMobileWithWpfDataThrows() { $error = new Errors\ValidationError(); $error->add("payment", "The property description is not defined and the definition does not allow additional properties"); $error->add("payment", "The property editable_by_user is not defined and the definition does not allow additional properties"); $error->add("payment", "The property return_success_url is not defined and the definition does not allow additional properties"); $error->add("payment", "The property return_failure_url is not defined and the definition does not allow additional properties"); $error->add("payment", "The property return_cancel_url is not defined and the definition does not allow additional properties"); $error->flush(); $this->expectException($error); $data = $this->fixture('wpf_payment_request_simple.json'); $this->curl->shouldReceive('xmlPost')->never(); $payment = Payment::mobile($data); }
function testMobileSubmitAuthorize() { $data = $this->fixture('mobile_payment_request_simple.json'); $this->injectRedirectUrls($data); $data['transaction_types'][] = 'authorize'; // create MobilePayment for authorize $payment = Payment::mobile($data); $this->assertIsA($payment, 'Hypercharge\\Payment'); $this->assertTrue($payment->isNew()); $this->assertPattern('/^[0-9a-f]{32}$/', $payment->unique_id); $this->assertEqual($payment->payment_methods, array('credit_card')); // mobile client submit $wpf = new XmlWebservice(); $submitResponse = $wpf->call(new MobileSubmitUrl($payment->submit_url), new MobileSubmitRequest()); $this->assertIsA($submitResponse, 'Hypercharge\\Payment'); $this->assertEqual($submitResponse->type, 'MobilePayment'); $this->assertEqual($submitResponse->status, 'approved', 'status %s , error:' . $submitResponse->error); $this->assertTrue($submitResponse->isApproved()); $this->assertEqual($submitResponse->unique_id, $payment->unique_id); $this->assertEqual($submitResponse->transaction_id, $payment->transaction_id); //$this->assertEqual($submitResponse->mode, 'test'); $this->assertEqual($submitResponse->amount, $data['amount']); $this->assertEqual($submitResponse->currency, $data['currency']); return $payment; }