diff --git a/examples/payment/01-epayment-init.php b/examples/payment/01-epayment-init.php
index 1664945..ea1f623 100644
--- a/examples/payment/01-epayment-init.php
+++ b/examples/payment/01-epayment-init.php
@@ -6,12 +6,12 @@
$settings = \Symfony\Component\Yaml\Yaml::parse(file_get_contents(__DIR__.'/../config.yml'));
try {
- $http_client = new \GuzzleHttp\Client(
- ['headers' => [
- 'Merchant-Serial-Number' => $settings['merchant_serial_number'],
- ]]
- );
- $client = new \zaporylie\Vipps\Client($settings['client_id'], ['http_client' => $http_client]);
+ $http_client = new \GuzzleHttp\Client();
+ $client = new \zaporylie\Vipps\Client($settings['client_id'], [
+ 'http_client' => $http_client,
+ 'vipps_system_name' => 'vipps_zaporylie_example',
+ 'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+ ]);
$vipps = new \zaporylie\Vipps\Vipps($client);
$authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
$authorization->getToken($settings['client_secret']);
diff --git a/examples/recurring_payment/01-recurring-payment-create.php b/examples/recurring_payment/01-recurring-payment-create.php
new file mode 100644
index 0000000..3a54de9
--- /dev/null
+++ b/examples/recurring_payment/01-recurring-payment-create.php
@@ -0,0 +1,39 @@
+ $http_client,
+ 'vipps_system_name' => 'vipps_zaporylie_example',
+ 'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+ ]);
+ $vipps = new \zaporylie\Vipps\Vipps($client);
+ $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+ $authorization->getToken($settings['client_secret']);
+ $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+ $result = $payment->createAgreement((new \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement())
+ ->setPricing((new \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing())
+ ->setCurrency('NOK')
+ ->setType('FLEXIBLE')
+ ->setAmount(1000))
+ ->setMerchantRedirectUrl('https://eoncxehuh2o2qyq.m.pipedream.net')
+ ->setMerchantAgreementUrl('https://eoncxehuh2o2qyq.m.pipedream.net')
+ ->setProductName('Recurring Product that is being purchased'));
+ echo '
';
+ var_dump($result);
+ echo '
';
+
+}
+catch (\Exception $e) {
+ echo '';
+ var_dump($e->getMessage());
+ var_dump($e->getTraceAsString());
+ echo '
';
+}
+
+?>
diff --git a/examples/recurring_payment/01-recurring-payment-get.php b/examples/recurring_payment/01-recurring-payment-get.php
new file mode 100644
index 0000000..aff383f
--- /dev/null
+++ b/examples/recurring_payment/01-recurring-payment-get.php
@@ -0,0 +1,32 @@
+ $http_client,
+ 'vipps_system_name' => 'vipps_zaporylie_example',
+ 'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+ ]);
+ $vipps = new \zaporylie\Vipps\Vipps($client);
+ $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+ $authorization->getToken($settings['client_secret']);
+ $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+ $result = $payment->getAgreement('agr_KG6k3X3');
+ echo '';
+ var_dump($result);
+ echo '
';
+
+}
+catch (\Exception $e) {
+ echo '';
+ var_dump($e->getMessage());
+ var_dump($e->getTraceAsString());
+ echo '
';
+}
+
+?>
diff --git a/examples/recurring_payment/02-recurring-payment-create-charge.php b/examples/recurring_payment/02-recurring-payment-create-charge.php
new file mode 100644
index 0000000..bdb3edc
--- /dev/null
+++ b/examples/recurring_payment/02-recurring-payment-create-charge.php
@@ -0,0 +1,44 @@
+ $http_client,
+ 'vipps_system_name' => 'vipps_zaporylie_example',
+ 'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+ ]);
+ $vipps = new \zaporylie\Vipps\Vipps($client);
+ $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+ $authorization->getToken($settings['client_secret']);
+ $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+ $result = $payment->createCharge('agr_KG6k3X3', (new \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge())
+ ->setAmount(1000)
+ ->setDescription('Ok, that worked')
+ ->setDue(new DateTime('+1 day'))
+ ->setTransactionType('DIRECT_CAPTURE'));
+ echo '';
+ var_dump($result);
+ echo '
';
+ $result = $payment->createCharge('agr_KG6k3X3', (new \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge())
+ ->setAmount(1100)
+ ->setType('UNSCHEDULED')
+ ->setDescription('Ok, that worked too')
+ ->setTransactionType('DIRECT_CAPTURE'));
+ echo '';
+ var_dump($result);
+ echo '
';
+
+}
+catch (\Exception $e) {
+ echo '';
+ var_dump($e->getMessage());
+ var_dump($e->getTraceAsString());
+ echo '
';
+}
+
+?>
diff --git a/examples/recurring_payment/02-recurring-payment-get-charge.php b/examples/recurring_payment/02-recurring-payment-get-charge.php
new file mode 100644
index 0000000..e63571d
--- /dev/null
+++ b/examples/recurring_payment/02-recurring-payment-get-charge.php
@@ -0,0 +1,32 @@
+ $http_client,
+ 'vipps_system_name' => 'vipps_zaporylie_example',
+ 'vipps_system_version' => \zaporylie\Vipps\Client::VERSION,
+ ]);
+ $vipps = new \zaporylie\Vipps\Vipps($client);
+ $authorization = new \zaporylie\Vipps\Api\Authorization($vipps, $settings['subscription_key']);
+ $authorization->getToken($settings['client_secret']);
+ $payment = new \zaporylie\Vipps\Api\v3\RecurringPayment($vipps, $settings['subscription_key'], $settings['merchant_serial_number']);
+ $result = $payment->getCharge('agr_KG6k3X3','chr-gTHPbNE');
+ echo '';
+ var_dump($result);
+ echo '
';
+
+}
+catch (\Exception $e) {
+ echo '';
+ var_dump($e->getMessage());
+ var_dump($e->getTraceAsString());
+ echo '
';
+}
+
+?>
diff --git a/src/Api/v3/RecurringPayment.php b/src/Api/v3/RecurringPayment.php
index a06d311..aa9b326 100644
--- a/src/Api/v3/RecurringPayment.php
+++ b/src/Api/v3/RecurringPayment.php
@@ -4,10 +4,16 @@
use zaporylie\Vipps\Api\ApiBase;
use zaporylie\Vipps\Exceptions\Api\InvalidArgumentException;
+use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestRefundCharge;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestUpdateAgreement;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateAgreement;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateCharge;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetAgreement;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge;
+use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
use zaporylie\Vipps\Resource\RecurringPayment\v3\CancelCharge;
use zaporylie\Vipps\Resource\RecurringPayment\v3\CaptureCharge;
use zaporylie\Vipps\Resource\RecurringPayment\v3\CreateAgreement;
@@ -68,9 +74,9 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function createAgreement(RequestCreateAgreement $request)
- {
- $resource = new CreateAgreement($this->app, $this->getSubscriptionKey(), $request);
+ public function createAgreement(RequestCreateAgreement $request, ?string $idempotency_key): ResponseCreateAgreement {
+ $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
+ $resource = new CreateAgreement($this->app, $this->getSubscriptionKey(), $idempotency_key, $request);
$response = $resource->call();
return $response;
}
@@ -78,8 +84,7 @@ public function createAgreement(RequestCreateAgreement $request)
/**
* {@inheritdoc}
*/
- public function getAgreements()
- {
+ public function getAgreements(): array {
$resource = new GetAgreements($this->app, $this->getSubscriptionKey());
$response = $resource->call();
return $response;
@@ -88,8 +93,7 @@ public function getAgreements()
/**
* {@inheritdoc}
*/
- public function getAgreement($agreement_id)
- {
+ public function getAgreement(string $agreement_id): ResponseGetAgreement {
$resource = new GetAgreement($this->app, $this->getSubscriptionKey(), $agreement_id);
$response = $resource->call();
return $response;
@@ -98,18 +102,20 @@ public function getAgreement($agreement_id)
/**
* {@inheritdoc}
*/
- public function updateAgreement($agreement_id, RequestUpdateAgreement $request)
- {
- $resource = new UpdateAgreement($this->app, $this->getSubscriptionKey(), $agreement_id, $request);
+ public function updateAgreement(
+ string $agreement_id,
+ RequestUpdateAgreement $request,
+ ?string $idempotency_key
+ ): void {
+ $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
+ $resource = new UpdateAgreement($this->app, $this->getSubscriptionKey(), $agreement_id, $idempotency_key, $request);
$response = $resource->call();
- return $response;
}
/**
* {@inheritDoc}
*/
- public function getCharges($agreement_id)
- {
+ public function getCharges($agreement_id): array {
$resource = new GetCharges($this->app, $this->getSubscriptionKey(), $agreement_id);
$response = $resource->call();
return $response;
@@ -118,8 +124,7 @@ public function getCharges($agreement_id)
/**
* {@inheritDoc}
*/
- public function getCharge($agreement_id, $charge_id)
- {
+ public function getCharge(string $agreement_id, string $charge_id): ResponseGetCharge {
$resource = new GetCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id);
$response = $resource->call();
return $response;
@@ -128,9 +133,13 @@ public function getCharge($agreement_id, $charge_id)
/**
* {@inheritDoc}
*/
- public function createCharge($agreement_id, RequestCreateCharge $request)
- {
- $resource = new CreateCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $request);
+ public function createCharge(
+ string $agreement_id,
+ RequestCreateCharge $request,
+ ?string $idempotency_key
+ ): ResponseCreateCharge {
+ $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
+ $resource = new CreateCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $idempotency_key, $request);
$response = $resource->call();
return $response;
}
@@ -138,36 +147,49 @@ public function createCharge($agreement_id, RequestCreateCharge $request)
/**
* {@inheritDoc}
*/
- public function cancelCharge($agreement_id, $charge_id)
+ public function cancelCharge(
+ string $agreement_id,
+ string $charge_id,
+ ?string $idempotency_key
+ ):void
{
- $resource = new CancelCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id);
+ $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
+ $resource = new CancelCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id, $idempotency_key);
$response = $resource->call();
- return $response;
}
/**
* {@inheritDoc}
*/
- public function captureCharge($agreement_id, $charge_id)
- {
- $resource = new CaptureCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id);
+ public function captureCharge(
+ $agreement_id,
+ $charge_id,
+ RequestCaptureCharge $request,
+ ?string $idempotency_key
+ ): void {
+ $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
+ $resource = new CaptureCharge($this->app, $this->getSubscriptionKey(), $agreement_id, $charge_id, $idempotency_key, $request);
$response = $resource->call();
- return $response;
}
/**
* {@inheritDoc}
*/
- public function refundCharge($agreement_id, $charge_id, RequestRefundCharge $requestObject)
- {
+ public function refundCharge(
+ string $agreement_id,
+ string $charge_id,
+ RequestRefundCharge $requestObject,
+ ?string $idempototency_key
+ ): void {
+ $idempotency_key = $idempotency_key ?? IdempotencyKeyFactory::generate();
$resource = new RefundCharge(
$this->app,
$this->getSubscriptionKey(),
$agreement_id,
$charge_id,
+ $idempototency_key,
$requestObject
);
$response = $resource->call();
- return $response;
}
}
diff --git a/src/Api/v3/RecurringPaymentInterface.php b/src/Api/v3/RecurringPaymentInterface.php
index 553664a..f8d533b 100644
--- a/src/Api/v3/RecurringPaymentInterface.php
+++ b/src/Api/v3/RecurringPaymentInterface.php
@@ -2,10 +2,15 @@
namespace zaporylie\Vipps\Api\v3;
+use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestRefundCharge;
use zaporylie\Vipps\Model\RecurringPayment\v3\RequestUpdateAgreement;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateAgreement;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateCharge;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetAgreement;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge;
/**
* Interface PaymentInterface
@@ -17,74 +22,75 @@ interface RecurringPaymentInterface
/**
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement
+ * @param string|null $idempotency_key
*
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateAgreement
*/
- public function createAgreement(RequestCreateAgreement $requestCreateAgreement);
+ public function createAgreement(RequestCreateAgreement $requestCreateAgreement, ?string $idempotency_key): ResponseCreateAgreement;
/**
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetAgreement[]
*/
- public function getAgreements();
+ public function getAgreements(): array;
/**
+ * @param string $agreement_id
+ *
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetAgreement
*/
- public function getAgreement($agreement_id);
+ public function getAgreement(string $agreement_id): ResponseGetAgreement;
/**
- * @param $agreement_id
+ * @param string $agreement_id
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestUpdateAgreement $request
- *
- * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseUpdateAgreement
+ * @param
*/
- public function updateAgreement($agreement_id, RequestUpdateAgreement $request);
+ public function updateAgreement(string $agreement_id, RequestUpdateAgreement $request, ?string $idempotency_key): void;
/**
- * @param $agreement_id
+ * @param string $agreement_id
*
- * @return \zaporylie\Vipps\Model\RecurringPayment\v3\Charge[]
+ * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge[]
*/
- public function getCharges($agreement_id);
+ public function getCharges(string $agreement_id): array;
/**
- * @param $agreement_id
- * @param $charge_id
+ * @param string $agreement_id
+ * @param string $charge_id
*
- * @return \zaporylie\Vipps\Model\RecurringPayment\v3\Charge
+ * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge
*/
- public function getCharge($agreement_id, $charge_id);
+ public function getCharge(string $agreement_id, string $charge_id): ResponseGetCharge;
/**
- * @param $agreement_id
+ * @param string $agreement_id
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge $request
+ * @param string|null $idempotency_key
*
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseCreateCharge
*/
- public function createCharge($agreement_id, RequestCreateCharge $request);
+ public function createCharge(string $agreement_id, RequestCreateCharge $request, ?string $idempotency_key): ResponseCreateCharge;
/**
* @param string $agreement_id
* @param string $charge_id
- *
- * @return string
+ * @param string|null $idempotency_key
*/
- public function cancelCharge($agreement_id, $charge_id);
+ public function cancelCharge(string $agreement_id, string $charge_id, ?string $idempotency_key): void;
/**
* @param string $agreement_id
* @param string $charge_id
- *
- * @return string
+ * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge $request
+ * @param string|null $idempotency_key
*/
- public function captureCharge($agreement_id, $charge_id);
+ public function captureCharge(string $agreement_id, string $charge_id, RequestCaptureCharge $request, ?string $idempotency_key): void;
/**
* @param string $agreement_id
* @param string $charge_id
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestRefundCharge $requestObject
- *
- * @return string
+ * @param string|null $idempotency_key
*/
- public function refundCharge($agreement_id, $charge_id, RequestRefundCharge $requestObject);
+ public function refundCharge(string $agreement_id, string $charge_id, RequestRefundCharge $requestObject, ?string $idempotency_key): void;
}
diff --git a/src/Client.php b/src/Client.php
index 4bbef92..085db7c 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -91,7 +91,7 @@ public function __construct($client_id, array $options = [])
// Set Client ID.
$this->setClientId($client_id);
- $this->vippsSystemPluginName = 'zaporylie/vipps';
+ $this->vippsSystemPluginName = 'zaporylie/vipps (PHP)';
$this->vippsSystemPluginVersion = static::VERSION;
if (!isset($options['vipps_system_name'], $options['vipps_system_version'])) {
diff --git a/src/Model/RecurringPayment/v3/Agreement.php b/src/Model/RecurringPayment/v3/Agreement.php
index 4d05b95..7b9ca60 100644
--- a/src/Model/RecurringPayment/v3/Agreement.php
+++ b/src/Model/RecurringPayment/v3/Agreement.php
@@ -14,10 +14,16 @@ class Agreement
/**
* @var \zaporylie\Vipps\Model\RecurringPayment\v3\CampaignRequest
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\CampaignRequest")
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\CampaignRequest")
*/
protected $campaign;
+ /**
+ * @var \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\Pricing")
+ */
+ protected $pricing;
+
/**
* @var string
* @Serializer\Type("string")
@@ -26,16 +32,10 @@ class Agreement
/**
* @var \zaporylie\Vipps\Model\RecurringPayment\v3\AgreementInterval
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\AgreementInterval")
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\AgreementInterval")
*/
protected $interval;
- /**
- * @var \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\Pricing")
- */
- protected $pricing;
-
/**
* @var string
* @Serializer\Type("string")
@@ -48,6 +48,12 @@ class Agreement
*/
protected $productDescription;
+ /**
+ * @var \DateTimeInterface
+ * @Serializer\Type("DateTime<'Y-m-d\TH:i:s\Z'>")
+ */
+ protected $created;
+
/**
* @var \DateTimeInterface
* @Serializer\Type("DateTime<'Y-m-d\TH:i:s\Z'>")
@@ -66,6 +72,18 @@ class Agreement
*/
protected $status;
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $merchantAgreementUrl;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $merchantRedirectUrl;
+
/**
* @var string
* @Serializer\Type("string")
@@ -79,17 +97,35 @@ class Agreement
protected $userinfoUrl;
/**
- * @var string[]
- * @Serializer\Type("array")
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $externalId;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $countryCode;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
*/
- protected $tags;
+ protected $uuid;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $vippsConfirmationUrl;
/**
* Gets campaign value.
*
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\CampaignRequest
*/
- public function getCampaign()
+ public function getCampaign(): CampaignRequest
{
return $this->campaign;
}
@@ -99,7 +135,7 @@ public function getCampaign()
*
* @return string
*/
- public function getId()
+ public function getId(): string
{
return $this->id;
}
@@ -109,7 +145,7 @@ public function getId()
*
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\AgreementInterval
*/
- public function getInterval()
+ public function getInterval(): AgreementInterval
{
return $this->interval;
}
@@ -119,7 +155,7 @@ public function getInterval()
*
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing
*/
- public function getPricing()
+ public function getPricing(): Pricing
{
return $this->pricing;
}
@@ -129,7 +165,7 @@ public function getPricing()
*
* @return string
*/
- public function getProductDescription()
+ public function getProductDescription(): string
{
return $this->productDescription;
}
@@ -137,20 +173,18 @@ public function getProductDescription()
/**
* Gets start value.
*
- * @return string
+ * @return \DateTimeInterface
*/
- public function getStart()
- {
+ public function getStart(): \DateTimeInterface {
return $this->start;
}
/**
* Gets stop value.
*
- * @return string
+ * @return \DateTimeInterface
*/
- public function getStop()
- {
+ public function getStop(): \DateTimeInterface {
return $this->stop;
}
@@ -159,7 +193,7 @@ public function getStop()
*
* @return string
*/
- public function getProductName()
+ public function getProductName(): string
{
return $this->productName;
}
@@ -169,7 +203,7 @@ public function getProductName()
*
* @return string
*/
- public function getStatus()
+ public function getStatus(): string
{
return $this->status;
}
@@ -179,28 +213,81 @@ public function getStatus()
*
* @return string
*/
- public function getSub()
+ public function getSub(): string
{
return $this->sub;
}
/**
- * Gets tags value.
+ * Gets userInfoUrl value.
*
- * @return string[]
+ * @return string
*/
- public function getTags()
+ public function getUserInfoUrl(): string
{
- return $this->tags;
+ return $this->userinfoUrl;
}
/**
- * Gets userInfoUrl value.
+ * Gets uuid value.
*
* @return string
*/
- public function getUserInfoUrl()
- {
- return $this->userinfoUrl;
+ public function getUuid(): string {
+ return $this->uuid;
+ }
+
+ /**
+ * Gets countryCode value.
+ *
+ * @return string
+ */
+ public function getCountryCode(): string {
+ return $this->countryCode;
+ }
+
+ /**
+ * Gets created value.
+ *
+ * @return \DateTimeInterface
+ */
+ public function getCreated(): \DateTimeInterface {
+ return $this->created;
+ }
+
+ /**
+ * Gets externalId value.
+ *
+ * @return string
+ */
+ public function getExternalId(): string {
+ return $this->externalId;
+ }
+
+ /**
+ * Gets merchantAgreementUrl value.
+ *
+ * @return string
+ */
+ public function getMerchantAgreementUrl(): string {
+ return $this->merchantAgreementUrl;
+ }
+
+ /**
+ * Gets merchantRedirectUrl value.
+ *
+ * @return string
+ */
+ public function getMerchantRedirectUrl(): string {
+ return $this->merchantRedirectUrl;
+ }
+
+ /**
+ * Gets vippsConfirmationUrl value.
+ *
+ * @return string
+ */
+ public function getVippsConfirmationUrl(): string {
+ return $this->vippsConfirmationUrl;
}
}
diff --git a/src/Model/RecurringPayment/v3/CampaignRequest.php b/src/Model/RecurringPayment/v3/CampaignRequest.php
index 525cdc0..9ebfc08 100644
--- a/src/Model/RecurringPayment/v3/CampaignRequest.php
+++ b/src/Model/RecurringPayment/v3/CampaignRequest.php
@@ -11,11 +11,17 @@
*/
class CampaignRequest
{
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $type;
+
/**
* @var int
* @Serializer\Type("integer")
*/
- protected $campaignPrice;
+ protected $price;
/**
* @var \DateTimeInterface
@@ -28,7 +34,7 @@ class CampaignRequest
*
* @return \DateTimeInterface
*/
- public function getEnd()
+ public function getEnd(): \DateTimeInterface
{
return $this->end;
}
@@ -48,26 +54,44 @@ public function setEnd(\DateTimeInterface $end)
}
/**
- * Get the value of campaignPrice
+ * Gets price value.
*
- * @return int
+ * @return int
*/
- public function getCampaignPrice()
- {
- return $this->campaignPrice;
+ public function getPrice(): int {
+ return $this->price;
}
/**
- * Set the value of campaignPrice
+ * Sets price variable.
*
- * @param int $campaignPrice
+ * @param int $price
*
- * @return self
+ * @return $this
*/
- public function setCampaignPrice(int $campaignPrice)
- {
- $this->campaignPrice = $campaignPrice;
+ public function setPrice(int $price) {
+ $this->price = $price;
+ return $this;
+ }
+ /**
+ * Gets type value.
+ *
+ * @return string
+ */
+ public function getType(): string {
+ return $this->type;
+ }
+
+ /**
+ * Sets type variable.
+ *
+ * @param string $type
+ *
+ * @return $this
+ */
+ public function setType(string $type) {
+ $this->type = $type;
return $this;
}
}
diff --git a/src/Model/RecurringPayment/v3/Charge.php b/src/Model/RecurringPayment/v3/Charge.php
index 9a38eaa..9a02f9c 100644
--- a/src/Model/RecurringPayment/v3/Charge.php
+++ b/src/Model/RecurringPayment/v3/Charge.php
@@ -18,10 +18,10 @@ class Charge
protected $amount;
/**
- * @var \zaporylie\Vipps\Model\RecurringPayment\v3\Summary
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\Summary")
+ * @var string
+ * @Serializer\Type("string")
*/
- protected $summary;
+ protected $currency;
/**
* @var string
@@ -41,6 +41,30 @@ class Charge
*/
protected $id;
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $agreementId;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $externalId;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $externalAgreementId;
+
+ /**
+ * @var int
+ * @Serializer\Type("integer")
+ */
+ protected $retryDays;
+
/**
* @var string
* @Serializer\Type("string")
@@ -59,6 +83,12 @@ class Charge
*/
protected $type;
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $transactionType;
+
/**
* @var string
* @Serializer\Type("string")
@@ -71,12 +101,24 @@ class Charge
*/
protected $failureDescription;
+ /**
+ * @var \zaporylie\Vipps\Model\RecurringPayment\v3\Summary
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\Summary")
+ */
+ protected $summary;
+
+ /**
+ * @var \zaporylie\Vipps\Model\RecurringPayment\v3\ChargeHistory[]
+ * @Serializer\Type("array")
+ */
+ protected $history;
+
/**
* Gets amount value.
*
* @return int
*/
- public function getAmount()
+ public function getAmount(): int
{
return $this->amount;
}
@@ -86,7 +128,7 @@ public function getAmount()
*
* @return \zaporylie\Vipps\Model\RecurringPayment\v3\Summary
*/
- public function getSummary()
+ public function getSummary(): Summary
{
return $this->summary;
}
@@ -96,7 +138,7 @@ public function getSummary()
*
* @return string
*/
- public function getDescription()
+ public function getDescription(): string
{
return $this->description;
}
@@ -106,7 +148,7 @@ public function getDescription()
*
* @return \DateTimeInterface
*/
- public function getDue()
+ public function getDue(): \DateTimeInterface
{
return $this->due;
}
@@ -116,7 +158,7 @@ public function getDue()
*
* @return string
*/
- public function getFailureDescription()
+ public function getFailureDescription(): string
{
return $this->failureDescription;
}
@@ -126,7 +168,7 @@ public function getFailureDescription()
*
* @return string
*/
- public function getFailureReason()
+ public function getFailureReason(): string
{
return $this->failureReason;
}
@@ -136,7 +178,7 @@ public function getFailureReason()
*
* @return string
*/
- public function getId()
+ public function getId(): string
{
return $this->id;
}
@@ -146,7 +188,7 @@ public function getId()
*
* @return string
*/
- public function getStatus()
+ public function getStatus(): string
{
return $this->status;
}
@@ -156,7 +198,7 @@ public function getStatus()
*
* @return string
*/
- public function getTransactionId()
+ public function getTransactionId(): string
{
return $this->transactionId;
}
@@ -166,8 +208,71 @@ public function getTransactionId()
*
* @return string
*/
- public function getType()
+ public function getType(): string
{
return $this->type;
}
+
+ /**
+ * Gets externalId value.
+ *
+ * @return string
+ */
+ public function getExternalId(): string {
+ return $this->externalId;
+ }
+
+ /**
+ * Gets agreementId value.
+ *
+ * @return string
+ */
+ public function getAgreementId(): string {
+ return $this->agreementId;
+ }
+
+ /**
+ * Gets currency value.
+ *
+ * @return string
+ */
+ public function getCurrency(): string {
+ return $this->currency;
+ }
+
+ /**
+ * Gets externalAgreementId value.
+ *
+ * @return string
+ */
+ public function getExternalAgreementId(): string {
+ return $this->externalAgreementId;
+ }
+
+ /**
+ * Gets history value.
+ *
+ * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ChargeHistory[]
+ */
+ public function getHistory(): array {
+ return $this->history;
+ }
+
+ /**
+ * Gets retryDays value.
+ *
+ * @return int
+ */
+ public function getRetryDays(): int {
+ return $this->retryDays;
+ }
+
+ /**
+ * Gets transactionType value.
+ *
+ * @return string
+ */
+ public function getTransactionType(): string {
+ return $this->transactionType;
+ }
}
diff --git a/src/Model/RecurringPayment/v3/ChargeHistory.php b/src/Model/RecurringPayment/v3/ChargeHistory.php
new file mode 100644
index 0000000..e81d579
--- /dev/null
+++ b/src/Model/RecurringPayment/v3/ChargeHistory.php
@@ -0,0 +1,89 @@
+")
+ */
+ protected $occurred;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $event;
+
+ /**
+ * @var int
+ * @Serializer\Type("integer")
+ */
+ protected $amount;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $idempotencyKey;
+
+ /**
+ * @var bool
+ * @Serializer\Type("boolean")
+ */
+ protected $success;
+
+ /**
+ * Gets occurred value.
+ *
+ * @return \DateTimeInterface
+ */
+ public function getOccurred(): \DateTimeInterface {
+ return $this->occurred;
+ }
+
+ /**
+ * Gets event value.
+ *
+ * @return string
+ */
+ public function getEvent(): string {
+ return $this->event;
+ }
+
+ /**
+ * Gets amount value.
+ *
+ * @return int
+ */
+ public function getAmount(): int {
+ return $this->amount;
+ }
+
+ /**
+ * Gets idempotencyKey value.
+ *
+ * @return string
+ */
+ public function getIdempotencyKey(): string {
+ return $this->idempotencyKey;
+ }
+
+ /**
+ * Gets success value.
+ *
+ * @return bool
+ */
+ public function getSuccess(): bool {
+ return $this->success;
+ }
+}
diff --git a/src/Model/RecurringPayment/v3/InitialCharge.php b/src/Model/RecurringPayment/v3/InitialCharge.php
index 33eb9ee..68a8ee9 100644
--- a/src/Model/RecurringPayment/v3/InitialCharge.php
+++ b/src/Model/RecurringPayment/v3/InitialCharge.php
@@ -21,52 +21,68 @@ class InitialCharge
* @var string
* @Serializer\Type("string")
*/
- protected $currency;
+ protected $description;
/**
* @var string
* @Serializer\Type("string")
*/
- protected $description;
+ protected $transactionType;
/**
* @var string
* @Serializer\Type("string")
*/
- protected $transactionType;
+ protected $orderId;
/**
* @var string
* @Serializer\Type("string")
*/
- protected $orderId;
+ protected $externalId;
/**
- * Sets amount variable.
+ * Sets externalId variable.
*
- * @param int $amount
+ * @param string $externalId
*
* @return $this
*/
- public function setAmount($amount)
- {
- $this->amount = $amount;
+ public function setExternalId(string $externalId) {
+ $this->externalId = $externalId;
return $this;
}
/**
- * Sets currency variable.
+ * Gets externalId value.
*
- * @param string $currency
+ * @return string
+ */
+ public function getExternalId(): string {
+ return $this->externalId;
+ }
+
+ /**
+ * Sets amount variable.
+ *
+ * @param int $amount
*
* @return $this
*/
- public function setCurrency($currency)
- {
- $this->currency = $currency;
+ public function setAmount(int $amount) {
+ $this->amount = $amount;
return $this;
}
+ /**
+ * Gets amount value.
+ *
+ * @return int
+ */
+ public function getAmount(): int {
+ return $this->amount;
+ }
+
/**
* Sets description variable.
*
@@ -74,23 +90,18 @@ public function setCurrency($currency)
*
* @return $this
*/
- public function setDescription($description)
- {
+ public function setDescription(string $description) {
$this->description = $description;
return $this;
}
/**
- * Sets transactionType variable.
- *
- * @param string $transactionType
+ * Gets description value.
*
- * @return $this
+ * @return string
*/
- public function setTransactionType($transactionType)
- {
- $this->transactionType = $transactionType;
- return $this;
+ public function getDescription(): string {
+ return $this->description;
}
/**
@@ -100,9 +111,38 @@ public function setTransactionType($transactionType)
*
* @return $this
*/
- public function setOrderId($orderId)
- {
+ public function setOrderId(string $orderId) {
$this->orderId = $orderId;
return $this;
}
+
+ /**
+ * Gets orderId value.
+ *
+ * @return string
+ */
+ public function getOrderId(): string {
+ return $this->orderId;
+ }
+
+ /**
+ * Sets transactionType variable.
+ *
+ * @param string $transactionType
+ *
+ * @return $this
+ */
+ public function setTransactionType(string $transactionType) {
+ $this->transactionType = $transactionType;
+ return $this;
+ }
+
+ /**
+ * Gets transactionType value.
+ *
+ * @return string
+ */
+ public function getTransactionType(): string {
+ return $this->transactionType;
+ }
}
diff --git a/src/Model/RecurringPayment/v3/Interval.php b/src/Model/RecurringPayment/v3/Interval.php
index 49e257b..71a7f7f 100644
--- a/src/Model/RecurringPayment/v3/Interval.php
+++ b/src/Model/RecurringPayment/v3/Interval.php
@@ -14,6 +14,7 @@
*/
class Interval extends AbstractEnumeration
{
+ const YEAR = 'YEAR';
const MONTH = 'MONTH';
const WEEK = 'WEEK';
const DAY = 'DAY';
diff --git a/src/Model/RecurringPayment/v3/Pricing.php b/src/Model/RecurringPayment/v3/Pricing.php
index 0b4824f..aaae29b 100644
--- a/src/Model/RecurringPayment/v3/Pricing.php
+++ b/src/Model/RecurringPayment/v3/Pricing.php
@@ -5,93 +5,118 @@
use JMS\Serializer\Annotation as Serializer;
/**
- * Class InitialCharge.
+ * Class Pricing.
*
* @package Vipps\Model\RecurringPayment
*/
class Pricing
{
- /**
- * @var int
- * @Serializer\Type("integer")
- */
- protected $amount;
- /**
- * @var string
- * @Serializer\Type("string")
- */
- protected $currency;
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $type;
- /**
- * @var string
- * @Serializer\Type("string")
- */
- protected $type;
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $currency;
- /**
- * Gets amount value.
- *
- * @return int
- */
- public function getAmount(): int {
- return $this->amount;
- }
+ /**
+ * @var int
+ * @Serializer\Type("integer")
+ */
+ protected $amount;
- /**
- * Gets currency value.
- *
- * @return string
- */
- public function getCurrency(): string {
- return $this->currency;
- }
+ /**
+ * @var int
+ * @Serializer\Type("integer")
+ */
+ protected $suggestedMaxAmount;
- /**
- * Gets type value.
- *
- * @return string
- */
- public function getType(): string {
- return $this->type;
- }
+ /**
+ * Sets amount variable.
+ *
+ * @param int $amount
+ *
+ * @return $this
+ */
+ public function setAmount(int $amount) {
+ $this->amount = $amount;
+ return $this;
+ }
- /**
- * Sets amount variable.
- *
- * @param int $amount
- *
- * @return $this
- */
- public function setAmount($amount)
- {
- $this->amount = $amount;
- return $this;
- }
+ /**
+ * Gets amount value.
+ *
+ * @return int
+ */
+ public function getAmount(): int {
+ return $this->amount;
+ }
- /**
- * Sets currency variable.
- *
- * @param string $currency
- *
- * @return $this
- */
- public function setCurrency($currency)
- {
- $this->currency = $currency;
- return $this;
- }
+ /**
+ * Sets suggestedMaxAmount variable.
+ *
+ * @param int $suggestedMaxAmount
+ *
+ * @return $this
+ */
+ public function setSuggestedMaxAmount(int $suggestedMaxAmount) {
+ $this->suggestedMaxAmount = $suggestedMaxAmount;
+ return $this;
+ }
- /**
- * Sets transactionType variable.
- *
- * @param string $transactionType
- *
- * @return $this
- */
- public function setType($transactionType)
- {
- $this->transactionType = $transactionType;
- return $this;
- }
+ /**
+ * Gets suggestedMaxAmount value.
+ *
+ * @return int
+ */
+ public function getSuggestedMaxAmount(): int {
+ return $this->suggestedMaxAmount;
+ }
+
+ /**
+ * Sets type variable.
+ *
+ * @param string $type
+ *
+ * @return $this
+ */
+ public function setType(string $type) {
+ $this->type = $type;
+ return $this;
+ }
+
+ /**
+ * Gets type value.
+ *
+ * @return string
+ */
+ public function getType(): string {
+ return $this->type;
+ }
+
+ /**
+ * Sets currency variable.
+ *
+ * @param string $currency
+ *
+ * @return $this
+ */
+ public function setCurrency(string $currency) {
+ $this->currency = $currency;
+ return $this;
+ }
+
+ /**
+ * Gets currency value.
+ *
+ * @return string
+ */
+ public function getCurrency(): string {
+ return $this->currency;
+ }
}
diff --git a/src/Model/RecurringPayment/v3/RequestCaptureCharge.php b/src/Model/RecurringPayment/v3/RequestCaptureCharge.php
new file mode 100644
index 0000000..17ce406
--- /dev/null
+++ b/src/Model/RecurringPayment/v3/RequestCaptureCharge.php
@@ -0,0 +1,32 @@
+amount = $amount;
+ return $this;
+ }
+}
diff --git a/src/Model/RecurringPayment/v3/RequestCreateAgreement.php b/src/Model/RecurringPayment/v3/RequestCreateAgreement.php
index a9cd002..47bec60 100644
--- a/src/Model/RecurringPayment/v3/RequestCreateAgreement.php
+++ b/src/Model/RecurringPayment/v3/RequestCreateAgreement.php
@@ -13,7 +13,7 @@ class RequestCreateAgreement
{
/**
* @var \zaporylie\Vipps\Model\RecurringPayment\v3\CampaignRequest
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\CampaignRequest")
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\CampaignRequest")
*/
protected $campaign;
@@ -25,13 +25,13 @@ class RequestCreateAgreement
/**
* @var \zaporylie\Vipps\Model\RecurringPayment\v3\InitialCharge
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\InitialCharge")
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\InitialCharge")
*/
protected $initialCharge;
/**
* @var \zaporylie\Vipps\Model\RecurringPayment\v3\AgreementInterval
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\AgreementInterval")
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\AgreementInterval")
*/
protected $interval;
@@ -55,7 +55,7 @@ class RequestCreateAgreement
/**
* @var \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\Pricing")
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\Pricing")
*/
protected $pricing;
@@ -77,6 +77,60 @@ class RequestCreateAgreement
*/
protected $scope;
+ /**
+ * @var bool
+ * @Serializer\Type("boolean")
+ */
+ protected $skipLandingPage;
+
+ /**
+ * @var string?
+ * @Serializer\Type("string")
+ */
+ protected $externalId;
+
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $countryCode;
+
+ /**
+ * Sets externalId variable.
+ *
+ * @param string $externalId
+ *
+ * @return $this
+ */
+ public function setExternalId(string $externalId) {
+ $this->externalId = $externalId;
+ return $this;
+ }
+
+ /**
+ * Sets countryCode variable.
+ *
+ * @param string $countryCode
+ *
+ * @return $this
+ */
+ public function setCountryCode(string $countryCode) {
+ $this->countryCode = $countryCode;
+ return $this;
+ }
+
+ /**
+ * Sets skipLandingPage variable.
+ *
+ * @param bool $skipLandingPage
+ *
+ * @return $this
+ */
+ public function setSkipLandingPage(bool $skipLandingPage) {
+ $this->skipLandingPage = $skipLandingPage;
+ return $this;
+ }
+
/**
* Sets campaign variable.
*
@@ -84,8 +138,7 @@ class RequestCreateAgreement
*
* @return $this
*/
- public function setCampaign(CampaignRequest $campaign)
- {
+ public function setCampaign(CampaignRequest $campaign) {
$this->campaign = $campaign;
return $this;
}
@@ -97,8 +150,7 @@ public function setCampaign(CampaignRequest $campaign)
*
* @return $this
*/
- public function setCustomerPhoneNumber($customerPhoneNumber)
- {
+ public function setCustomerPhoneNumber(string $customerPhoneNumber) {
$this->customerPhoneNumber = $customerPhoneNumber;
return $this;
}
@@ -110,8 +162,7 @@ public function setCustomerPhoneNumber($customerPhoneNumber)
*
* @return $this
*/
- public function setInitialCharge(InitialCharge $initialCharge)
- {
+ public function setInitialCharge(InitialCharge $initialCharge) {
$this->initialCharge = $initialCharge;
return $this;
}
@@ -123,8 +174,7 @@ public function setInitialCharge(InitialCharge $initialCharge)
*
* @return $this
*/
- public function setInterval(AgreementInterval $interval)
- {
+ public function setInterval(AgreementInterval $interval) {
$this->interval = $interval;
return $this;
}
@@ -136,8 +186,7 @@ public function setInterval(AgreementInterval $interval)
*
* @return $this
*/
- public function setIsApp($isApp)
- {
+ public function setIsApp(bool $isApp) {
$this->isApp = $isApp;
return $this;
}
@@ -149,8 +198,7 @@ public function setIsApp($isApp)
*
* @return $this
*/
- public function setMerchantAgreementUrl($merchantAgreementUrl)
- {
+ public function setMerchantAgreementUrl(string $merchantAgreementUrl) {
$this->merchantAgreementUrl = $merchantAgreementUrl;
return $this;
}
@@ -162,21 +210,19 @@ public function setMerchantAgreementUrl($merchantAgreementUrl)
*
* @return $this
*/
- public function setMerchantRedirectUrl($merchantRedirectUrl)
- {
+ public function setMerchantRedirectUrl(string $merchantRedirectUrl) {
$this->merchantRedirectUrl = $merchantRedirectUrl;
return $this;
}
/**
- * Sets price variable.
+ * Sets pricing variable.
*
- * @param \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing
+ * @param \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing $pricing
*
* @return $this
*/
- public function setPricing(Pricing $pricing)
- {
+ public function setPricing(Pricing $pricing) {
$this->pricing = $pricing;
return $this;
}
@@ -188,8 +234,7 @@ public function setPricing(Pricing $pricing)
*
* @return $this
*/
- public function setProductDescription($productDescription)
- {
+ public function setProductDescription(string $productDescription) {
$this->productDescription = $productDescription;
return $this;
}
@@ -201,8 +246,7 @@ public function setProductDescription($productDescription)
*
* @return $this
*/
- public function setProductName($productName)
- {
+ public function setProductName(string $productName) {
$this->productName = $productName;
return $this;
}
@@ -214,8 +258,7 @@ public function setProductName($productName)
*
* @return $this
*/
- public function setScope($scope)
- {
+ public function setScope(string $scope) {
$this->scope = $scope;
return $this;
}
diff --git a/src/Model/RecurringPayment/v3/RequestCreateCharge.php b/src/Model/RecurringPayment/v3/RequestCreateCharge.php
index 9be89cd..c566d81 100644
--- a/src/Model/RecurringPayment/v3/RequestCreateCharge.php
+++ b/src/Model/RecurringPayment/v3/RequestCreateCharge.php
@@ -23,6 +23,17 @@ class RequestCreateCharge
*/
protected $transactionType;
+
+ /**
+ * Default: "RECURRING".
+ *
+ * Enum: "RECURRING", "UNSCHEDULED".
+ *
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $type;
+
/**
* @var string
* @Serializer\Type("string")
@@ -47,6 +58,12 @@ class RequestCreateCharge
*/
protected $orderId;
+ /**
+ * @var string
+ * @Serializer\Type("string")
+ */
+ protected $externalIdn;
+
/**
* Sets amount variable.
*
@@ -54,7 +71,7 @@ class RequestCreateCharge
*
* @return $this
*/
- public function setAmount($amount)
+ public function setAmount(int $amount)
{
$this->amount = $amount;
return $this;
@@ -67,7 +84,7 @@ public function setAmount($amount)
*
* @return $this
*/
- public function setTransactionType($transactionType)
+ public function setTransactionType(string $transactionType)
{
$this->transactionType = $transactionType;
return $this;
@@ -80,7 +97,7 @@ public function setTransactionType($transactionType)
*
* @return $this
*/
- public function setDescription($description)
+ public function setDescription(string $description)
{
$this->description = $description;
return $this;
@@ -106,7 +123,7 @@ public function setDue(\DateTimeInterface $due)
*
* @return $this
*/
- public function setRetryDays($retryDays)
+ public function setRetryDays(int $retryDays)
{
$this->retryDays = $retryDays;
return $this;
@@ -119,9 +136,33 @@ public function setRetryDays($retryDays)
*
* @return $this
*/
- public function setOrderId($orderId)
+ public function setOrderId(string $orderId)
{
$this->orderId = $orderId;
return $this;
}
+
+ /**
+ * Sets type variable.
+ *
+ * @param string $type
+ *
+ * @return $this
+ */
+ public function setType(string $type) {
+ $this->type = $type;
+ return $this;
+ }
+
+ /**
+ * Sets externalIdn variable.
+ *
+ * @param string $externalIdn
+ *
+ * @return $this
+ */
+ public function setExternalIdn(string $externalIdn) {
+ $this->externalIdn = $externalIdn;
+ return $this;
+ }
}
diff --git a/src/Model/RecurringPayment/v3/RequestRefundCharge.php b/src/Model/RecurringPayment/v3/RequestRefundCharge.php
index 2b38fd7..58c07e2 100644
--- a/src/Model/RecurringPayment/v3/RequestRefundCharge.php
+++ b/src/Model/RecurringPayment/v3/RequestRefundCharge.php
@@ -30,7 +30,7 @@ class RequestRefundCharge
*
* @return $this
*/
- public function setAmount($amount)
+ public function setAmount(int $amount)
{
$this->amount = $amount;
return $this;
@@ -43,7 +43,7 @@ public function setAmount($amount)
*
* @return $this
*/
- public function setDescription($description)
+ public function setDescription(string $description)
{
$this->description = $description;
return $this;
diff --git a/src/Model/RecurringPayment/v3/RequestUpdateAgreement.php b/src/Model/RecurringPayment/v3/RequestUpdateAgreement.php
index 4e8068d..a0856f8 100644
--- a/src/Model/RecurringPayment/v3/RequestUpdateAgreement.php
+++ b/src/Model/RecurringPayment/v3/RequestUpdateAgreement.php
@@ -14,7 +14,7 @@ class RequestUpdateAgreement
/**
* @var \zaporylie\Vipps\Model\RecurringPayment\v3\Pricing
- * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\Pricing")
+ * @Serializer\Type("zaporylie\Vipps\Model\RecurringPayment\v3\Pricing")
*/
protected $pricing;
diff --git a/src/Model/RecurringPayment/v3/ResponseCaptureCharge.php b/src/Model/RecurringPayment/v3/ResponseCaptureCharge.php
deleted file mode 100644
index 977019b..0000000
--- a/src/Model/RecurringPayment/v3/ResponseCaptureCharge.php
+++ /dev/null
@@ -1,13 +0,0 @@
-agreementResource;
+ public function getUuid(): string {
+ return $this->uuid;
}
/**
@@ -51,7 +50,7 @@ public function getAgreementResource()
*
* @return string
*/
- public function getAgreementId()
+ public function getAgreementId(): string
{
return $this->agreementId;
}
@@ -61,7 +60,7 @@ public function getAgreementId()
*
* @return string
*/
- public function getVippsConfirmationUrl()
+ public function getVippsConfirmationUrl(): string
{
return $this->vippsConfirmationUrl;
}
@@ -69,9 +68,9 @@ public function getVippsConfirmationUrl()
/**
* Gets chargeId value.
*
- * @return string
+ * @return string|null
*/
- public function getChargeId()
+ public function getChargeId(): ?string
{
return $this->chargeId;
}
diff --git a/src/Model/RecurringPayment/v3/ResponseCreateCharge.php b/src/Model/RecurringPayment/v3/ResponseCreateCharge.php
index bae0833..72a23e4 100644
--- a/src/Model/RecurringPayment/v3/ResponseCreateCharge.php
+++ b/src/Model/RecurringPayment/v3/ResponseCreateCharge.php
@@ -23,7 +23,7 @@ class ResponseCreateCharge
*
* @return string
*/
- public function getChargeId()
+ public function getChargeId(): string
{
return $this->chargeId;
}
diff --git a/src/Model/RecurringPayment/v3/ResponseUpdateAgreement.php b/src/Model/RecurringPayment/v3/ResponseUpdateAgreement.php
deleted file mode 100644
index 1390d84..0000000
--- a/src/Model/RecurringPayment/v3/ResponseUpdateAgreement.php
+++ /dev/null
@@ -1,30 +0,0 @@
-agreementId;
- }
-}
diff --git a/src/Resource/RecurringPayment/v3/CancelCharge.php b/src/Resource/RecurringPayment/v3/CancelCharge.php
index 99ba325..abde416 100644
--- a/src/Resource/RecurringPayment/v3/CancelCharge.php
+++ b/src/Resource/RecurringPayment/v3/CancelCharge.php
@@ -30,18 +30,19 @@ class CancelCharge extends RecurringPaymentResourceBase
* @param \zaporylie\Vipps\VippsInterface $vipps
* @param string $subscription_key
* @param string $agreement_id
+ * @param string $idempotency_key
* @param string $charge_id
*/
public function __construct(
VippsInterface $vipps,
- $subscription_key,
- $agreement_id,
- $charge_id
+ string $subscription_key,
+ string $agreement_id,
+ string $idempotency_key,
+ string $charge_id
) {
$this->id = $agreement_id;
$this->charge_id = $charge_id;
- // By default RequestID is different for each Resource object.
- $this->headers['Idempotency-Key'] = IdempotencyKeyFactory::generate();
+ $this->headers['Idempotency-Key'] = $idempotency_key;
parent::__construct($vipps, $subscription_key);
}
diff --git a/src/Resource/RecurringPayment/v3/CaptureCharge.php b/src/Resource/RecurringPayment/v3/CaptureCharge.php
index 97057bc..586c51d 100644
--- a/src/Resource/RecurringPayment/v3/CaptureCharge.php
+++ b/src/Resource/RecurringPayment/v3/CaptureCharge.php
@@ -2,6 +2,7 @@
namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
+use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge;
use zaporylie\Vipps\Resource\HttpMethod;
use zaporylie\Vipps\Resource\IdempotencyKeyFactory;
use zaporylie\Vipps\VippsInterface;
@@ -30,19 +31,28 @@ class CaptureCharge extends RecurringPaymentResourceBase
* @param \zaporylie\Vipps\VippsInterface $vipps
* @param string $subscription_key
* @param string $agreement_id
+ * @param string $idempotency_key
* @param string $charge_id
+ * @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge $requestObject
*/
public function __construct(
VippsInterface $vipps,
- $subscription_key,
- $agreement_id,
- $charge_id
+ string $subscription_key,
+ string $agreement_id,
+ string $idempotency_key,
+ string $charge_id,
+ RequestCaptureCharge $requestObject
) {
$this->id = $agreement_id;
$this->charge_id = $charge_id;
- // By default RequestID is different for each Resource object.
- $this->headers['Idempotency-Key'] = IdempotencyKeyFactory::generate();
+ $this->headers['Idempotency-Key'] = $idempotency_key;
parent::__construct($vipps, $subscription_key);
+ $this->body = $this
+ ->getSerializer()
+ ->serialize(
+ $requestObject,
+ 'json'
+ );
}
/**
diff --git a/src/Resource/RecurringPayment/v3/CreateAgreement.php b/src/Resource/RecurringPayment/v3/CreateAgreement.php
index 2739c45..043acfd 100644
--- a/src/Resource/RecurringPayment/v3/CreateAgreement.php
+++ b/src/Resource/RecurringPayment/v3/CreateAgreement.php
@@ -31,12 +31,12 @@ class CreateAgreement extends RecurringPaymentResourceBase
*
* @param \zaporylie\Vipps\VippsInterface $vipps
* @param string $subscription_key
+ * @param string $idempotency_key
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateAgreement $requestObject
*/
- public function __construct(VippsInterface $vipps, $subscription_key, RequestCreateAgreement $requestObject)
+ public function __construct(VippsInterface $vipps, string $subscription_key, string $idempotency_key, RequestCreateAgreement $requestObject)
{
- // By default RequestID is different for each Resource object.
- $this->headers['Idempotency-Key'] = IdempotencyKeyFactory::generate();
+ $this->headers['Idempotency-Key'] = $idempotency_key;
parent::__construct($vipps, $subscription_key);
$this->body = $this
->getSerializer()
diff --git a/src/Resource/RecurringPayment/v3/CreateCharge.php b/src/Resource/RecurringPayment/v3/CreateCharge.php
index 1675a14..9b53ed6 100644
--- a/src/Resource/RecurringPayment/v3/CreateCharge.php
+++ b/src/Resource/RecurringPayment/v3/CreateCharge.php
@@ -32,17 +32,18 @@ class CreateCharge extends RecurringPaymentResourceBase
* @param \zaporylie\Vipps\VippsInterface $vipps
* @param string $subscription_key
* @param string $agreementId
+ * @param string $idempotency_key
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestCreateCharge $requestObject
*/
public function __construct(
VippsInterface $vipps,
- $subscription_key,
- $agreementId,
+ string $subscription_key,
+ string $agreementId,
+ string $idempotency_key,
RequestCreateCharge $requestObject
) {
$this->id = $agreementId;
- // By default RequestID is different for each Resource object.
- $this->headers['Idempotency-Key'] = IdempotencyKeyFactory::generate();
+ $this->headers['Idempotency-Key'] = $idempotency_key;
parent::__construct($vipps, $subscription_key);
$this->body = $this
->getSerializer()
diff --git a/src/Resource/RecurringPayment/v3/GetAgreement.php b/src/Resource/RecurringPayment/v3/GetAgreement.php
index 06f42a7..f7c7139 100644
--- a/src/Resource/RecurringPayment/v3/GetAgreement.php
+++ b/src/Resource/RecurringPayment/v3/GetAgreement.php
@@ -29,9 +29,9 @@ class GetAgreement extends RecurringPaymentResourceBase
*
* @param \zaporylie\Vipps\VippsInterface $vipps
* @param string $subscription_key
- * @param $agreement_id
+ * @param string $agreement_id
*/
- public function __construct(VippsInterface $vipps, $subscription_key, $agreement_id)
+ public function __construct(VippsInterface $vipps, string $subscription_key, string $agreement_id)
{
parent::__construct($vipps, $subscription_key);
$this->id = $agreement_id;
diff --git a/src/Resource/RecurringPayment/v3/GetCharge.php b/src/Resource/RecurringPayment/v3/GetCharge.php
index da9abff..86f9f30 100644
--- a/src/Resource/RecurringPayment/v3/GetCharge.php
+++ b/src/Resource/RecurringPayment/v3/GetCharge.php
@@ -3,6 +3,7 @@
namespace zaporylie\Vipps\Resource\RecurringPayment\v3;
use zaporylie\Vipps\Model\RecurringPayment\v3\Charge;
+use zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge;
use zaporylie\Vipps\Resource\HttpMethod;
/**
@@ -23,11 +24,17 @@ class GetCharge extends RecurringPaymentResourceBase
*/
protected $path = '/recurring/v3/agreements/{id}/charges/{charge_id}';
+ /**
+ * @param \zaporylie\Vipps\VippsInterface $vipps
+ * @param string $subscription_key
+ * @param string $agreement_id
+ * @param string $charge_id
+ */
public function __construct(
\zaporylie\Vipps\VippsInterface $vipps,
- $subscription_key,
- $agreement_id,
- $charge_id
+ string $subscription_key,
+ string $agreement_id,
+ string $charge_id
) {
parent::__construct($vipps, $subscription_key);
$this->id = $agreement_id;
@@ -35,18 +42,18 @@ public function __construct(
}
/**
- * @return \zaporylie\Vipps\Model\RecurringPayment\v3\Charge
+ * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge
*/
public function call()
{
$response = $this->makeCall();
$body = $response->getBody()->getContents();
- /** @var \zaporylie\Vipps\Model\RecurringPayment\v3\Charge $responseObject */
+ /** @var \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseGetCharge $responseObject */
$responseObject = $this
->getSerializer()
->deserialize(
$body,
- Charge::class,
+ ResponseGetCharge::class,
'json'
);
diff --git a/src/Resource/RecurringPayment/v3/GetCharges.php b/src/Resource/RecurringPayment/v3/GetCharges.php
index 74dffcc..ff77f25 100644
--- a/src/Resource/RecurringPayment/v3/GetCharges.php
+++ b/src/Resource/RecurringPayment/v3/GetCharges.php
@@ -23,10 +23,15 @@ class GetCharges extends RecurringPaymentResourceBase
*/
protected $path = '/recurring/v3/agreements/{id}/charges';
+ /**
+ * @param \zaporylie\Vipps\VippsInterface $vipps
+ * @param string $subscription_key
+ * @param string $agreement_id
+ */
public function __construct(
\zaporylie\Vipps\VippsInterface $vipps,
- $subscription_key,
- $agreement_id
+ string $subscription_key,
+ string $agreement_id
) {
parent::__construct($vipps, $subscription_key);
$this->id = $agreement_id;
diff --git a/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php b/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php
index 8ab403f..7b700f5 100644
--- a/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php
+++ b/src/Resource/RecurringPayment/v3/RecurringPaymentResourceBase.php
@@ -24,7 +24,7 @@ abstract class RecurringPaymentResourceBase extends AuthorizedResourceBase
/**
* {@inheritdoc}
*/
- public function __construct(\zaporylie\Vipps\VippsInterface $vipps, $subscription_key)
+ public function __construct(\zaporylie\Vipps\VippsInterface $vipps, string $subscription_key)
{
parent::__construct($vipps, $subscription_key);
@@ -35,12 +35,6 @@ public function __construct(\zaporylie\Vipps\VippsInterface $vipps, $subscriptio
// Content type for all requests must be set.
$this->headers['Content-Type'] = 'application/json';
-
- // By default RequestID is different for each Resource object.
- $this->headers['X-Request-Id'] = RequestIdFactory::generate();
-
- // Timestamp is equal to current DateTime.
- $this->headers['X-TimeStamp'] = (new \DateTime())->format(\DateTime::ISO8601);
}
diff --git a/src/Resource/RecurringPayment/v3/RefundCharge.php b/src/Resource/RecurringPayment/v3/RefundCharge.php
index fe95a2a..e356492 100644
--- a/src/Resource/RecurringPayment/v3/RefundCharge.php
+++ b/src/Resource/RecurringPayment/v3/RefundCharge.php
@@ -32,19 +32,20 @@ class RefundCharge extends RecurringPaymentResourceBase
* @param string $subscription_key
* @param string $agreement_id
* @param string $charge_id
+ * @param string $idempotency_key
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestRefundCharge $requestObject
*/
public function __construct(
VippsInterface $vipps,
- $subscription_key,
- $agreement_id,
- $charge_id,
+ string $subscription_key,
+ string $agreement_id,
+ string $charge_id,
+ string $idempotency_key,
RequestRefundCharge $requestObject
) {
$this->id = $agreement_id;
$this->charge_id = $charge_id;
- // By default RequestID is different for each Resource object.
- $this->headers['Idempotency-Key'] = IdempotencyKeyFactory::generate();
+ $this->headers['Idempotency-Key'] = $idempotency_key;
parent::__construct($vipps, $subscription_key);
$this->body = $this
->getSerializer()
diff --git a/src/Resource/RecurringPayment/v3/UpdateAgreement.php b/src/Resource/RecurringPayment/v3/UpdateAgreement.php
index b304f2b..5a4bc07 100644
--- a/src/Resource/RecurringPayment/v3/UpdateAgreement.php
+++ b/src/Resource/RecurringPayment/v3/UpdateAgreement.php
@@ -30,17 +30,18 @@ class UpdateAgreement extends RecurringPaymentResourceBase
*
* @param \zaporylie\Vipps\VippsInterface $vipps
* @param string $subscription_key
- * @param $agreement_id
+ * @param string $agreement_id
+ * @param string $idempotency_key
* @param \zaporylie\Vipps\Model\RecurringPayment\v3\RequestUpdateAgreement $requestObject
*/
public function __construct(
VippsInterface $vipps,
- $subscription_key,
- $agreement_id,
+ string $subscription_key,
+ string $agreement_id,
+ string $idempotency_key,
RequestUpdateAgreement $requestObject
) {
- // By default RequestID is different for each Resource object.
- $this->headers['Idempotency-Key'] = IdempotencyKeyFactory::generate();
+ $this->headers['Idempotency-Key'] = $idempotency_key;
parent::__construct($vipps, $subscription_key);
$this->id = $agreement_id;
$this->body = $this
@@ -52,7 +53,7 @@ public function __construct(
}
/**
- * @return \zaporylie\Vipps\Model\RecurringPayment\v3\ResponseUpdateAgreement
+ * @return mixed
*/
public function call()
{