Shopware 6 PayPal Invoice Purchase does not include order_transaction custom_fields swag_paypal_pui_payment_instruction on some orders - paypal

We sporadically observe missing data in PayPal purchase on invoice purchase orders. We have a middleware that listen to "state_enter.order_transaction.state.paid" webhook and then forwards the order to an ERP system.
Until now we have received all necessary data in the order_transaction => custom_fields. For invoice purchase the swag_paypal_pui_payment_instruction data are important for us.
{
"swag_paypal_order_id": "....",
"swag_paypal_partner_attribution_id": "shopwareAG_Cart_Shopware6_PPCP",
"swag_paypal_pui_payment_instruction": {
"name": {... },
"email": "...",
"birth_date": "...",
"phone": {...},
"billing_address": {...},
"payment_reference": "...",
"deposit_bank_details": {...},
"experience_context": {....},
"swag_paypal_resource_id": "..."
}
However, for some orders we do not receive any data in the field: swag_paypal_pui_payment_instruction.
{
"swag_paypal_order_id": "....",
"swag_paypal_partner_attribution_id": "shopwareAG_Cart_Shopware6_PPCP"
}
But it is not a problem with the webhook or the request, because the data is already not available in the database for this orders.
I find the following error messages in the logs at this date, but for a different transaction, which then has the necessary data at the end. But I cannot find any log entries for the transaction that has no data.
[2022-11-27T20:30:10.896943+00:00] request.ERROR: Uncaught PHP Exception Swag\PayPal\Checkout\PUI\Exception\PaymentInstructionsNotReadyException: "Payment instructions for transaction "b87…….b0c1" not yet available" at /var/www/clients/client1/web3/web/prod/custom/plugins/SwagPayPal/src/Checkout/PUI/SalesChannel/PUIPaymentInstructionsRoute.php line 129 {"exception":"[object] (Swag\\PayPal\\Checkout\\PUI\\Exception\\PaymentInstructionsNotReadyException(code: 0): Payment instructions for transaction \" b87…….b0c1\" not yet available at /var/www/clients/client1/web3/web/prod/custom/plugins/SwagPayPal/src/Checkout/PUI/SalesChannel/PUIPaymentInstructionsRoute.php:129)"} []
Has anyone observed anything similar?
Shopware Version: 6.4.14.0
Paypal Plugin: 5.4.1

Here is shopwares support answer, it may help someone.
„The behaviour occurs when the customer does not wait for the confirmation from PayPal after the redirection from PayPal back to the shop.“
Ich hab den Sachverhalt nochmal genau geprüft und nach Rücksprache mit
der Entwicklung identifizieren können, dass das Verhalten auftritt,
wenn der Kunde nach der Umleitung von PayPal zum Shop zurück die
Bestätigung von PayPal nicht abwartet. Dieses Verhalten ist
entsprechend nicht direkt auf Shopware-Seite beeinflussbar. Die Kunden
erhalten von RatePay / PayPal eine E-Mail mit der
Zahlungsaufforderung. In solchen Fällen schreibt Shopware ein
entsprechenden Hinweis auf die Rechnung anstelle der Kontodetails.
Unfortunately, the reference mentioned does not exist. The last statement is that Shopware will look into it.
ich habe mich noch mal Rücksprache mit der Entwicklung gehalten. Die
Meldung auf der Rechnung erscheint nur, wenn der Zahlvorgang auch
funktioniert hat. Wir schauen uns für zukünftige Updates an, ob sich
das noch anders lösen lässt. In jedem Fall, also egal ob der Kunde die
Bestätigung von PayPal abwartet oder nicht abwartet wird eine Mail von
Ratepay mit den Zahlungsinformationen versendet.
I hope that it will be possible to solve this better in the future so that the necessary data can be transferred cleanly to other systems.

I'm not super familiar with the PayPal plugin but just from looking at the code I found two instances where the custom field is written.
PlusPuiHandler, PayPalPuiPaymentHandler
In both cases the custom field is explicitly not written if the instruction type is not invoice or if the payment instructions are null. Since you mentioned this specifically regards invoice payments, there's only one place I could find where instructions are set.
PUIPaymentInstructionDataService
There's potentially a PaymentInstructionsNotReadyException being thrown here. So it looks like you were on the right track. The exception is also deliberately being caught with the intention of "polling it later", even though I'm not quite sure what that means. Maybe you could try and repeat the call used for the argument of setPaymentInstructions and get the instructions at a later point?

Related

microsoft not sending change notifications. Api callRecords

I using azure function for this. If I send a post with the public URL of the function, I can't see the call ids that microsoft sends me. I only get the notification from Microsoft that it accepts the endpoint for sending change notifications but I don't see these ids. I read in other forums that calls can take a while to arrive but hours go by without sending me the caller ID. Do you know if there is anything new with this?
{
"changeType": "updated,created",
"notificationUrl": "https://subscriptions-treeam.azurewebsites.net/api/GraphNotificationHook?",
"resource": "/communications/callRecords",
"expirationDateTime": "2022-08-24T11:00:00.0000000Z",
"clientState": "secretClientState"
}
The response of MS is this
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
"id": "b3x1w7db-9e71-4t91-b26g-6f5d1f502fc7",
"resource": "/communications/callRecords",
"applicationId": "9bg5x3b5-e859-2ec4-ac02-7g895f956da0",
"changeType": "created,updated",
"clientState": "secretClientState",
"notificationUrl": "https://subscriptions-treeam.azurewebsites.net/api/GraphNotificationHook?",
"notificationQueryOptions": null,
"lifecycleNotificationUrl": null,
"expirationDateTime": "2022-08-24T11:00:00Z",
"creatorId": "fr73bf06-f07a-37g9-7dde-85ee33b21tf2",
"includeResourceData": null,
"latestSupportedTlsVersion": "v1_2",
"encryptionCertificate": null,
"encryptionCertificateId": null,
"notificationUrlAppId": null
}
now, I see a lot of log but not the ID of the calls that the users of a tenan make from Microsoft teams.
Logs from function
2022-08-22T19:29:45.522 [Information] La función de activación HTTP de C# procesó una solicitud
2022-08-22T19:29:45.523 [Information] [null]
2022-08-22T19:29:45.523 [Information] Executed 'GraphNotificationHook' (Succeeded, Id=703350f0-2081-489c-99bf-be6364bdebce, Duration=1ms)
2022-08-22T19:29:45.634 [Information] Executing 'GraphNotificationHook' (Reason='This function was programmatically called via the host APIs.', Id=1c4d9739-b42d-32ff-be60-b1db1f7439f2)
i try calls from MS teams and i register the URL in the app registration
enter image description here
I don't know what I'm missing to receive notifications from microsoft teams.
the code in github here: https://github.com/wolarte/GraphNotificationHook

Create class notebook fails if group contains disabled users, even if teacher, student sections of create call is empty

Here is the scenario to reproduce the error:
Take a Microsoft Education Tenant (Demo Tenant is sufficient)
Create a fresh user with valid office 365 license and usage location
Disable the account (set block sign-in) to true in Azure Portal
Create a group and add this user as member
That's the minimum scenario we need. It is also possible to have other (enabled) users within the group, but that doesn't change the behaviour. Now let's follow the documentation to create a class notebook:
POST https://www.onenote.com/api/v1.0/myOrganization/groups/{groupId}/notes/classNotebooks/?omkt=de-de
{
"name": "Class notebook of my group",
"teachers": [],
"students": [],
"studentSections": [],
"hasTeacherOnlySectionGroup": true
}
So, the unified group has just one member with an disabled account, but this specific user is NOT added into the teachers or students section of the create request. Nevertheless the following error message occurs:
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (NotFound).
{
"error": {
"code": "30109",
"message": "The following users are invalid: Message: Der angegebene Benutzer disabled.user#mydomain.com wurde nicht gefunden., ServerErrorCode: -2146232832, ServerErrorTypeName: Microsoft.SharePoint.SPException",
"#api.url": "https://aka.ms/onenote-errors#C30109"
}
}
After getting the clarification from Marc our current procedure is as follows:
Get a list of all disabled users.
Enable all of them.
Wait one minute (cause Graph needs some time to propagate this).
Create the course notebook through OneNote API.
Disable all users from the initial list again.
With this everything works as expected.
The error message isn't clear but Teachers maps Owners and Students maps to Members. So even though you didn't specify this user in the students collection, they are a member of the Group and therefore they're considered part of the students collection.
When an 30109 error like this is encountered, the only workaround is either iterate through the Owners and Members and remove any disabled accounts, or parse the message property for the UPN (disabled.user#mydomain.com). It is less than ideal I know.

How to markup a legal permission with a linked digital copy by using the "Occupation" type?

I'm just creating the schema code for my aboutme-page, where I introduce myself and my professions. I'm an alternative healer. Person is (and should remain, if possible) the top-level-item. On the aboutme-page I have referenced my legal state permission by linking to a digital copy on my site (.jpg).
The code I have created so far:
"#type": "Person",
"hasOccupation": {
"#type": "Occupation",
"name": "alternative healer",
"educationRequirements": {
"#type": "EducationalOccupationalCredential",
"credentialCategory": "state permission for alternative healers"
"recognizedBy": {
"#type": "GovernmentOrganization",
"name": "(name of government agency)"
},
"license": "(Wordpress-URL of state permission as .jpg)"
}
}
}
Is this code correct regarding the last property license, which should connect to the digital copy as an linked .jpg? Is it understandable this way for search engines that this digital copy is my concrete state permission and not any sample?
Would it be better to use url or image as understandable connection to my permission, instead of license? Or DigitalDocument?
The license property gives the license (e.g., as in copyright license) that applies to the creative work. It’s not for any kind of thing that gets called license.
Your EducationalOccupationalCredential represents the legal state permission license; if you provide a license property, it would be for giving the license (e.g., copyright) of the license (legal state permission).
To provide the digital file, you can use one (or several) of these ways:
associatedMedia/encoding - this allows you to provide metadata about the file
image - can be just the URL, or also an object that allows you to provide metadata about the file
url - this doesn’t allow you to provide metadata about the file

Paypal shopping cart AMOUNT_ERROR

I am having a issue with a paypal cart since the update around march (bit late but the site is not used yet and we just discovered it now).
I already checked this question but it did not solve the issue for a shopping cart (Paypal : hosted button payments fail with code=AMOUNT_ERROR)
We send a object that contains the request data through a plugin called neo.js, this works fine as far as we know.
This is our data we send to paypal as a js object.
{
amount_1: 10.01,
business: "noreply#domain.com",
cancel_return: "https://dev.domain.com",
charset: "utf-8",
cmd: "_cart",
currency_code: "US",
custom: "username",
item_name_1: "$10 item",
item_number_1: "1",
no_shipping: 1,
notify_url: "https://dev.domain.com/callback/paypal.php",
quantity_1: 1,
return: "https://dev.domain.com",
upload: 1
}
It has to do something with the amount, but using a , instead of . but that only gives a normal error message on screen that the format is incorrect.
We have tried multiple things including the dollar sign and making it a string but nothing seem to be working.
I reproduced the error and it is due to the wrong currency code passed.
You are passing "US" but the currency code (that is a parameter that refers to the AMOUNT as in the error returned) must be of 3 characters as you can see on PayPal guide: https://developer.paypal.com/webapps/developer/docs/classic/api/currency_codes/
Change it to "USD" instead and you will have a working checkout.

Completed orders on Woocommerce don't send e-mail message to customer

I do not get any e-mails after the order is completed. I have read through many support threads and tried to fix it by myself but it does not work. I have even tested with this plugin: https://wordpress.org/plugins/wp-smtp/ – I get messages with or without a specified server.
I don’t know if it makes any difference but I copied the template file for this email message and changed the message to:
<p><?php printf( __( 'Hej! Din beställning på %s har blivit slutbehandlat.</br></br> Tusen tack och tusen grattis till att du köpt utbildningen Tänk dig fri! Detta är en av de viktigaste investeringarna i dig själv som du kan göra. Jag hoppas att utbildningen kommer ge dig allt det du längtar efter!<br/><br/>Här är en länk till ett videoklipp jag vill att du kollar på innan du börjar studera kapitel 1.<br/><br/>Ljudfilerna till boken finner du här.<br/><br/>Tänk dig fri boken skickas vanligen till dig inom 2-5 arbetsdagar. Dina beställningsdetaljer finns längst ner i detta meddelande.<br/><br/>Många varma lyckönskningar,<br/>Susanna<br/><br/>', 'woocommerce' ), get_option( 'blogname' ) ); ?></p>
This template is on my child-theme folder inside of woocommerce/emails. For what matters I – as a customer – have never received any message and yes, I have checked my spam box.
I got it! The issue was being caused by the fact that the woocommerce e-mail sender had an email address that did not match with the domain. I changed the e-mail address and now everything works perfectly.
Hope this might help anyone else!