PAYPAL API ORDER EMAIL SENT EVEN IF PAYMENT DECLINED -- 2

Job ID: 37286086

Budget: $30 – $250 USD

im using paypal api v2 on my store
99.999% of payments are fine and return with transaction status COMPLETED and the order email gets sent to me to process the order.
however there seems to be a bug or a flaw in the code logic that sends the email out when the transaction status is DECLINED.

SOLUTION 1:
We need to patch the code to put a condition that order emails do NOT get sent when the transaction status is DECLINED

SOLUTION 2:
We need to patch the code to put a condition that order emails ONLY get sent when the transaction status is COMPLETED
i.e
We need to patch the code to put a condition that order emails do NOT get sent when the transaction status is NOT "COMPLETED.
The difference here is it covers all the other cases which are not COMPLETED, this includes DECLINED and a few others. Im not sure we need to be this overkill.
Solution 1 should work for now and if any other order get thru with a different status we can update accordingly. generally it will only ever be COMPLETED or DECLINED.

So basically youre adding a condition before the email is sent to say

IF transacction status == DECLINED then dont send order email
ELSE send order email.

if any new status comes up we can change it to include the new status in the array or simply use

IF transaction status !== COMPLETED (not COMPLETED)

anyway ur the expert the exact technical syntax and code will be done by you the above is an illustration

i want this done in real time
i have all the code and ftp for u to show u the variables etc u just write the conditions

if u do a good job i have many other job for u

no time wasters
i will need to speak to u and share my screen to
we will be testing this before ending project.
Related categories: PHP JavaScript PayPal API OSCommerce MySQL