@@ -306,6 +306,10 @@ public function withDevice(
306306 * - `recurring_purchase`
307307 * - `referral`
308308 * - `survey`
309+ * @param string|null $party The party submitting the transaction. The valid values
310+ * are:
311+ * - `agent`
312+ * - `customer`
309313 *
310314 * @return MinFraud A new immutable MinFraud object. This object is a clone of
311315 * the original with additional data.
@@ -319,13 +323,15 @@ public function withEvent(
319323 ?string $ time = null ,
320324 ?string $ transactionId = null ,
321325 ?string $ type = null ,
326+ ?string $ party = null ,
322327 ): self {
323328 if (\count ($ values ) !== 0 ) {
324329 if (\func_num_args () !== 1 ) {
325330 throw new \InvalidArgumentException (
326331 'You may only provide the $values array or named arguments, not both. ' ,
327332 );
328333 }
334+ $ party = $ this ->remove ($ values , 'party ' );
329335 $ shopId = $ this ->remove ($ values , 'shop_id ' );
330336 $ time = $ this ->remove ($ values , 'time ' );
331337 $ transactionId = $ this ->remove ($ values , 'transaction_id ' );
@@ -334,6 +340,13 @@ public function withEvent(
334340 $ this ->verifyEmpty ($ values );
335341 }
336342
343+ if ($ party !== null ) {
344+ if (!\in_array ($ party , ['agent ' , 'customer ' ], true )) {
345+ $ this ->maybeThrowInvalidInputException ("$ party is not a valid party " );
346+ }
347+ $ values ['party ' ] = $ party ;
348+ }
349+
337350 if ($ shopId !== null ) {
338351 $ values ['shop_id ' ] = $ shopId ;
339352 }
0 commit comments