function test_manual_query_recur_card_recur_transaction()
 {
     // Stop here and mark this test as incomplete.
     $this->markTestIncomplete('test_manual_query_recur_card_initial_transaction');
     // 1. enter the below values from the transaction log from test_manual_recurring_payment_step_1
     // 2. run the test and check the output for the subscriptionId and transactionid of the recur request
     // Set the below to match the original transaction, then run the test.
     $paymentmethod = "KORTCERT";
     $merchantid = 1130;
     $currency = "SEK";
     $cardType = "VISA";
     $maskedCardNumber = "444433xxxxxx1100";
     $expiryMonth = 01;
     $expiryYear = 15;
     $subscriptionId = 3050;
     // insert
     // the below applies to the recur request, and may differ from the original transaction
     $new_amount = "2500";
     // in minor currency
     $new_customerrefno = "test_manual_recurring_payment_step_1 " . date('c');
     // below is actual test, shouldn't need to change it
     $request = new Svea\HostedService\RecurTransaction(Svea\SveaConfig::getDefaultConfig());
     $request->countryCode = "SE";
     $request->subscriptionId = $subscriptionId;
     $request->currency = $currency;
     $request->customerRefNo = $new_customerrefno;
     $request->amount = $new_amount;
     $response = $request->doRequest();
     // check that request was accepted
     $this->assertEquals(1, $response->accepted);
     ////print_r("Recur card transaction response: "); //print_r( $response );
     //
     //Recur card transaction response: Svea\HostedService\RecurTransactionResponse Object
     //(
     //    [transactionid] => 586165
     //    [customerrefno] => test_manual_recurring_payment_step_1 2014-09-12T11:38:30+02:00
     //    [paymentmethod] => CARD
     //    [merchantid] => 1130
     //    [amount] => 2500
     //    [currency] => SEK
     //    [cardType] => VISA
     //    [maskedCardNumber] => 444433xxxxxx1100
     //    [expiryMonth] => 01
     //    [expiryYear] => 15
     //    [authCode] => 153124
     //    [subscriptionid] => 3050
     //    [accepted] => 1
     //    [resultcode] => 0
     //    [errormessage] =>
     //)
     // Set the below to match the transaction, then run the test.
     $transactionId = $response->transactionId;
     //SimpleXMLElement Object
     //(
     //    [transaction] => SimpleXMLElement Object
     //        (
     //            [@attributes] => Array
     //                (
     //                    [id] => 586165
     //                )
     //
     //            [customerrefno] => test_manual_recurring_payment_step_1 2014-09-12T11:38:30+02:00
     //            [merchantid] => 1130
     //            [status] => AUTHORIZED
     //            [amount] => 2500
     //            [currency] => SEK
     //            [vat] => SimpleXMLElement Object
     //                (
     //                )
     //
     //            [capturedamount] => SimpleXMLElement Object
     //                (
     //                )
     //
     //            [authorizedamount] => 2500
     //            [created] => 2014-09-12 11:38:32.557
     //            [creditstatus] => CREDNONE
     //            [creditedamount] => 0
     //            [merchantresponsecode] => 0
     //            [paymentmethod] => CARD
     //            [callbackurl] => SimpleXMLElement Object
     //                (
     //                )
     //
     //            [capturedate] => SimpleXMLElement Object
     //                (
     //                )
     //
     //            [subscriptionid] => 3050
     //            [subscriptiontype] => RECURRINGCAPTURE
     //        )
     //
     //    [statuscode] => 0
     //)
     $request = new Svea\HostedService\QueryTransaction(Svea\SveaConfig::getDefaultConfig());
     $request->transactionId = $transactionId;
     $request->countryCode = "SE";
     $queryResponse = $request->doRequest();
     $this->assertInstanceOf("Svea\\HostedService\\QueryTransactionResponse", $queryResponse);
     ////print_r($queryResponse);
     //
     //Svea\HostedService\QueryTransactionResponse Object
     //(
     //    [transactionId] => 587424
     //    [clientOrderNumber] => test_manual_recurring_payment_step_1 2014-10-06T15:53:45+02:00
     //    [merchantId] => 1130
     //    [status] => AUTHORIZED
     //    [amount] => 2500
     //    [currency] => SEK
     //    [vat] =>
     //    [capturedamount] =>
     //    [authorizedamount] => 2500
     //    [created] => 2014-10-06 15:53:45.367
     //    [creditstatus] => CREDNONE
     //    [creditedamount] => 0
     //    [merchantresponsecode] => 0
     //    [paymentMethod] => CARD
     //    [numberedOrderRows] =>
     //    [callbackurl] =>
     //    [capturedate] =>
     //    [subscriptionId] => 3050
     //    [subscriptiontype] => RECURRINGCAPTURE
     //    [cardType] =>
     //    [maskedCardNumber] =>
     //    [eci] =>
     //    [mdstatus] =>
     //    [expiryYear] =>
     //    [expiryMonth] =>
     //    [chname] =>
     //    [authCode] =>
     //    [accepted] => 1
     //    [resultcode] => 0
     //    [errormessage] =>
     //)
     $this->assertEquals(1, $response->accepted);
 }
 /**
  * test_manual_query_card_queryTransactionResponse 
  * 
  * run this manually after you've performed a card transaction and have set
  * the transaction status to success using the tools in the logg admin.
  */
 function test_manual_query_card_queryTransaction_returntype()
 {
     // Stop here and mark this test as incomplete.
     //        $this->markTestIncomplete(
     //            'test_manual_query_card_queryTransaction_returntype'
     //        );
     // 1. go to https://test.sveaekonomi.se/webpay-admin/admin/start.xhtml
     // 2. go to verktyg -> betalning
     // 3. enter our test merchantid: 1130
     // 4. use the following xml, making sure to update to a unique customerrefno:
     // <paymentmethod>KORTCERT</paymentmethod><currency>SEK</currency><amount>25500</amount><vat>600</vat><customerrefno>test_manual_query_card_2</customerrefno><returnurl>https://test.sveaekonomi.se/webpay/admin/merchantresponsetest.xhtml</returnurl><orderrows><row><name>Orderrow1</name><amount>500</amount><vat>100</vat><description>Orderrow description</description><quantity>1</quantity><sku>123</sku><unit>st</unit></row><row><name>Orderrow2</name><amount>12500</amount><vat>2500</vat><description>Orderrow2 description</description><quantity>2</quantity><sku>124</sku><unit>m2</unit></row></orderrows>
     // 5. the result should be:
     // <response><transaction id="580964"><paymentmethod>KORTCERT</paymentmethod><merchantid>1130</merchantid><customerrefno>test_manual_query_card_3</customerrefno><amount>25500</amount><currency>SEK</currency><cardtype>VISA</cardtype><maskedcardno>444433xxxxxx1100</maskedcardno><expirymonth>02</expirymonth><expiryyear>15</expiryyear><authcode>898924</authcode></transaction><statuscode>0</statuscode></response>
     // 6. enter the received transaction id below and run the test
     // Set the below to match the transaction, then run the test.
     $transactionId = 582690;
     $request = new QueryTransaction(Svea\SveaConfig::getDefaultConfig());
     $request->transactionId = $transactionId;
     $request->countryCode = "SE";
     $response = $request->doRequest();
     $this->assertInstanceOf("Svea\\HostedService\\QueryTransactionResponse", $response);
     ////print_r($response);
     $this->assertEquals(1, $response->accepted);
     $this->assertInstanceOf("Svea\\NumberedOrderRow", $response->numberedOrderRows[0]);
     $this->assertInstanceOf("Svea\\NumberedOrderRow", $response->numberedOrderRows[1]);
     $this->assertEquals(0, $response->numberedOrderRows[1]->vatDiscount);
 }