Skip to content

Commit

Permalink
Merge pull request #93 from Ticketpark/i-web-Saferpay-Api-Update
Browse files Browse the repository at this point in the history
saferpay api update 1.23 => 1.31  – with updates
  • Loading branch information
sprain authored Jun 15, 2024
2 parents b772556 + df680fa commit 091a8d8
Show file tree
Hide file tree
Showing 125 changed files with 936 additions and 1,176 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ vendor
.idea
.phpunit.result.cache
/.php-cs-fixer.cache
composer.lock
composer.lock
/example/credentials.php
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Have a look at the [example folder](/example) for more.
Find the most current documentation of the Saferpay JSON API here:<br>
https://saferpay.github.io/jsonapi/

This library is currently based on v1.20 of the Saferpay JSON API.
This library is currently based on v1.31 of the Saferpay JSON API.

## Contribution
You are [welcome to contribute](/.github/contributing.md) to this repo.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"require-dev": {
"phpunit/phpunit": "^9.0",
"phpstan/phpstan": "^1.6",
"friendsofphp/php-cs-fixer": "^3.16"
"friendsofphp/php-cs-fixer": "^3.16",
"rector/rector": "^1.1"
},
"autoload": {
"psr-4": {
Expand Down
61 changes: 60 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/PaymentPage/example-initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
// -----------------------------
// Step 7:
// On success page and notification url, assert that the payment has been successful.
// -> see example-assert.php
// see: example-assert.php
2 changes: 1 addition & 1 deletion example/SecureCardData/example-alias-insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
// -----------------------------
// Step 7:
// On success page and notification url, assert that the payment has been successful.
// -> see example-alias-insert-assert.php
// see: example-alias-insert-assert.php
2 changes: 1 addition & 1 deletion example/Transaction/example-authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
// -----------------------------
// Step 4:
// Capture the transaction to get the cash flowing.
// See ../Transaction/example-capture.php
// see: example-capture.php
6 changes: 3 additions & 3 deletions example/Transaction/example-initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
// -----------------------------
// Step 6:
// Fill in test payment page. For dummy credit card numbers see
// https://saferpay.github.io/sndbx/paymentmeans.html
// https://docs.saferpay.com/home/integration-guide/testing-and-go-live

// -----------------------------
// Step 7:
// On success page and notification url, assert that the payment has been successful.
// TODO: -> see example-assert.php
// Authorize the transaction:
// see: example-authorize.php
60 changes: 31 additions & 29 deletions lib/SaferpayJson/Request/Container/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Ticketpark\SaferpayJson\Request\Container;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;

final class Address
{
Expand All @@ -15,88 +14,79 @@ final class Address
public const GENDER_COMPANY = 'COMPANY';

/**
* @var string|null
* @SerializedName("FirstName")
*/
private $firstName;
private ?string $firstName = null;

/**
* @var string|null
* @SerializedName("LastName")
*/
private $lastName;
private ?string $lastName = null;

/**
* @var string|null
* @SerializedName("Company")
*/
private $company;
private ?string $company = null;

/**
* @var string|null
* @SerializedName("Gender")
*/
private $gender;
private ?string $gender = null;

/**
* @var string|null
* @SerializedName("Street")
*/
private $street;
private ?string $street = null;

/**
* @var string|null
* @SerializedName("Zip")
*/
private $zip;
private ?string $zip = null;

/**
* @var string|null
* @SerializedName("City")
*/
private $city;
private ?string $city = null;

/**
* @var string|null
* @SerializedName("CountryCode")
*/
private $countryCode;
private ?string $countryCode = null;

/**
* @var string|null
* @SerializedName("Email")
*/
private $email;
private ?string $email = null;

/**
* @var \DateTime|null
* @SerializedName("DateOfBirth")
*/
private $dateOfBirth;
private ?\DateTime $dateOfBirth = null;

/**
* @var string|null
* @SerializedName("LegalForm")
*/
private $legalForm;
private ?string $legalForm = null;

/**
* @var string|null
* @SerializedName("Street2")
*/
private $street2;
private ?string $street2 = null;

/**
* @var string|null
* @SerializedName("CountrySubdivisionCode")
*/
private $countrySubdivisionCode;
private ?string $countrySubdivisionCode = null;

/**
* @var string|null
* @SerializedName("Phone")
*/
private $phone;
private ?string $phone = null;

/**
* @SerializedName("VatNumber")
*/
private ?string $vatNumber = null;

public function getFirstName(): ?string
{
Expand Down Expand Up @@ -265,4 +255,16 @@ public function setPhone(?string $phone): self

return $this;
}

public function getVatNumber(): ?string
{
return $this->vatNumber;
}

public function setVatNumber(?string $vatNumber): self
{
$this->vatNumber = $vatNumber;

return $this;
}
}
20 changes: 11 additions & 9 deletions lib/SaferpayJson/Request/Container/AddressForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Ticketpark\SaferpayJson\Request\Container;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;

final class AddressForm
{
Expand All @@ -21,26 +20,29 @@ final class AddressForm
public const MANDATORY_FIELD_STREET = 'STREET';
public const MANDATORY_FIELD_ZIP = 'ZIP';

public const ADDRESS_SOURCE_NONE = 'NONE';
public const ADDRESS_SOURCE_SAFERPAY = 'SAFERPAY';
public const ADDRESS_SOURCE_PREFER_PAYMENTMETHOD = 'PREFER_PAYMENTMETHOD';

/**
* @var bool
* @SerializedName("Display")
* @SerializedName("AddressSource")
*/
private $display;
private string $addressSource;

/**
* @var array<string>|null
* @SerializedName("MandatoryFields")
*/
private $mandatoryFields = [];
private ?array $mandatoryFields = [];

public function __construct(bool $display)
public function __construct(string $addressSource)
{
$this->display = $display;
$this->addressSource = $addressSource;
}

public function isDisplay(): bool
public function getAddressSource(): string
{
return $this->display;
return $this->addressSource;
}

public function getMandatoryFields(): ?array
Expand Down
7 changes: 2 additions & 5 deletions lib/SaferpayJson/Request/Container/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@
namespace Ticketpark\SaferpayJson\Request\Container;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;

final class Alias
{
/**
* @var string
* @SerializedName("Id")
*/
private $id;
private string $id;

/**
* @var string|null
* @SerializedName("VerificationCode")
*/
private $verificationCode;
private ?string $verificationCode = null;

public function __construct(string $id)
{
Expand Down
4 changes: 1 addition & 3 deletions lib/SaferpayJson/Request/Container/Alipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
namespace Ticketpark\SaferpayJson\Request\Container;

use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Type;

final class Alipay
{
/**
* @var string
* @SerializedName("LocalWallet")
*/
private $localWallet;
private string $localWallet;

public function __construct(string $localWallet)
{
Expand Down
6 changes: 2 additions & 4 deletions lib/SaferpayJson/Request/Container/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@
final class Amount
{
/**
* @var int
* @SerializedName("Value")
* @Type("integer")
*/
private $value;
private int $value;

/**
* @var string
* @SerializedName("CurrencyCode")
*/
private $currencyCode;
private string $currencyCode;

public function __construct(int $value, string $currencyCode)
{
Expand Down
Loading

0 comments on commit 091a8d8

Please sign in to comment.