think you just need to use two relays to control
- P2 DIRECTION
- P3 START / STOP
I assume that if you connect the pins of P3 the pump starts and if you disconnect them the pump stops (or vice versa).
Same for the P2 to set the direction.
These devices have a datasheet that should explain the pins and protocols used in detail, so please provide a link to it if available.