I am trying to integrate PayU in my website, I have successfully done the payment api part. Now I am trying to call verification api of transaction. I have followed all the steps from documentation.
Method POST:https://test.payu.in/merchant/postservice?form=2
Image
I am getting, Sorry Some Problem Occurred without any proper error message.
I am stuck on this. Please help.
Any help or comment will be highly appreciated.
My code: Function to make string(in expected format given in the documentation) and Hash using SHA256
{ string command = "verify_payment";
string finalStringToBeHashed = PAYU_KEY +"|"+ command + "|" + transactionId + "|" + PAYU_SALT;
string hash = _iPayUServices.GetSHA256(finalStringToBeHashed);
return Ok(( hash, finalStringToBeHashed));
}
and I am confident that my GetSHA256() function is correct. (As it working for payment api's).
Instead of https://test.payu.in/merchant/postservice?form=2 URL,
use https://info.payu.in/merchant/postservice?form=2.
Actually They are upgrading their documentation, so many things are missing as of now. Hopefully, they will add this soon.
Related
I am making a custom discord bot in python. I am trying to add a !report command.
I am very confused and cant find the answer anywhere. Can anyone help me make it?
I want any user to be able to do !report #example reason.
and save it in a database such as excel or sql3 or preferably in a staff channel.
how would I do this?
I have tried to use on_message()
You could use the on_message() command:
#client.event
async def on_message(message):
if message.content.startswith("!report"):
report_channel = client.get_channel(channel id)
member = text.split(" ")[1]
reason = ' '.join(text.split(" ")[1:])
await report_channel.send(f"Member: {member}, Reason: {reason}")
So the first thing is to look to see if the person used the "!report" command with an if statement.
Next, you find the member by taking the second word of the message.
After that, you find the reason by taking the rest of the words in the message.
Then you send it to the pre-defined report channel on discord.
Working with Evernote IOS SDK 3.0
I would like to retrieve a specific resource from note using
fetchResourceByHashWith
This is how I am using it. Just for this example, to be 100% sure about the hash being correct I first download the note with a single resource using fetchNote and then request this resource using its unique hash using fetchResourceByHashWith (hash looks correct when I print it)
ENSession.shared.primaryNoteStore()?.fetchNote(withGuid: guid, includingContent: true, resourceOptions: ENResourceFetchOption.includeData, completion: { note, error in
if error != nil {
print(error)
seal.reject(error!)
} else {
let hash = note?.resources[0].data.bodyHash
ENSession.shared.primaryNoteStore()?.fetchResourceByHashWith(guid: guid, contentHash: hash, options: ENResourceFetchOption.includeData, completion: { res, error in
if error != nil {
print(error)
seal.reject(error!)
} else {
print("works")
seal.fulfill(res!)
}})
}
})
Call to fetchResourceByHashWith fails with
Optional(Error Domain=ENErrorDomain Code=0 "Unknown error" UserInfo={EDAMErrorCode=0, NSLocalizedDescription=Unknown error})
The equivalent setup works on Android SDK.
Everything else works so far in IOS SDK (chunkSync, auth, getting notebooks etc.. so this is not an issue with auth tokens)
would be great to know if this is an sdk bug or I am still doing something wrong.
Thanks
This is a bug in the SDK's "EDAM" Thrift client stub code. First the analysis and then your workarounds.
Evernote's underlying API transport uses a Thrift protocol with a documented schema. The SDK framework includes a layer of autogenerated stub code that is supposed to marshal input and output params correctly for each request and response. You are invoking the underlying getResourceByHash API method on the note store, which is defined per the docs to accept a string type for the contentHash argument. But it turns out the client is sending the hash value as a purely binary field. The service is failing to parse the request, so you're seeing a generic error on the client. This could reflect evolution in the API definition, but more likely this has always been broken in the iOS SDK (getResourceByHash probably doesn't see a lot of usage). If you dig into the more recent Python version of the SDK, or indeed also the Java/Android version, you can see a different pattern for this method: it says it's going to write a string-type field, and then actually emits a binary one. Weirdly, this works. And if you hack up the iOS SDK to do the same thing, it will work, too.
Workarounds:
Best advice is to report the bug and just avoid this method on the note store. You can get resource data in different ways: First of all, you actually got all the data you needed in the response to your fetchNote call, i.e. let resourceData = note?.resources[0].data.body and you're good! You can also pull individual resources by their own guid (not their hash), using fetchResource (use note?.resources[0].guid as the param). Of course, you may really want to use the access-by-hash pattern. In that case...
You can hack in the correct protocol behavior. In the SDK files, which you'll need to build as part of your project, find the ObjC file called ENTProtocol.m. Find the method +sendMessage:toProtocol:withArguments.
It has one line like this:
[outProtocol writeFieldBeginWithName:field.name type:field.type fieldID:field.index];
Replace that line with:
[outProtocol writeFieldBeginWithName:field.name type:(field.type == TType_BINARY ? TType_STRING : field.type) fieldID:field.index];
Rebuild the project and you should find that your code snippet works as expected. This is a massive hack however and although I don't think any other note store methods will be impacted adversely by it, it's possible that other internal user store or other calls will suddenly start acting funny. Also you'd have to maintain the hack through updates. Probably better to report the bug and don't use the method until Evernote publishes a proper fix.
Tried setting up slackr using the following code:
slackr_setup(channel=channel,
incoming_webhook_url="https://hooks.slack.com/services/xxxxxxx/xxxxxx/xxxxxxxxxx",
api_token = "xxxx-xxxxxxxx-xxxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxxxx",
username=username)
However, when I run the slackr function, there is no output. (There's no error message)
Okay,so I found the reason for this. Didn't want to answer my own question, but it might help someone else having the same issue.
The channel that I was trying to post to was a private channel and once I changed the channel to a public one, it started working.
I've opened up a twilio trial account. I want to use my verified called ID number in my asp.net application instead of buying a new twilio number. But I don't know how to use it. Here are my codes,
public ActionResult SendSms()
{
string ACC_SID = ConfigurationManager.AppSettings["ACC_SID"];
string AUTH_TKN = ConfigurationManager.AppSettings["AUTH_TKN"];
TwilioRestClient client = new TwilioRestClient(ACC_SID, AUTH_TKN);
client.SendMessage("+8801941234567", "+8801671234567", string.Format("This is a test message!"));
return RedirectToAction("SmsView");
}
Nothing happened with it. How can I use my called ID to send sms?
I faced the same scenario while I was working on Twilio first time and at that time I used below steps to make things workable.
1) First of all I would suggest please add Try{} catch{} block in your SendSMS function. this will give you idea like SendMessage worked correctly.
2) In twilio we need to register mobile no before send SMS.
3) if your function works fine(no error occur) then in Twilio there is LOG tab where you can see weather your SMS send correctly or not.
Twilio developer evangelist here.
Jinesh's answer has some useful parts, like using a try/catch block to see errors.
However, the problem is that you are trying to send an SMS from your own number, not from a Twilio number. When sending SMS, you can only send from Twilio numbers. Please see this page for details on why.
You should have got a Twilio number when you signed up. Try using that number as the From number instead.
I'm trying to use the cfs:http-publish package at https://github.com/CollectionFS/Meteor-http-publish. While I've got the GET - /api/list functionality working, I don't know how to obtain a single document:
(GET - /api/list/:id - find one published document).
Can someone provide a curl example of this, assuming a certain collection of objections.
eg: {a:3, b:2}, {a:4, b:3}, and requiring to obtain the object with {a:3}.
Thanks.
You need to put it in the query function.
HTTP.publish({collection: myList},function( ){
return myList.find(this.query);
});
this.query contains the data you sent with your request.
curl http://localhost:3000/api/myList?a=3
I don't know enough about mongo to know if this is a potential security risk, if anyone can comment on that please do.