function pixCobrancaEstatico
This commit is contained in:
parent
1eea65bef7
commit
3758d3f1d0
2 changed files with 41 additions and 0 deletions
23
src/Pix.php
23
src/Pix.php
|
@ -255,4 +255,27 @@ class Pix extends Kore
|
||||||
$payload
|
$payload
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function pixCobrancaEstatico($payload)
|
||||||
|
{
|
||||||
|
pixCobrancaEstaticoRules($payload);
|
||||||
|
$korePayload = [
|
||||||
|
'valor' => $payload['valor'] ?? 0,
|
||||||
|
'chave' => $payload['chave'],
|
||||||
|
'txid' => $payload['txid'] ?? null,
|
||||||
|
'solicitacaoPagador' => $payload['solicitacaoPagador'] ?? null
|
||||||
|
];
|
||||||
|
|
||||||
|
return curlRequest(
|
||||||
|
$this->url . '/post',
|
||||||
|
'POST',
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
'x-kore-drone-uid: drone:' . $this->drone,
|
||||||
|
'x-kore-drone-sign: ' . $this->signBody($korePayload)
|
||||||
|
],
|
||||||
|
$payload
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,3 +134,21 @@ function pixCobrancaImediataTrocoComValorRules(array $data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function pixCobrancaEstaticoRules(array $data)
|
||||||
|
{
|
||||||
|
$rules = [
|
||||||
|
'valor' => 'sometimes|integer',
|
||||||
|
'chave' => 'required|string',
|
||||||
|
'txid' => 'sometimes|string|max:100',
|
||||||
|
'solicitacaoPagador' => 'sometimes|string|max:140',
|
||||||
|
];
|
||||||
|
|
||||||
|
$validate = validate($data, $rules);
|
||||||
|
if (!$validate['valid']) {
|
||||||
|
throw new Exception(json_encode(array_slice($validate['errors'], 0, 1)), 500);
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue