Hello!
I need a script designed which will compare the data in 2 sets of emails and provide an output based on certain [login to view URL] read the following to understand details.
The situation:
I have a system through which I receive an email automatically when a customer does one or more transaction(s) in ONE* instance. This one email may contain any-number* of Paypal Transaction IDs (PTIs) and the data of the customer (mostly his/her email and name) who carried out the transaction. We will refer to this email as Document A.
------------------------------------------------------------------------------------------------
*The number of PTIs may vary from say 1 to N, where upto N (a variable) transactions are allowed to be done by the customer in ONE instance before the email can be sent to me (Document A).
• The customer can choose the value for N. PTI stands for Paypal Transaction ID.
• A proper definition of an Insatnce follows.
>>> Let us say that I receive this email (i.e. Document A) on my email address .
Around the same time as I receive this email, I also receive emails (ideally as many as N) from Paypal for each transaction, each email containing the data on customer and one PTI. We will refer to these emails as a set of documents B.
>>> I have a choice to receive the set of Documents B per instance either on email address or at the email address .
The need:
I want to create a script which will automatically analyse and compare the PTI data and at the end of each instance across the Document A and Set of Documents B.
1 Every time Document A is generated, it should trigger the script to action, i.e. every time Document A is generated, it will be an instance.
2 This analysis and comparison will essentially consist in finding if -
a. the number of PTIs in Document A are the same as the number of PTIs across the Set of Documents B, and if
b. the PTIs in Document A are identical to the PTIs in the Set of Documents B. (The order (sequence) of PTIs is not important per instance).
As long as the number of PTIs and the PTIs match across A and B, the system should just maintain a log of comparison per insatnce. But -
• If the number of PTIs do not match and/or
• If the PTIs in A and B are not identical,
… the script should send an email with detailed report (as to what does not match… the number or the IDs or both?) to me at an email address .
Other Points to be noted:
1. I can format Document A only to an extent, while I have no control over the format of Document-Set B.
2. The script should be running on my server.
3. The script should ask me the inputs for email address , and .
Thank you for your attention and time. I look forward to your answers asap.
Regards,
Acer
The actions can be automated with cURL. IDs can be matched by using regular expressions. Timing is important in the case where a 'B' e-mail is received with a delay.