1: <?php
2:
3: declare(strict_types=1);
4:
5: /*
6: * This file has been auto generated by Jane,
7: *
8: * Do no edit it directly.
9: */
10:
11: namespace NxSys\Library\Clients\Brex\API\Payments\Endpoint;
12:
13: class CreateIncomingTransfer extends \NxSys\Library\Clients\Brex\API\Payments\Runtime\Client\BaseEndpoint implements \NxSys\Library\Clients\Brex\API\Payments\Runtime\Client\Endpoint
14: {
15: use \NxSys\Library\Clients\Brex\API\Payments\Runtime\Client\EndpointTrait;
16:
17: /**
18: This endpoint creates a new incoming transfer. You may use use any eligible bank account connection to fund (ACH Debit)
19: any active Brex cash account.
20:
21: **Reminder**: You may not use the Brex API for any activity that requires a license or registration from any.
22: *
23: * @param array $headerParameters {
24: *
25: * @var string $Idempotency-Key
26: * }
27: */
28: public function __construct(\NxSys\Library\Clients\Brex\API\Payments\Model\CreateIncomingTransferRequest $requestBody, array $headerParameters = [])
29: {
30: $this->body = $requestBody;
31: $this->headerParameters = $headerParameters;
32: }
33:
34: public function getMethod(): string
35: {
36: return 'POST';
37: }
38:
39: public function getUri(): string
40: {
41: return '/v1/incoming_transfers';
42: }
43:
44: public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
45: {
46: if ($this->body instanceof \NxSys\Library\Clients\Brex\API\Payments\Model\CreateIncomingTransferRequest) {
47: return [['Content-Type' => ['application/json']], $serializer->serialize($this->body, 'json')];
48: }
49:
50: return [[], null];
51: }
52:
53: public function getExtraHeaders(): array
54: {
55: return ['Accept' => ['application/json']];
56: }
57:
58: protected function getHeadersOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
59: {
60: $optionsResolver = parent::getHeadersOptionsResolver();
61: $optionsResolver->setDefined(['Idempotency-Key']);
62: $optionsResolver->setRequired(['Idempotency-Key']);
63: $optionsResolver->setDefaults([]);
64: $optionsResolver->addAllowedTypes('Idempotency-Key', ['string']);
65:
66: return $optionsResolver;
67: }
68:
69: /**
70: * {@inheritdoc}
71: *
72: * @return \NxSys\Library\Clients\Brex\API\Payments\Model\Transfer|null
73: */
74: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
75: {
76: $status = $response->getStatusCode();
77: $body = (string) $response->getBody();
78: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
79: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Payments\\Model\\Transfer', 'json');
80: }
81: }
82:
83: public function getAuthenticationScopes(): array
84: {
85: return ['OAuth2'];
86: }
87: }
88: