| Algorithms A7. Smart Contract 7: Remove Product |
| Input: product id, batch number, order number, product quantity, addr |
| 1. if addr is valid && addr has adding authentication |
| 2. x= getProduct_Adulteration_Info(product id) |
| 3. y= getProduct_Contamination_Info(product id) |
| 4. if x==0 || y==1 |
| 5. Adulteration found in the product therefore being removed from the supply chain |
| 6. stage_sypplychain[]= getProduct_Status(product id) |
| 7. z=getProduct_Quality(product id) |
| 8. b= getBilling_Info(product id) |
| 9. updateProduct_Info(product id, batch number, order number, product quantity, z, b, false) |
| 10. Product Removed |
| 11. end |
| 12. if y==0 || x==1 |
| 13. Contamination found in the product therefore being removed from the supply chain |
| 14. stage_sypplychain[]= getProduct_Status(product id) |
| 15. z=getProduct_Quality(product id) |
| 16. b= getBilling_Info(product id) |
| 17. updateProduct_Info(product id, batch number, order number, product quantity, z, b, false) |
| 18. Product Removed |
| 19. end |
| 20. else |
| 21. Confirm Product Removal as no adulteration and contamination found |
| 22. updateProduct_Info(product id, batch number, order number, product quantity, false) |
| 23. Product Removed |
| 24. end |
| 25. else |
| 26. Invalid or authorised address |
| 27. go to step 1 and enter a valid address |
| 28. end |