.NET Braintree : Transactions sent as charged for settlement never settled - braintree

I am integrating Braintree payment option in a site, currently in sand box. The setup was easy, docs helped a lot but I am confused about one thing.
When I submit a transaction as a settlement, it processes the transaction and also shows in transactions in the control panel but it is never settled. I want to know how can I be sure if the customer was charged so I can deliver the service he requested.
If an amount does not settle, and I have delivered the product then It will be a problem for my client.
It is showing all the transactions as this, including the paypal ones.
Please see the attached screen shot.
The code I am using:
var request = new TransactionRequest
{
Amount = 33.22,
PaymentMethodNonce = nonce,
OrderId = CustomerOrderId,
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
}
};

Usually BrainTree Settles all the transaction with in a time period(it may take a day).
submitted_for_settlement: This means a transaction has made which would get settled, but not immediately when the transaction occurs.
The real settlement happens under Disbursement, this runs daily and here they will disburse all the transactions which are in submitted_for_settlement status and during this process only
I would suggest you to add Disbursement Webhook in to your application, this helps you to get all the details of the disbursement from braintree.
Don't forget to save the Disbursement ID value, which you will get from disbursement webhook ONLY. We cannot see the disbursement ID in their console.
Use of Disbursement ID - this ID will be in the buyers CC Billing
To implement this please follow this docs.
https://developers.braintreepayments.com/reference/general/webhooks/disbursement/dotnet
https://developers.braintreepayments.com/guides/webhooks/parse/dotnet

Related

Return initial data on subscribe event in django graphene subscriptions

I'm trying to response to user on subscribe. By example, in a chatroom when an user connect to subscription, the subscription responses him with data (like a welcome message), but only to same user who just connect (no broadcast).
How can I do that? :(
Update: We resolve to use channels. DjangoChannelsGraphqlWs does not allow direct back messages.
Take a look at this DjangoChannelsGraphQL example. Link points to the part which is there to avoid "user self-notifications" (avoid user being notified about his own actions). You can use the same trick to send notification only to the user who made the action, e.g. who just subscribed.
Modified publish handler could look like the following:
def publish(self, info, chatroom=None):
new_msg_chatroom = self["chatroom"]
new_msg_text = self["text"]
new_msg_sender = self["sender"]
new_msg_is_greetings = self["is_greetings"]
# Send greetings message only to the user who caused it.
if new_msg_is_greetings:
if (
not info.context.user.is_authenticated
or new_msg_sender != info.context.user.username
):
return OnNewChatMessage.SKIP
return OnNewChatMessage(
chatroom=chatroom, text=new_msg_text, sender=new_msg_sender
)
I did not test the code above, so there could be issues, but I think it illustrates the idea quite well.

Virtuemart not sending new order "pending status" email

When i somebody create a new order that the status is pending, the virtuemart does not send the email order.
It sends just if the status is confirmed, or any others.
Someone know what can it be?
Answer from https://forum.virtuemart.net/index.php?topic=126593.0
The problem before was, that the email was sent twice. So we removed
sending emails for orderstatus Pending. Orderstatus Pending means that
the customer put something on the cashdesk, but did not pay or confirm
the order.
The only solution I've found and use:
In file
components/com_virtuemart/helpers/shopfunctionsf.php
ctrl+f to
$orderstatusForShopperEmail = VmConfig::get('email_os_s',array('U','C','S','R','X'));
On next line add
$orderstatusForShopperEmail[] = "P";
In VirtueMart 3.4 it is again possible to receive an email for order status P, Pending, but only for the vendor.
The status "pending" is triggered once you hit the payment button and ends when the payment plugin sends a command to change the status into a new status like confirmed.
If in the time between these two processes something goes wrong the status will stay on pending.
For a successful payment the status should never be P "pending" even though it is possible to choose it in that way.
For payment methods that do not process the payment immediately like "invoice", meaning waiting for a payment via bank transfer or similar, status U "confirmed by shopper" should be used. It is often seen that in this case "Pending" is used, please don't do that.
Please rename "confirmed by shopper" into "my pending", so you got a status "pending" for stuck payments in the shop system, and a "my pending" for pending payments after a successful order process.
The latter status U will send emails to the vendor and shopper if you choose so in VM configuration, tab Orders (formerly called Email).

Pubnub chat application with storage

I'm looking to develop a chat application with Pubnub where I want to make sure all the chat messages that are send is been stored in the database and also want to send messages in chat.
I found out that I can use the Parse with pubnub to provide storage options, But I'm not sure how to setup those two in a way where the messages and images send in the chat are been stored in the database.
Anyone have done this before with pubnub and parse? Are there any other easy options available to use with pubnub instead of using parse?
Sutha,
What you are seeking is not a trivial solution unless you are talking about a limited number of end users. So I wouldn't say there are no "easy" solutions, but there are solutions.
The reason is your server would need to listen (subscribe) to every chat channel that is active and store the messages being sent into your database. Imagine your app scaling to 1 million users (doesn't even need to get that big, but that number should help you realize how this can get tricky to scale where several server instances are listening to channels in a non-overlapping manner or with overlap but using a server queue implementation and de-duping messages).
That said, yes, there are PubNub customers that have implemented such a solution - Parse not being the key to making this happen, by the way.
You have three basic options for implementing this:
Implement a solution that will allow many instances of your server to subscribe to all of the channels as they become active and store the messages as they come in. There are a lot of details to making this happen so if you are not up to this then this is not likely where you want to go.
There is a way to monitor all channels that become active or inactive with PubNub Presence webhooks (enable Presence on your keys). You would use this to keep a list of all channels that your server would use to pull history (enable Storage & Playback on your keys) from in an on-demand (not completely realtime) fashion.
For every channel that goes active or inactive, your server will receive these events via the REST call (and endpoint that you implement on your server - your Parse server in this case):
channel active: record "start chat" timetoken in your Parse db
channel inactive: record "end chat" timetoken in your Parse db
the inactive event is the kickoff for a process that uses start/end timetokens that you recorded for that channel to get history from for channel from PubNub: pubnub.history({channel: channelName, start:startTT, end:endTT})
you will need to iterate on this history call until you receive < 100 messages (100 is the max number of messages you can retrieve at a time)
as you retrieve these messages you will save them to your Parse db
New Presence Webhooks have been added:
We now have webhooks for all presence events: join, leave, timeout, state-change.
Finally, you could just save each message to Parse db on success of every pubnub.publish call. I am not a Parse expert and barely know all of its capabilities but I believe they have some sort or store local then sync to cloud db option (like StackMob when that was a product), but even if not, you will save msg to Parse cloud db directly.
The code would look something like this (not complete, likely errors, figure it out or ask PubNub support for details) in your JavaScript client (on the browser).
var pubnub = PUBNUB({
publish_key : your_pub_key,
subscribe_key : your_sub_key
});
var msg = ... // get the message form your UI text box or whatever
pubnub.publish({
// this is some variable you set up when you enter a chat room
channel: chat_channel,
message: msg
callback: function(event){
// DISCLAIMER: code pulled from [Parse example][4]
// but there are some object creation details
// left out here and msg object is not
// fully fleshed out in this sample code
var ChatMessage = Parse.Object.extend("ChatMessage");
var chatMsg = new ChatMessage();
chatMsg.set("message", msg);
chatMsg.set("user", uuid);
chatMsg.set("channel", chat_channel);
chatMsg.set("timetoken", event[2]);
// this ChatMessage object can be
// whatever you want it to be
chatMsg.save();
}
error: function (error) {
// Handle error here, like retry until success, for example
console.log(JSON.stringify(error));
}
});
You might even just store the entire set of publishes (on both ends of the conversation) based on time interval, number of publishes or size of total data but be careful because either user could exit the chat and the browser without notice and you will fail to save. So the per publish save is probably best practice if a bit noisy.
I hope you find one of these techniques as a means to get started in the right direction. There are details left out so I expect you will have follow up questions.
Just some other links that might be helpful:
http://blog.parse.com/learn/building-a-killer-webrtc-video-chat-app-using-pubnub-parse/
http://www.pubnub.com/blog/realtime-collaboration-sync-parse-api-pubnub/
https://www.pubnub.com/knowledge-base/discussion/293/how-do-i-publish-a-message-from-parse
And we have a PubNub Parse SDK, too. :)

Cancel appointment and associated resources in Outlook when created using EWS Managed API

I am using the EWS Managed API to create appoitments on Exchange 2010.
Appointment appointment = new Appointment(exchangeService);
appointment.Subject = "Sample meeting";
appointment.Body = "Sample meeting body";
appointment.Start = bookingInfo.from;
appointment.End = bookingInfo.from.AddMinutes(bookingInfo.duration);
appointment.Location = meetingRoom.displayName;
appointment.Resources.Add(<my_room_mail>);
// Send the meeting request to all attendees and save a copy in the Sent Items folder.
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
This piece of code create effectively an appoitment in my Outlook but the Meeting Room included as a resource is marked as a "tentative" (not really accepted). So when I want to delete the meeting, the meeting room stay booked (busy/tentative) for the slot and it is impossible to delete the tentative.
If I delete the appoitment from the EWS code (using the appoitment ID), it works as expected, the room is effectively free.
Appointment appointment = Appointment.Bind(exchangeService, new ItemId(itemId));
appointment.Delete(DeleteMode.MoveToDeletedItems);
Do you have any idea of what is the problem ? Outlook right ? Bad appoitment creation or resource booking ?
Ok, I understand that Direct Booking is not compatible with EWS/OWA/Mobile solutions (and also with Outlook 2010/2013 without register tweak).
Direct Booking and Resource Booking Attendant (Auto Accept feature) are conflicting technologies, and if enabled together, unexpected behavior in calendar processing and item consistency can occur.
Check this for more details :
http://msexchangeanswers.blogspot.fr/2009/08/outlook-direct-booking-vs-auto-accept_17.html
http://exchangeserverinfo.net/2013/05/remove-auto-accept-from-outlook-for-all-room-mailbox/
The resource room needs to auto-accept the invitation, so it loses its tentative status. Then when you delete the appointment from your calendar, it should automatically send cancellation to the room. There is a setting on the delete to do this, and I forget off the top of my head if it's the default or not, but I think the initial issue is why the room is not configured to accept or reject the invite sent.

I am trying to add a new gateway to CS-cart and it seems having troubles when i am sent back from the gateway

basically my script so far send values to the gateway then get redirected to CS cart .. in that page i grab the values returned and manipulate them.
i use fn finish and fn change order status to finish the order but no matter what i do i get a 404 page not found . i've tried redirecting to the order page but its creates a problem.
Here is the code i use when returning from gateway.
$StaTus_message = "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful. We will be shipping your order to you soon.";
$pp_response['customer_email'] = $_REQUEST['billing_cust_email'];
$pp_response['client_id'] = $_REQUEST['billing_cust_name'];
$pp_response['order_status'] = 'C';
$pp_response['reason_text'] = $StaTus_message;
fn_finish_payment($_REQUEST['Order_Id'], $pp_response);
fn_change_order_status($_REQUEST['Order_Id'], $pp_response['order_status']);
I know this is not a popular subject but i thought I'll give it a go.
Also I've being searching everywhere for documentation both at CS-cart's forum and the internet and couldn't find much.
Thanks in advanced.
Okay. So, the solution to that was exiting the script after the script sent the client to the gate way, and then upon re-enter using fn_change_order_status - to whatever you need, and then using fn_order_placement_routines to actually finalize the order and send email to client/merchant.
Hope that help people out there as I spent nearly 4 days to try and understand that.

Resources