Create Order status code 400 - Server Error - bluesnap

I'm trying to build a simple payment flow using Bluesnap. Currently I've been able to capture the users billing information using Hosted Fields, and then saved it to a "Shopper" in bluesnap. Now I'm trying to use the same Shopper to create an order (https://developers.bluesnap.com/v8976-Extended/docs/create-order), but I can't get it to work.
I'm sending this:
<order>
<ordering-shopper>
<shopper-id>
--Shopper ID--
</shopper-id>
<web-info>
<ip>127.0.0.1:61106</ip>
<remote-host>www.merchant.com</remote-host>
<user-agent>Mozilla/5.0 (Linux; X11)</user-agent>
</web-info>
<fraud-info>
<fraud-session-id>1234567890</fraud-session-id>
</fraud-info>
<authorized-by-shopper>true</authorized-by-shopper>
</ordering-shopper>
<cart>
<cart-item>
<sku>
<sku-id>2425735</sku-id>
</sku>
<quantity>1</quantity>
</cart-item>
</cart>
<expected-total-price>
<amount>15.00</amount>
<currency>USD</currency>
</expected-total-price>
</order>
Using a POST-request to BLUESNAPDOMAINPATH/services/2/orders
The only response I get is a status code 400 with the body containing "Server Error"
Does anyone know how to solve this issue?

Your root xml element is missing the namespace:
<order>
Should be:
<order xmlns="http://ws.plimus.com">

Related

How to get Sharepoint user by Title using REST?

I'm trying to search for a given user on a Sharepoint site using "lastname, firstname". I was able to use the following url to get the total list of site users as a large XML document:
https://thissite.com/sites/thatsite/_api/web/siteusers/
However, I haven’t been able to figure out how to search by Title. When I use the following url:
https://thissite.com/sites/thatsite/_api/web/siteusers/getbytitle(“lastname,%20firstname”)
I get this error:
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>
-1, Microsoft.SharePoint.Client.InvalidClientQueryException
</m:code>
<m:message xml:lang="en-US">
The expression "web/siteusers/getbytitle("lastname, firstname")" is not valid.
</m:message>
</m:error>
When I use the following url to get the same user's data:
https://thissite.com/sites/thatsite/_api/web/siteusers/getbyid(41)
Then I successfully get XML returned with that user's data.
I guess I could just parse the list obtained from /siteusers and load it into a searchable data object, but I was hoping for something more direct.
UserCollection resource does not expose getbytitle method, that's the reason why you get this exception.
In order filter user by title you could utilize $filter query option as demonstrated below:
https://contoso.sharepoint.com/_api/web/siteusers?$filter=Title eq '<Title>'

Jasper server reportUnitUri cause 404 error

I use jasper reports rest v2 api, in http:///jasperserver/rest_v2/reportExecutions send post request with the following body
<reportExecutionRequest>
<reportUnitUri>/root/Reports/samples/Department</reportUnitUri>
<async>true</async>
<freshData>false</freshData>
<saveDataSnapshot>false</saveDataSnapshot>
<outputFormat>html</outputFormat>
<interactive>true</interactive>
<ignorePagination>false</ignorePagination>
<pages>1-5</pages>
<parameters>
<reportParameter name="name">
<value>name 1</value>
<value>name 2</value>
</reportParameter>
<reportParameter name="mark1">
<value>200</value>
<value>453</value>
</reportParameter>
</parameters>
</reportExecutionRequest>
reports Resource /root/Reports/samples/Department not found. i tried various combinations in ResourceUnitUri like (Reports/Reports/samples/Depatments, /samples/Department). But none seems to work. Everything returns 404 code. What is the correct value on reportUnitUri?
ReportUnitUri = /reports/<folder name>/<Resource ID>. To get Resource ID select report and click edit button. you get

How to validate an item exists in a list response in SoapUI?

Short question: In a SoapUI/SoapUI Pro test step, how can I verify that a REST response which is a list contains a specific item?
Long version: I have a test suite that chains together two REST method calls. First I call addCustomer, then I call getCustomerByPhoneNumber. However, phone number is not unique so I may get back a list of several customers. How can I determine if that list contains the customer I just added?
Example: Say I call addCustomer to create customer2, and the response returns customerId = 222. I then call getCustomerByPhoneNumber and receive the following response. How do I verify that customerId = 222 exists in the list? Ideally I'd also like to verify that all information about customer2 is correct (phone number, name, etc.)
<customers>
<customer>
<id>111</id>
<name>customer1</name>
<phone>555-5555</phone>
</customer>
<customer>
<id>222</id>
<name>customer2</name>
<phone>555-5555</phone>
</customer>
<customer>
<id>333</id>
<name>customer3</name>
<phone>555-5555</phone>
</customer>
</customers>
If the answer requires a Groovy script, I'd appreciate some sample code or psuedocode, since I haven't used Groovy before.
You could also use an XQuery assertion on the test step like this:
for $customer in //*:customer
where ($customer/id = '222')
return ($customer/name,
$customer/phone)
This produces output like:
<name>customer2</name>
<phone>555-5555</phone>
Then, in the assertion expected results panel you could substitute the expected values:
<name>${customerName}</name>
<phone>${custmerPhone}</phone>
Using XPath, something like exists(//*:customer[name[text()='customer2']]), to see if "he" exists.
Next, something like //*:customer[name[text()='customer2']]/id should give you "222".

Retrieve a List of All Checks for an Account using qbXML

I'm working on a website for a client that integrates into QuickBook desktop. I need to get a listing of all the checks for a specific account (ideally I would like all transactions for that account [regardless of their type] but if I have to get them one at a time that's fine). When I send the following XML:
<ns1:sendRequestXMLResponse>
<ns1:sendRequestXMLResult>
<xml version="1.0" encoding="utf-8" ?>
<qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CheckQueryRq>
<AccountFilter>
<ListID>800000F1-1362066981</ListID>
</AccountFilter>
<IncludeLineItems>true</IncludeLineItems>
</CheckQueryRq>
</QBXMLMsgsRq>
</QBXML>
</ns1:sendRequestXMLResult>
</ns1:sendRequestXMLResponse>
I receive the following error:
<CheckQueryRs statusCode="1" statusSeverity="Info" statusMessage="A query request did not find a matching object in QuickBooks" />
If I go into QuickBooks I can see there are checks associated with the account so I'm not sure why this doesn't return a result.
Update 1: I rewrote this without the AccountFilter so it returned every check and I found checkes with the 800000F1-1362066981 account. It's also 10 MB so it's really hard to work with. :-)

403 forbidden error PUT request with yiirestfull plugin and Backbone.JS

I am working with REST in Yii. Therefore I use yiirestful plugin and Backbone.JS. At the moment I am perfectly able to do POST and GET request throughout REST. But when I want to update a record I alway get an 403 forbidden error. I shall explain what i've tried and how:
First of all I am saving my collection in Backbone like this:
Backbone.sync('update', this.collection);
Now I don't for sure if that's going to work but the fact is that any PUT request get's an 403.
Secondly, because I am working in a module I adjusted the URLmanager rules like this:
'contentManagement/api/<controller:\w+>'=>array('contentManagement/<controller>/restList', 'verb'=>'GET'),
'api/<controller:\w+>'=>array('<controller>/restList', 'verb'=>'GET'),
'api/<controller:\w+>/<id:\w+>'=>array('<controller>/restView', 'verb'=>'GET'),
'api/<controller:\w+>/<id:\w+>/<var:\w+>'=>array('<controller>/restView', 'verb'=>'GET'),
array('contentManagement/<controller>/restCreate', 'pattern'=>'contentManagement/api/<controller:\w+>', 'verb'=>'POST'),
array('<controller>/restUpdate', 'pattern'=>'contentManagement/api/<controller:\w+>/<id:\d+>', 'verb'=>'PUT'),
array('<controller>/restUpdate', 'pattern'=>'contentManagement/api/<controller:\w+>/<id:\d+>', 'verb'=>'PUT'),
array('<controller>/restDelete', 'pattern'=>'api/<controller:\w+>/<id:\d+>', 'verb'=>'DELETE'),
array('<controller>/restCreate', 'pattern'=>'contentManagement/api/<controller:\w+>', 'verb'=>'POST'),
array('<controller>/restCreate', 'pattern'=>'contentManagement/api/<controller:\w+>/<id:\w+>', 'verb'=>'POST'),
It could be the case that this causes the problem. But I am not very digged in to this rules.. I did the same as i did by the POST request but whatever I try it still gives the 403.
Thirdly i'll provide my request information:
PUT http://pimtest.php/Yii/trackstar/contentManagement/api/SidebarWidgetsUsed/
403 Forbidden
38ms
I think a id is needed after this url but when I provide an id in the data that should be enough to let backbone recognize it's about an PUT request / update request.
I have no clue where to look further in my code.. I understand it's a complicated story so any minimal advice is appreciated!
Greetz,
You have two (identical) rules that apply to PUT, and as you say, they require an ID. Without an ID, none of the rules will match for a PUT request.
Either provide an ID, or modify the rule to not require an id, e.g.:
array('<controller>/restUpdate', 'pattern'=>'contentManagement/api/<controller:\w+>', 'verb'=>'PUT'),
In any case, as you're not using id, I'm not sure why it's in the rule to start?