How to update status_payment after receive IPN Paypal? - sql-update

I know to update status_payment order is "completed". Code do the following
mysql_query("SELECT * FROM Transactions WHERE invoiceID=$_POST['invoice']");
Before receive IPN Paypal. What should I store the value for the field invoiceID ???

Related

Djstripe: ensuring new subscription payment succeeds before confirming successful subscription to customer

We use Djstripe to create Stripe subscriptions on our Django site like so:
# Create the Stripe subscription
stripe_subscription = stripe.Subscription.create(
customer=customer_id,
items=[{'price': plan_id}],
expand=['latest_invoice.payment_intent'],
metadata=metadata,
)
# Sync subscription from Stripe
subscription = Subscription.sync_from_stripe_data(stripe_subscription)
The process on Stripe's end seems to be something like:
Create the subscription (return status 200)
Create the payment intent object that will charge the customer for the subscription
Attempt to charge the customer
If the charge fails, put the subscription to status "incomplete"
Naively, when we get 200 back from step (1), we proceed as if the payment went through ok, but sometimes it doesn't (step (4) happens).
What is a good way to confirm a successful subscription creation to the customer oly if the subsequent charge succeeds?

OTRS fetch info from url

I've OTRS 5 working fine . I need to retrieve information from web
for example I received emails from support team they put in the subject (customer ID) I need to put in the body message of the Ticket the customer information based on Customer ID which will fetch it from another local system through Url e.x "skldfj.com/dslkde.php?id=23487893"
for example I received ticket in subject: customer 23487893 have issue
in body need to be something like
hello team this customer (ID 23487893) have issue
customer info (fetch it from skldfj.com/dslkde.php?id=23487893)
name
telephone and more

PayPal transaction id is not display in XCart invoice

I would like to know that why XCart have public id instead of PayPal transaction id in their order invoices, And is there any way to displays the PayPal transaction id in invoice after successful order completion through PayPal in XCart .
The reason X-Cart displays internal transaction ID is that if a transaction is not through and you provide a merchant with internal ID, they can go to Orders > Payment transactions section in admin area and will find the transaction details. Paypal's transaction ID would not allow that.
If you want to pull Paypal's transaction ID, you can do that like this:
require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'top.inc.php');
$return = \XLite\Core\Database::getRepo('\XLite\Model\Order')->find(ORDER_ID);
foreach ($return->getEvents() as $event) {
foreach ($event->getDetails() as $detail) {
if ($detail->name == 'Unique customer ID') {
var_dump($detail->value);
}
}
}

Accessing Current Recipient in Sitecore 8 Email Experience Manager

How do you get the raw contact id from the ec_contact_id on the URL created by EXM?
We are using Sitecore's EXM to send emails containing links for surveys to recipients. When the recipient takes the survey we want to tie the response back to the recipient. Since EXM puts a unique Id, ec_contact_id, for the contact (encrypted) we want to use that to determine the recipient versus adding our own custom id.
We found this article, https://briancaos.wordpress.com/2015/04/27/sitecore-8-exm-get-the-email-recipient-from-a-sublayout/, and tried implementing it in the Sitecore controller that gets called when the recipient clicks on the link but the resulting recipient name comes back as empty. We don't have a "sc_item_id" value so we tried "_id" and "ec_message_id" in its place but neither value produced a valid contact Id or recipient name. We also tried looking in MongoDB with the decrypted contactId but couldn't find a match.
You could try somthing like this:
//get value of the ec_contact_id parameter for current request
string queryString = WebUtil.GetQueryString( Sitecore.Modules.EmailCampaign.GlobalSettings.AnalyticsContactIdQueryKey);
var shortID = ShortID.TryParse(queryString, out shortID);
System.Guid contactId;
// where initializationVector is System.Guid of your email message item.
using (var cryptoServiceProvider = new GuidCryptoServiceProvider(System.Text.Encoding.UTF8.GetBytes(GlobalSettings.PrivateKey), initializationVector.ToByteArray()))
{
contactId = cryptoServiceProvider.Decrypt(shortID.Guid);
}
When you create a new user in an email list, Sitecore creates a record in the xDB Mongo database. You should be able to get the email address from the users profile.
Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails").Entries[Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails").Preferred]
Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails").Entries["work_email"]

Get the list of mail chimp subscribers in rails

I am working on a simple rails rails app and i have so many subscribers in my mail mailchimp account and i want to get my all subscribers and send the a mail from my rails app. How do i get my subscribers emails in an array.
my code sample is below
def send_now
#news_letter = NewsLetter.find(params[:id])
gb = Gibbon::API.new("xxx")
members = gb.lists.members({:id => 'xxx'})
#for each goes here to send the mail
redirect_to manage_news_letter_path(#news_letter), notice: "Sent news Letter"
end
I can get the list of subscribers but how can i split out their email into a for_each method in rails cos the format is i in a hash. any help thanks.
example output is below
{"email"=>"xx#xx.com", "id"=>"xx", "euid"=>"xx", "email_type"=>"html", "ip_signup"=>nil, "timestamp_signup"=>nil, "ip_opt"=>"208.68.37.172", "timestamp_opt"=>"2014-02-21 10:38:20", "member_rating"=>2, "info_changed"=>"2014-02-21 10:38:20", "web_id"=>xx, "leid"=>xx, "language"=>nil, "list_id"=>"xx", "list_name"=>"Blanckdigital website List", "merges"=>{"EMAIL"=>"xx#xx.com", "FNAME"=>"", "LNAME"=>""}, "status"=>"subscribed", "timestamp"=>"2014-02-21 10:38:20", "is_gmonkey"=>false, "lists"=>[], "geo"=>[], "clients"=>[], "static_segments"=>[], "notes"=>[]}
what i want is is just the email xx#xx.com alone for each of the subscribers