Magento SOAP V_2 creating order error: Payment not allowed - magento

I am trying to create an order on Magento 1.7.2 using SOAP API V_2 using .NET consol.
I am always getting the same error "Payment not allowerd" using every payment method.
//create an order with Magento API
MagentoService proxy = new MagentoService();
string sessionId = proxy.login("xxx", "xxx");
int idCarrello = proxy.shoppingCartCreate(sessionId, "1");
proxy.UnsafeAuthenticatedConnectionSharing = false;
shoppingCartCustomerEntity clienteMagento = new shoppingCartCustomerEntity();
clienteMagento.firstname = "name";
clienteMagento.lastname = "surname";
clienteMagento.email = "xxx#mmmm.com";
clienteMagento.mode = "guest";
proxy.shoppingCartCustomerSet(sessionId, idCarrello, clienteMagento, "1");
shoppingCartCustomerAddressEntity indirizzoSpedizione = new shoppingCartCustomerAddressEntity();
shoppingCartCustomerAddressEntity indirizzoBill = new shoppingCartCustomerAddressEntity();
indirizzoSpedizione.mode = "shipping";
indirizzoSpedizione.firstname = clienteMagento.firstname;
indirizzoSpedizione.lastname = clienteMagento.lastname;
indirizzoSpedizione.street = "viale europa 32";
indirizzoSpedizione.city = "Foggia";
indirizzoSpedizione.region = "FG";
indirizzoSpedizione.telephone = "111";
indirizzoSpedizione.postcode = "71122";
indirizzoSpedizione.country_id = "IT";
indirizzoSpedizione.is_default_billing = 0;
indirizzoSpedizione.is_default_shipping = 0;
indirizzoBill.mode = "billing";
indirizzoBill.firstname = clienteMagento.firstname;
indirizzoBill.lastname = clienteMagento.lastname;
indirizzoBill.street = "viale europa 32";
indirizzoBill.city = "Foggia";
indirizzoBill.region = "FG";
indirizzoBill.telephone = "111";
indirizzoBill.postcode = "71122";
indirizzoBill.country_id = "IT";
indirizzoBill.is_default_billing = 0;
indirizzoBill.is_default_shipping = 0;
shoppingCartCustomerAddressEntity[] indirizzi = new shoppingCartCustomerAddressEntity[] { indirizzoSpedizione, indirizzoBill };
proxy.shoppingCartCustomerAddresses(sessionId, idCarrello, indirizzi, "1");
proxy.shoppingCartShippingMethod(sessionId, idCarrello, "flatrate_flatrate", "1");
shoppingCartPaymentMethodResponseEntity[] paymentMethods = proxy.shoppingCartPaymentList(sessionId, idCarrello, "1");
Console.WriteLine(paymentMethods); //paymentMethods is always empty!!
shoppingCartPaymentMethodEntity modoPagamento = new shoppingCartPaymentMethodEntity();
modoPagamento.po_number = null;
modoPagamento.method = "checkmo";
modoPagamento.cc_cid = null;
modoPagamento.cc_owner = null;
modoPagamento.cc_number = null;
modoPagamento.cc_type = null;
modoPagamento.cc_exp_year = null;
modoPagamento.cc_exp_month = null;
proxy.shoppingCartPaymentMethod(sessionId, idCarrello, modoPagamento, "1");
Here is the Exception:
//Payment method is not allowed (I tryed checkmo, banktransfer, etc)
//proxy.shoppingCartOrder(sessionId, idCarrello, "1", new string[] { });
Any idea?

Ifaced with the saeme issue. This is the solution - You forgot product, just add product to sale. Also you must do it according to this order (it will not works in other order):
shoppingCartCustomerSet(guest for simplicity);
shoppingCartCustomerAddresses();
shoppingCartProductAdd();
shoppingCartShippingMethod();
shoppingCartPaymentMethod();

Related

Microsoft grap: GetGroupFromIdS2SRequest. Workload MsGraph_DirectoryServices

I have aproject project in Java. When I run the project I got a error: GetGroupFromIdS2SRequest. Workload MsGraph_DirectoryServices, Someone would said me how to fix it?.
SpringApplication.run(DemoApplication.class, args);
final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder().clientId("xxxx").clientSecret("yyyy").tenantId("zzzz").build();
List<String> scope = new ArrayList<>();
scope.add("https://graph.microsoft.com/.default");
final TokenCredentialAuthProvider tokenCredentialAuthProvider = new TokenCredentialAuthProvider( scope, clientSecretCredential);
final GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider(tokenCredentialAuthProvider).buildClient();
GroupCollectionPage groupCollectionPage = graphClient.groups().buildRequest().get();
Group group = new Group();
group.description = "Group with designated owner and members207";
group.displayName = "Operations group207";
LinkedList<String> groupTypesList = new LinkedList<String>();
groupTypesList.add("Unified");
group.groupTypes = groupTypesList;
group.mailEnabled = false;
group.mailNickname = "operations207";
group.securityEnabled = true;
group.additionalDataManager().put("\"owners#odata.bind\"", new JsonPrimitive("[ \"https://graph.microsoft.com/v1.0/directoryObjects/11111111\"]"));
String sIdGrupo = graphClient.groups().buildRequest().post(group).id;
Team team = new Team();
TeamMemberSettings memberSettings = new TeamMemberSettings();
memberSettings.allowCreateUpdateChannels = true;
team.memberSettings = memberSettings;
TeamMessagingSettings messagingSettings = new TeamMessagingSettings();
messagingSettings.allowUserEditMessages = true;
messagingSettings.allowUserDeleteMessages = true;
team.messagingSettings = messagingSettings;
TeamFunSettings funSettings = new TeamFunSettings();
funSettings.allowGiphy = true;
funSettings.giphyContentRating = GiphyRatingType.STRICT;
team.funSettings = funSettings;
graphClient.groups(sIdGrupo).team().buildRequest().put(team);
Before: Team team = new Team();, I added this line:
try {
sleep(30000);
} catch (InterruptedException e) {
e.printStackTrace();
}

Save ID two columns Laravel

I want to save the ID of a new Sale(); in $sale->voucher_series, how can I achieve this?
$sale = new Sale();
$sale->customerid = $request->customerid;
$sale->userid = \Auth::user()->id;
$sale->proof_type = $request->proof_type;
$sale->voucher_series = $request->saleId;
$sale->date_time = $mytime->toDateString();
$sale->total = $request->total;
$sale->status = 'Registered';
$sale->save();
If your voucher_series column is nullable field then it will work.
$sale = new Sale ();
$sale->customerid = $request->customerid;
$sale->userid = \Auth :: user()->id;
$sale->proof_type = $request->proof_type;
$sale->date_time = $mytime->toDateString ();
$sale->total = $request->total;
$sale->status = 'Registered';
$sale->save();
$sale->voucher_series = $sale->id;

Response status code does not indicate success: '400' ('Bad request')

i want to POST data to API in my android xamarin app using refit i've tested the API at Postman and it's working fine but at android app i'm getting exception Bad request.
Here is my android code i added the interface and the model i don't know what is the problem .
public interface RequestAPI
{
[Post("/request")]
Task<create_request> submit([Body] create_request request);
}
requestAPI= RestService.For<RequestAPI>("http://courier-magconsulting.azurewebsites.net/api");
button.Click += async delegate
{
try
{
create_request request = new create_request();
request.PickUpPhone = "7664554";
request.DownPayment = 89;
request.DeliveryFees = 56.8;
request.Note = "i need a help!";
request.RequestID = 88; // replace the value yourself
request.DekiveryLocationLatitude = 2323;
request.DeliveryLocationLongitude = 232;
request.PickUpLocationLatitude = 898;
request.PickUpLocationLongitude = 1123;
BroadcastType type = new BroadcastType();
type.Name = "All";
type.ID = 60; // replace the value yourself
request.BroadcastType = type;
Cargosize size = new Cargosize();
size.Name = "Small";
size.ID = 1; // replace the value yourself
request.Cargosize = size;
Cargoweight weight = new Cargoweight();
weight.Name = "Large";
weight.ID = 2; // replace the value yourself
request.CargoWeight = weight;
Sender sender_ = new Sender();
sender_.Name = "Ahmad";
sender_.SenderID = 1; // replace the value yourself
sender_.Phone = "8788";
sender_.SocialID = "8787";
sender_.RatingAvg = 5;
SenderStatus status = new SenderStatus();
status.ID = 1;
status.Name = "Active";
sender_.Senderstatus = status;
request.Sender = sender_;
create_request result = await requestAPI.submit(request);
Toast.MakeText(this, "Request created", ToastLength.Long).Show();
}
catch(Exception ex)
{
Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
}
};

Can't find way to debug Internal Server Error (500) caused by new class

I've read a lot of the postings about 500 errors because of the channel emulator, but this is not the case here. I took the standard bot template, which works just fine with the emulator, and replaced it with
ConnectorClient connector = new ConnectorClient(new
Uri(activity.ServiceUrl));
// calculate something for us to return
// int length = (activity.Text ?? string.Empty).Length;
string responseText=
***Bot_Application2.SilviaRestClass.GetRestResult(activity.Text);***
So the issue is in executing the GetRestResult method in the SilivaRestClass.
The code itself works, I'm using it in lots of other places, as it basically sets up a simple 1)get an input utterance in text, 2)send to my SILVIA AI server, and 3)get an utterance back routine. I have a feeling it has something to do with either private vs public methods, and/or [Serializable], based on what I have read so far. The code (minus the credentials) is below. Many thanks, in advance, for any suggestions to try.
`
bool exit = false;
restResponse = "Hello";
bool sessionNew = true;
string viewMessage = null;
string SILVIAUri = "";
string SILVIACore = "/Core/Create/unique/silName";
string SILVIASubmit = "/IO/SetInputManaged/unique/hello";
string SILVIARead = "/IO/GetAll/unique";
string SILVIARelease = "/Core/Release/{unique}";
string SILVIASubKey = "";
string silName = "";
string returnMessage = null;
string holdit = null;
string holdit2 = null;
int forHold = 0;
string responseFromServer = null;
string isfalse = "false";
string myURI = null;
string unique = null;
//CREATE CORE from SILVIA SERVER
myURI = SILVIAUri + SILVIACore;
myURI = myURI.Replace("silName", silName);
myURI = myURI.Replace("unique", unique);
System.Net.WebRequest request = WebRequest.Create(myURI);
request.Headers["Ocp-Apim-Subscription-Key"] = SILVIASubKey;
if (sessionNew)
{
Random rnd1 = new Random();
unique = rnd1.Next().ToString() + "askgracie";
sessionNew = false;
WebResponse wResponse = request.GetResponse();
Stream dataStream = wResponse.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
responseFromServer = reader.ReadToEnd();
// Clean up the streams and the response.
reader.Close();
wResponse.Close();
}
//SEND UTTERANCE to SILVIA
holdit = null;
myURI = null;
myURI = SILVIAUri + SILVIASubmit;
holdit = restResponse;
// holdit = HttpUtility.UrlEncode(holdit);
myURI = myURI.Replace("hello", holdit);
myURI = myURI.Replace("unique", unique);
if (holdit == "exit")
{
exit = true;
myURI = SILVIAUri + SILVIARelease;
}
System.Net.WebRequest sendRequest = WebRequest.Create(myURI);
sendRequest.Headers["Ocp-Apim-Subscription-Key"] = SILVIASubKey;
WebResponse sendResponse = sendRequest.GetResponse();
Stream sendStream = sendResponse.GetResponseStream();
StreamReader sendReader = new StreamReader(sendStream);
string send_ResponseFromServer = sendReader.ReadToEnd();
// Clean up the streams and the response.
sendReader.Close();
sendResponse.Close();
holdit = send_ResponseFromServer;
forHold = holdit.IndexOf("success");
holdit2 = holdit.Substring(forHold + 9, 5);
if (holdit2 == isfalse)
{
var simpleUtterResponse = "The bot failed to send the
utterance to SILVIA";
}
//GETRESPONSES FROM SILVIA
returnMessage = null;
holdit = null;
responseFromServer = null;
myURI = SILVIAUri + SILVIARead;
myURI = myURI.Replace("unique", unique);
System.Net.WebRequest readRequest = WebRequest.Create(myURI);
readRequest.Headers["Ocp-Apim-Subscription-Key"] = SILVIASubKey;
WebResponse readResponse = readRequest.GetResponse();
Stream readStream = readResponse.GetResponseStream();
StreamReader readReader = new StreamReader(readStream);
string read_ResponseFromServer = readReader.ReadToEnd();
viewMessage = read_ResponseFromServer;
string lastRead = "ID ";
List<string> myArray = new List<string>(viewMessage.Split(new
string[] { "\r\n" }, StringSplitOptions.None));
foreach (string s in myArray)
{
if (lastRead == "type: voice")
{
returnMessage = returnMessage + " " + s.Substring(8);
}
if (s.Length < 11)
{ lastRead = s;
}
else
{ lastRead = s.Substring(0, 11);
}
if (s.Length < 11)
{ lastRead = s;
}
else
{ lastRead = s.Substring(0, 11);
}
}
// Clean up the streams and the response.
//readReader.Close();
//readResponse.Close();
if (exit)
{
myURI = SILVIAUri + SILVIARelease;
myURI = myURI.Replace("unique", unique);
System.Net.WebRequest closeRequest =
WebRequest.Create(myURI);
closeRequest.Headers["Ocp-Apim-Subscription-Key"] =
SILVIASubKey;
WebResponse closeResponse = closeRequest.GetResponse();
}
return returnMessage;
}
}
}`
I ended up resolving this by cut/paste the class inside the same namespace and physical .cs file. – Brian Garr just now edit

C# - WebRequestMethods.Ftp.DownloadFile not working (timeout)

Good afternoon everyone.
I'm trying to download a few files from a FTP server and I don't know why this isn't working, because the same code worked before. Now when i run the service I get the following error:
Error 1053: The service did not respond to the start or control request in a timely fashion
I've tried doing other Methods like GetFileSize or even the DeleteFile that it's suppose to execute after the DownloadFile and they work, but this one isn't and i can't figure out why. Any ideas? My code is below, many thanks!
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(server + file));
reqFTP.Credentials = new NetworkCredential(username, password);
reqFTP.KeepAlive = true;
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Proxy = null;
reqFTP.UsePassive = false;
reqFTP.Timeout = -1;
FtpWebResponse response2 = (FtpWebResponse)reqFTP.GetResponse();
Stream responseStream2 = response2.GetResponseStream();
FileStream writeStream = new FileStream(folder + file, FileMode.Create);
int Length = 2048;
Byte[] buffer = new Byte[Length];
int bytesRead = responseStream2.Read(buffer, 0, Length);
while (bytesRead > 0)
{
writeStream.Write(buffer, 0, bytesRead);
bytesRead = responseStream2.Read(buffer, 0, Length);
}
writeStream.Close();
response2.Close();
try
{
string uri2 = server + file;
Uri serverUri2 = new Uri(uri);
if (serverUri2.Scheme != Uri.UriSchemeFtp)
{
return;
}
FtpWebRequest reqFTP2;
reqFTP2 = (FtpWebRequest)FtpWebRequest.Create(new Uri(server + file));
reqFTP2.Credentials = new NetworkCredential(username, password);
reqFTP2.KeepAlive = false;
reqFTP2.Method = WebRequestMethods.Ftp.DeleteFile;
reqFTP2.UseBinary = true;
reqFTP2.Proxy = null;
reqFTP2.UsePassive = false;
FtpWebResponse response3 = (FtpWebResponse)reqFTP2.GetResponse();
Stream responseStream3 = response3.GetResponseStream();
response3.Close();
}

Resources