Generate invoice in pdf

6 years 1 month ago #302117 by activha
Replied by activha on topic Generate invoice in pdf
Just fine ! :-)

I have a last question on this.
Sometimes we need to have an invoice when the basket is pending (for instance with offline of ogone bank transfer), if it's not completed because the customer does not pay, we still need this invoice for manual recovery.

So it would be better to trigger the mail with the invoice as soon as the payment as been initiated whether it's been pending, processed or completed

What would be the best trigger for this to cover all gateways ?

Please Log in to join the conversation.

6 years 1 month ago #302121 by krileon
Replied by krileon on topic Generate invoice in pdf
Baskets = Invoices. If the basket exists so does the invoice. If the basket was cleaned up and removed an invoice won't exist so what you're wanting will be impossible unless a new basket is generated by attempting to purchase something. If you want to send an email every time this is done then I guess you'd do that when the basket is initially created before they're sent to a payment processor.

As for what trigger to do this on probably onCPayAfterPaymentBasketUpdated, but I think that may fire several times during the process resulting in multiple emails. Maybe onCPayAfterPaymentStatusUpdateEvent will fire before clicking a payment processor, but I don't think it does.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

6 years 1 month ago #302123 by activha
Replied by activha on topic Generate invoice in pdf
We just want the email to be sent as soon as the basket is marked at least as pending.
But if we have a processor which makes it marked as completed we'll never get the mail, and if we have a processor with slow process we may have several mails

That's just what we want to avoid, in order to get one mail only if the basket is at least marked as pending.

Please Log in to join the conversation.

6 years 1 month ago #302130 by krileon
Replied by krileon on topic Generate invoice in pdf

We just want the email to be sent as soon as the basket is marked at least as pending.

Then probably acting on onCPayAfterPaymentBasketUpdated and checking if the baskets status is pending would work. The variables for that trigger are as follows.

/**
 * Event handler for onCPayAfterPaymentBasketUpdated, called each time a payment basket has been (re)computed and stored to database
 *
 * @param  cbpaidPaymentBasket       $paymentBasket          Payment basket
 * @param  cbpaidPaymentItem[]       $paymentItems           Payment items in the basket
 * @param  cbpaidPaymentTotalizer[]  $paymentTotalizers      Payment totalizers in the basket
 * @return void
 */
public function onCPayAfterPaymentBasketUpdated( $paymentBasket, $paymentItems, $paymentTotalizers )

You'll probably be able to use a condition like the following.

[var1_payment_status] Equal To Pending

If they haven't selected a payment gateway yet though it probably won't be pending yet. You'll need to review the _cbsubs_payment_baskets database table during the basket process to see what status you're wanting it to email on.

That's just what we want to avoid, in order to get one mail only if the basket is at least marked as pending.

I don't know what to advise. It's trial and error getting the right CB Auto Actions usage. I've never configured what you're wanting so I can't offer much advise on the matter. CBSubs may not have a trigger for the usage you're trying to create.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

6 years 1 month ago - 6 years 1 month ago #302155 by activha
Replied by activha on topic Generate invoice in pdf
Acting on onCPayAfterPaymentBasketUpdated and checking if the baskets status is pending does work for offline gateways or gateways that have a delay between paying and processing.

However when we use gateway such as Ingenico, it seems like the basket is not marked as pending but directly marked as completed by CBsubs as the payment is made right away

Do you have a workaround for this ?
What we want to achieve is to trigger something as soon as the basket is at minimum marked as Pending.

Scheme:
if basket is marked as Pending this is triggered, (offline gateways)
if basket is marked at completed or processed but has never been marked as pending, this is triggered (automatic like Ingenico gateways)
if basket is marked as Pending, then later on marked as completed or processed, this is not triggered (maybe slow automatic gateways)

Please Log in to join the conversation.

6 years 1 month ago #302169 by krileon
Replied by krileon on topic Generate invoice in pdf

However when we use gateway such as Ingenico, it seems like the basket is not marked as pending but directly marked as completed by CBsubs as the payment is made right away

Correct.

Do you have a workaround for this ?

Acting on onCPayAfterPaymentBasketUpdated and checking for payment_status of NotInitiated. This is when the basket is first created before a payment method is even selected.

What we want to achieve is to trigger something as soon as the basket is at minimum marked as Pending.

A basket is not always marked pending. It is only marked pending if the payment is pending. In a lot of cases that'll never happen


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.293 seconds

Facebook Twitter LinkedIn