Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/grumpy-bats-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

feat(doc, be, payment-gateways): Implement PayXpert gateway adapter Rebilly/rebilly#20190
4 changes: 4 additions & 0 deletions src/Model/GatewayAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ abstract class GatewayAccount implements JsonSerializable

public const GATEWAY_NAME_PAYVISION = 'Payvision';

public const GATEWAY_NAME_PAY_XPERT = 'PayXpert';

public const GATEWAY_NAME_PHAROS_PAYMENTS = 'PharosPayments';

public const GATEWAY_NAME_PIASTRIX = 'Piastrix';
Expand Down Expand Up @@ -1780,6 +1782,8 @@ public static function from(array $data = [], array $metadata = []): self
return PayULatam::from($data, $metadata);
case 'Payvision':
return Payvision::from($data, $metadata);
case 'PayXpert':
return PayXpert::from($data, $metadata);
case 'PharosPayments':
return PharosPayments::from($data, $metadata);
case 'Piastrix':
Expand Down
2 changes: 2 additions & 0 deletions src/Model/GetPayoutRequestPaymentInstrumentsResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ class GetPayoutRequestPaymentInstrumentsResponse implements JsonSerializable

public const GATEWAY_NAME_PAYVISION = 'Payvision';

public const GATEWAY_NAME_PAY_XPERT = 'PayXpert';

public const GATEWAY_NAME_PHAROS_PAYMENTS = 'PharosPayments';

public const GATEWAY_NAME_PIASTRIX = 'Piastrix';
Expand Down
2 changes: 2 additions & 0 deletions src/Model/GetPayoutRequestV2PaymentInstrumentsResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ class GetPayoutRequestV2PaymentInstrumentsResponse implements JsonSerializable

public const GATEWAY_NAME_PAYVISION = 'Payvision';

public const GATEWAY_NAME_PAY_XPERT = 'PayXpert';

public const GATEWAY_NAME_PHAROS_PAYMENTS = 'PharosPayments';

public const GATEWAY_NAME_PIASTRIX = 'Piastrix';
Expand Down
89 changes: 89 additions & 0 deletions src/Model/PayXpert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

/**
* This source file is proprietary and part of Rebilly.
*
* (c) Rebilly SRL
* Rebilly Ltd.
* Rebilly Inc.
*
* @see https://www.rebilly.com
*/

declare(strict_types=1);

namespace Rebilly\Sdk\Model;

use Rebilly\Sdk\Trait\HasMetadata;

class PayXpert extends GatewayAccount
{
use HasMetadata;

private array $fields = [];

public function __construct(array $data = [], array $metadata = [])
{
parent::__construct([
'gatewayName' => 'PayXpert',
] + $data, $metadata);

if (array_key_exists('credentials', $data)) {
$this->setCredentials($data['credentials']);
}
if (array_key_exists('threeDSecureServer', $data)) {
$this->setThreeDSecureServer($data['threeDSecureServer']);
}
$this->setMetadata($metadata);
}

public static function from(array $data = [], array $metadata = []): self
{
return new self($data, $metadata);
}

public function getCredentials(): PayXpertCredentials
{
return $this->fields['credentials'];
}

public function setCredentials(PayXpertCredentials|array $credentials): static
{
if (!($credentials instanceof PayXpertCredentials)) {
$credentials = PayXpertCredentials::from($credentials);
}

$this->fields['credentials'] = $credentials;

return $this;
}

public function getThreeDSecureServer(): ?ThreeDSecureIO3dsServer
{
return $this->fields['threeDSecureServer'] ?? null;
}

public function setThreeDSecureServer(null|ThreeDSecureIO3dsServer|array $threeDSecureServer): static
{
if ($threeDSecureServer !== null && !($threeDSecureServer instanceof ThreeDSecureIO3dsServer)) {
$threeDSecureServer = ThreeDSecureIO3dsServer::from($threeDSecureServer);
}

$this->fields['threeDSecureServer'] = $threeDSecureServer;

return $this;
}

public function jsonSerialize(): array
{
$data = [];
if (array_key_exists('credentials', $this->fields)) {
$data['credentials'] = $this->fields['credentials']->jsonSerialize();
}
if (array_key_exists('threeDSecureServer', $this->fields)) {
$data['threeDSecureServer'] = $this->fields['threeDSecureServer']?->jsonSerialize();
}

return parent::jsonSerialize() + $data;
}
}
78 changes: 78 additions & 0 deletions src/Model/PayXpertCredentials.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

/**
* This source file is proprietary and part of Rebilly.
*
* (c) Rebilly SRL
* Rebilly Ltd.
* Rebilly Inc.
*
* @see https://www.rebilly.com
*/

declare(strict_types=1);

namespace Rebilly\Sdk\Model;

use JsonSerializable;
use Rebilly\Sdk\Trait\HasMetadata;

class PayXpertCredentials implements JsonSerializable
{
use HasMetadata;

private array $fields = [];

public function __construct(array $data = [], array $metadata = [])
{
if (array_key_exists('username', $data)) {
$this->setUsername($data['username']);
}
if (array_key_exists('password', $data)) {
$this->setPassword($data['password']);
}
$this->setMetadata($metadata);
}

public static function from(array $data = [], array $metadata = []): self
{
return new self($data, $metadata);
}

public function getUsername(): string
{
return $this->fields['username'];
}

public function setUsername(string $username): static
{
$this->fields['username'] = $username;

return $this;
}

public function getPassword(): string
{
return $this->fields['password'];
}

public function setPassword(string $password): static
{
$this->fields['password'] = $password;

return $this;
}

public function jsonSerialize(): array
{
$data = [];
if (array_key_exists('username', $this->fields)) {
$data['username'] = $this->fields['username'];
}
if (array_key_exists('password', $this->fields)) {
$data['password'] = $this->fields['password'];
}

return $data;
}
}
2 changes: 2 additions & 0 deletions src/Model/PayoutRequestAllocations.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ class PayoutRequestAllocations implements JsonSerializable

public const GATEWAY_NAME_PAYVISION = 'Payvision';

public const GATEWAY_NAME_PAY_XPERT = 'PayXpert';

public const GATEWAY_NAME_PHAROS_PAYMENTS = 'PharosPayments';

public const GATEWAY_NAME_PIASTRIX = 'Piastrix';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ class PickInstructionGatewayAcquirerWeightsWeightedList implements JsonSerializa

public const GATEWAY_NAME_PAYVISION = 'Payvision';

public const GATEWAY_NAME_PAY_XPERT = 'PayXpert';

public const GATEWAY_NAME_PHAROS_PAYMENTS = 'PharosPayments';

public const GATEWAY_NAME_PIASTRIX = 'Piastrix';
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ class Transaction implements JsonSerializable

public const GATEWAY_NAME_PAYVISION = 'Payvision';

public const GATEWAY_NAME_PAY_XPERT = 'PayXpert';

public const GATEWAY_NAME_PHAROS_PAYMENTS = 'PharosPayments';

public const GATEWAY_NAME_PIASTRIX = 'Piastrix';
Expand Down
Loading