function testCall()
 {
     XmlSerializer::$sort = true;
     $data = $this->schemaRequest('WpfPayment.json');
     $requestXml = $this->schemaRequest('WpfPayment.xml');
     $responseXml = $this->schemaResponse('WpfPayment_new.xml');
     $this->curlMock()->shouldReceive('xmlPost')->with('https://testpayment.hypercharge.net/payment', $requestXml)->once()->andReturn($responseXml);
     $request = new PaymentRequest($data['payment']);
     $url = new PaymentUrl(Config::getMode());
     $ws = new XmlWebservice();
     $response = $ws->call($url, $request);
     $this->assertIsA($response, 'Hypercharge\\Payment');
     $this->assertEqual($response->type, 'WpfPayment');
 }
 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;
 }