<?php
namespace Illuminate\Http\Concerns;
use Illuminate\Support\Collection;
trait CanBePrecognitive
{
/**
* Filter the given array of rules into an array of rules that are included in precognitive headers.
*
* @param array $rules
* @return array
*/
public function filterPrecognitiveRules($rules)
{
if (! $this->headers->has('Precognition-Validate-Only')) {
return $rules;
}
return Collection::make($rules)
->only(explode(',', $this->header('Precognition-Validate-Only')))
->all();
}
/**
* Determine if the request is attempting to be precognitive.
*
* @return bool
*/
public function isAttemptingPrecognition()
{
return $this->header('Precognition') === 'true';
}
/**
* Determine if the request is precognitive.
*
* @return bool
*/
public function isPrecognitive()
{
return $this->attributes->get('precognitive', false);
}
}
Checks the status of a payment.
**Response: SUCCESS (200 OK)**
{
"message": {
"success": [
"Success"
]
},
"data": {
"token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
"trx_id": "CP44657864",
"payer": {
"username": "testuser",
"email": "user@appdevs.net"
}
"status": "Test",
},
"type": "success"
}