Skip to content

Commit

Permalink
feat(core): major release payvision-sdk-php v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
m.vela committed Dec 11, 2019
1 parent 4940364 commit 243be11
Show file tree
Hide file tree
Showing 73 changed files with 6,722 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "payvision/payvision-sdk-php",
"description": "Payvision PHP SDK",
"type": "library",
"version": "2.1.0",
"version": "3.0.0",
"license": "MIT",
"require": {
"php": "^7.0.13|^7.1",
Expand Down
113 changes: 113 additions & 0 deletions src/Application/Paymentlinks/Service/RequestBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2018-2019 Payvision B.V. (https://www.payvision.com/)
* @license see LICENCE.TXT
*
* Warning! This file is auto-generated! Any changes made to this file will be deleted in the future!
*/

namespace Payvision\SDK\Application\Paymentlinks\Service;

use Payvision\SDK\Domain\Paymentlinks\ValueObject\Link\Request as LinkRequest;
use Payvision\SDK\Domain\Paymentlinks\ValueObject\Cancel\Request as CancelRequest;
use Payvision\SDK\Domain\Paymentlinks\ValueObject\Link\Response as LinkResponse;
use Payvision\SDK\Domain\Paymentlinks\ValueObject\Status\Response as StatusResponse;
use Payvision\SDK\Domain\Paymentlinks\ValueObject\Cancel\Response as CancelResponse;
use Payvision\SDK\Application\Request\Builder;
use Payvision\SDK\Application\ApiRequest;

class RequestBuilder
{
public static function newLink(
LinkRequest $input

): ApiRequest
{
$jsonBody = Builder::toArray($input);
return new ApiRequest(
'paymentlinks',
'POST',
self::getParameters($jsonBody),
$jsonBody['header'] ?? [],
$jsonBody['body'] ?? [],
[],
[
200 => LinkResponse::class,
400 => LinkResponse::class,
401 => LinkResponse::class,
403 => LinkResponse::class,
404 => LinkResponse::class,
500 => LinkResponse::class,
501 => LinkResponse::class,
]
);
}

public static function getLinkStatus(

string $id,
string $businessId
): ApiRequest
{
return new ApiRequest(
\str_replace('{id}', $id, 'paymentlinks/{id}'),
'GET',
[],
[],
[],
[
'businessId' => $businessId
],
[
200 => StatusResponse::class,
400 => StatusResponse::class,
401 => StatusResponse::class,
403 => StatusResponse::class,
404 => StatusResponse::class,
500 => StatusResponse::class,
501 => StatusResponse::class,
]
);
}

public static function cancelLink(
CancelRequest $input,
string $id
): ApiRequest
{
$jsonBody = Builder::toArray($input);
return new ApiRequest(
\str_replace('{id}', $id, 'paymentlinks/{id}/cancel'),
'POST',
self::getParameters($jsonBody),
$jsonBody['header'] ?? [],
$jsonBody['body'] ?? [],
[],
[
200 => CancelResponse::class,
400 => CancelResponse::class,
401 => CancelResponse::class,
403 => CancelResponse::class,
404 => CancelResponse::class,
500 => CancelResponse::class,
501 => CancelResponse::class,
]
);
}

private static function getParameters(array $input): array
{
$parameters = [];

foreach ($input as $key => $value) {
if ($key !== 'header' && $key !== 'body') {
$parameters[$key] = $value;
}
}

return $parameters;
}
}
195 changes: 195 additions & 0 deletions src/Domain/Paymentlinks/Service/Builder/BasicAddress.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2018-2019 Payvision B.V. (https://www.payvision.com/)
* @license see LICENCE.TXT
*
* Warning! This file is auto-generated! Any changes made to this file will be deleted in the future!
*/

namespace Payvision\SDK\Domain\Paymentlinks\Service\Builder;

use Payvision\SDK\Domain\Paymentlinks\ValueObject\BasicAddress as BasicAddressObject;
use Payvision\SDK\Domain\Service\Builder\Basic;

class BasicAddress extends Basic
{
/**
* @return BasicAddressObject
*/
public function build(): BasicAddressObject
{
return $this->buildAndReset();
}

/**
* @param string $ipAddress
* @return self
*/
public function setIpAddress(string $ipAddress): self
{
return $this->set('ipAddress', $ipAddress);
}

/**
* @param \Payvision\SDK\DataType\Date $birthDate
* @return self
*/
public function setBirthDate(\Payvision\SDK\DataType\Date $birthDate): self
{
return $this->set('birthDate', $birthDate);
}

/**
* @param string $companyName
* @return self
*/
public function setCompanyName(string $companyName): self
{
return $this->set('companyName', $companyName);
}

/**
* @param string $customerId
* @return self
*/
public function setCustomerId(string $customerId): self
{
return $this->set('customerId', $customerId);
}

/**
* @param string $deviceType
* @return self
*/
public function setDeviceType(string $deviceType): self
{
return $this->set('deviceType', $deviceType);
}

/**
* @param string $email
* @return self
*/
public function setEmail(string $email): self
{
return $this->set('email', $email);
}

/**
* @param string $familyName
* @return self
*/
public function setFamilyName(string $familyName): self
{
return $this->set('familyName', $familyName);
}

/**
* @param string $givenName
* @return self
*/
public function setGivenName(string $givenName): self
{
return $this->set('givenName', $givenName);
}

/**
* @param string $httpUserAgent
* @return self
*/
public function setHttpUserAgent(string $httpUserAgent): self
{
return $this->set('httpUserAgent', $httpUserAgent);
}

/**
* @param string $identificationNumber
* @return self
*/
public function setIdentificationNumber(string $identificationNumber): self
{
return $this->set('identificationNumber', $identificationNumber);
}

/**
* @param int $identificationTypeId
* @return self
*/
public function setIdentificationTypeId(int $identificationTypeId): self
{
return $this->set('identificationTypeId', $identificationTypeId);
}

/**
* @param string $mobileNumber
* @return self
*/
public function setMobileNumber(string $mobileNumber): self
{
return $this->set('mobileNumber', $mobileNumber);
}

/**
* @param string $phoneNumber
* @return self
*/
public function setPhoneNumber(string $phoneNumber): self
{
return $this->set('phoneNumber', $phoneNumber);
}

/**
* @param string $sex
* @return self
*/
public function setSex(string $sex): self
{
return $this->set('sex', $sex);
}

/**
* @param string $taxNumber
* @return self
*/
public function setTaxNumber(string $taxNumber): self
{
return $this->set('taxNumber', $taxNumber);
}

/**
* @param int $type
* @return self
*/
public function setType(int $type): self
{
return $this->set('type', $type);
}

/**
* @return BasicAddressObject
*/
protected function buildObject(): BasicAddressObject
{
return new BasicAddressObject(
$this->get('ipAddress'),
$this->get('birthDate'),
$this->get('companyName'),
$this->get('customerId'),
$this->get('deviceType'),
$this->get('email'),
$this->get('familyName'),
$this->get('givenName'),
$this->get('httpUserAgent'),
$this->get('identificationNumber'),
$this->get('identificationTypeId'),
$this->get('mobileNumber'),
$this->get('phoneNumber'),
$this->get('sex'),
$this->get('taxNumber'),
$this->get('type')
);
}
}
Loading

0 comments on commit 243be11

Please sign in to comment.