diff --git a/README.md b/README.md index f1334a5..2a465f1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This package provides bindings to the ProcessOut API. Dependencies ------------ -* PHP 5.4 or above +* PHP 8.0 or above * cURL PHP extension Installation @@ -20,7 +20,7 @@ The package's installation is done using composer. Simply add these lines to you ```json { "require": { - "processout/processout-php": "^7.4.0" + "processout/processout-php": "^8.0.0" } } ``` @@ -41,7 +41,7 @@ cloning the directory into your project git clone https://github.com/processout/processout-php ``` -or downloading the latest release at +or downloading the latest release at [github.com/ProcessOut/processout-php/releases](https://github.com/ProcessOut/processout-php/releases) and including the ProcessOut init file diff --git a/composer.json b/composer.json index 4605138..78d4b20 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": ">=5.4", + "php": ">=8.0", "ext-curl": "*", "ext-mbstring": "*" }, diff --git a/init.php b/init.php index 0a527de..e8195ef 100644 --- a/init.php +++ b/init.php @@ -12,8 +12,6 @@ include_once(dirname(__FILE__) . "/src/Networking/Request.php"); include_once(dirname(__FILE__) . "/src/Networking/Response.php"); -include_once(dirname(__FILE__) . "/src/Activity.php"); -include_once(dirname(__FILE__) . "/src/Addon.php"); include_once(dirname(__FILE__) . "/src/APIVersion.php"); include_once(dirname(__FILE__) . "/src/ApplePayAlternativeMerchantCertificates.php"); include_once(dirname(__FILE__) . "/src/AlternativeMerchantCertificate.php"); @@ -23,11 +21,9 @@ include_once(dirname(__FILE__) . "/src/Card.php"); include_once(dirname(__FILE__) . "/src/CardInformation.php"); include_once(dirname(__FILE__) . "/src/Phone.php"); -include_once(dirname(__FILE__) . "/src/Coupon.php"); include_once(dirname(__FILE__) . "/src/Customer.php"); include_once(dirname(__FILE__) . "/src/CustomerPhone.php"); include_once(dirname(__FILE__) . "/src/Token.php"); -include_once(dirname(__FILE__) . "/src/Discount.php"); include_once(dirname(__FILE__) . "/src/Event.php"); include_once(dirname(__FILE__) . "/src/ExportLayout.php"); include_once(dirname(__FILE__) . "/src/ExportLayoutConfiguration.php"); @@ -59,13 +55,11 @@ include_once(dirname(__FILE__) . "/src/Payout.php"); include_once(dirname(__FILE__) . "/src/PayoutItem.php"); include_once(dirname(__FILE__) . "/src/PayoutItemAmountBreakdowns.php"); -include_once(dirname(__FILE__) . "/src/Plan.php"); include_once(dirname(__FILE__) . "/src/Product.php"); include_once(dirname(__FILE__) . "/src/Project.php"); include_once(dirname(__FILE__) . "/src/ProjectSFTPSettings.php"); include_once(dirname(__FILE__) . "/src/ProjectSFTPSettingsPublic.php"); include_once(dirname(__FILE__) . "/src/Refund.php"); -include_once(dirname(__FILE__) . "/src/Subscription.php"); include_once(dirname(__FILE__) . "/src/Transaction.php"); include_once(dirname(__FILE__) . "/src/NativeAPMResponse.php"); include_once(dirname(__FILE__) . "/src/NativeAPMParameterDefinition.php"); @@ -77,11 +71,11 @@ include_once(dirname(__FILE__) . "/src/TransactionOperation.php"); include_once(dirname(__FILE__) . "/src/Webhook.php"); include_once(dirname(__FILE__) . "/src/WebhookEndpoint.php"); +include_once(dirname(__FILE__) . "/src/CardUpdateRequest.php"); +include_once(dirname(__FILE__) . "/src/CardCreateRequest.php"); include_once(dirname(__FILE__) . "/src/Device.php"); include_once(dirname(__FILE__) . "/src/CardContact.php"); include_once(dirname(__FILE__) . "/src/CardShipping.php"); -include_once(dirname(__FILE__) . "/src/CardUpdateRequest.php"); -include_once(dirname(__FILE__) . "/src/CardCreateRequest.php"); include_once(dirname(__FILE__) . "/src/ErrorCodes.php"); include_once(dirname(__FILE__) . "/src/CategoryErrorCodes.php"); include_once(dirname(__FILE__) . "/src/ExternalThreeDS.php"); diff --git a/src/APIVersion.php b/src/APIVersion.php index aee6a21..82b8e62 100755 --- a/src/APIVersion.php +++ b/src/APIVersion.php @@ -135,9 +135,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "name" => $this->getName(), "description" => $this->getDescription(), diff --git a/src/Activity.php b/src/Activity.php deleted file mode 100755 index 20722a9..0000000 --- a/src/Activity.php +++ /dev/null @@ -1,349 +0,0 @@ -client = $client; - - $this->fillWithData($prefill); - } - - - /** - * Get Id - * ID of the activity - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Set Id - * ID of the activity - * @param string $value - * @return $this - */ - public function setId($value) - { - $this->id = $value; - return $this; - } - - /** - * Get Project - * Project to which the activity belongs - * @return object - */ - public function getProject() - { - return $this->project; - } - - /** - * Set Project - * Project to which the activity belongs - * @param object $value - * @return $this - */ - public function setProject($value) - { - if (is_object($value)) - $this->project = $value; - else - { - $obj = new Project($this->client); - $obj->fillWithData($value); - $this->project = $obj; - } - return $this; - } - - /** - * Get ProjectId - * ID of the project to which the activity belongs - * @return string - */ - public function getProjectId() - { - return $this->projectId; - } - - /** - * Set ProjectId - * ID of the project to which the activity belongs - * @param string $value - * @return $this - */ - public function setProjectId($value) - { - $this->projectId = $value; - return $this; - } - - /** - * Get Title - * Title of the activity - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Set Title - * Title of the activity - * @param string $value - * @return $this - */ - public function setTitle($value) - { - $this->title = $value; - return $this; - } - - /** - * Get Content - * Content of the activity - * @return string - */ - public function getContent() - { - return $this->content; - } - - /** - * Set Content - * Content of the activity - * @param string $value - * @return $this - */ - public function setContent($value) - { - $this->content = $value; - return $this; - } - - /** - * Get Level - * Level of the activity - * @return int - */ - public function getLevel() - { - return $this->level; - } - - /** - * Set Level - * Level of the activity - * @param int $value - * @return $this - */ - public function setLevel($value) - { - $this->level = $value; - return $this; - } - - /** - * Get CreatedAt - * Date at which the transaction was created - * @return string - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * Set CreatedAt - * Date at which the transaction was created - * @param string $value - * @return $this - */ - public function setCreatedAt($value) - { - $this->createdAt = $value; - return $this; - } - - - /** - * Fills the current object with the new values pulled from the data - * @param array $data - * @return Activity - */ - public function fillWithData($data) - { - if(! empty($data['id'])) - $this->setId($data['id']); - - if(! empty($data['project'])) - $this->setProject($data['project']); - - if(! empty($data['project_id'])) - $this->setProjectId($data['project_id']); - - if(! empty($data['title'])) - $this->setTitle($data['title']); - - if(! empty($data['content'])) - $this->setContent($data['content']); - - if(! empty($data['level'])) - $this->setLevel($data['level']); - - if(! empty($data['created_at'])) - $this->setCreatedAt($data['created_at']); - - return $this; - } - - /** - * Implements the JsonSerializable interface - * @return object - */ - public function jsonSerialize() { - return array( - "id" => $this->getId(), - "project" => $this->getProject(), - "project_id" => $this->getProjectId(), - "title" => $this->getTitle(), - "content" => $this->getContent(), - "level" => $this->getLevel(), - "created_at" => $this->getCreatedAt(), - ); - } - - - /** - * Get all the project activities. - * @param array $options - * @return array - */ - public function all($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/activities"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field activities - $a = array(); - $body = $response->getBody(); - foreach($body['activities'] as $v) - { - $tmp = new Activity($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Activities'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Find a specific activity and fetch its data. - * @param string $activityId - * @param array $options - * @return $this - */ - public function find($activityId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/activities/" . urlencode($activityId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field activity - $body = $response->getBody(); - if (isset($body['activity'])) { - $body = $body['activity']; - $returnValues['find'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - -} diff --git a/src/Addon.php b/src/Addon.php deleted file mode 100755 index 20ff4d0..0000000 --- a/src/Addon.php +++ /dev/null @@ -1,692 +0,0 @@ -client = $client; - - $this->fillWithData($prefill); - } - - - /** - * Get Id - * ID of the addon - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Set Id - * ID of the addon - * @param string $value - * @return $this - */ - public function setId($value) - { - $this->id = $value; - return $this; - } - - /** - * Get Project - * Project to which the addon belongs - * @return object - */ - public function getProject() - { - return $this->project; - } - - /** - * Set Project - * Project to which the addon belongs - * @param object $value - * @return $this - */ - public function setProject($value) - { - if (is_object($value)) - $this->project = $value; - else - { - $obj = new Project($this->client); - $obj->fillWithData($value); - $this->project = $obj; - } - return $this; - } - - /** - * Get ProjectId - * ID of the project to which the addon belongs - * @return string - */ - public function getProjectId() - { - return $this->projectId; - } - - /** - * Set ProjectId - * ID of the project to which the addon belongs - * @param string $value - * @return $this - */ - public function setProjectId($value) - { - $this->projectId = $value; - return $this; - } - - /** - * Get Subscription - * Subscription to which the addon belongs - * @return object - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Set Subscription - * Subscription to which the addon belongs - * @param object $value - * @return $this - */ - public function setSubscription($value) - { - if (is_object($value)) - $this->subscription = $value; - else - { - $obj = new Subscription($this->client); - $obj->fillWithData($value); - $this->subscription = $obj; - } - return $this; - } - - /** - * Get SubscriptionId - * ID of the subscription to which the addon belongs - * @return string - */ - public function getSubscriptionId() - { - return $this->subscriptionId; - } - - /** - * Set SubscriptionId - * ID of the subscription to which the addon belongs - * @param string $value - * @return $this - */ - public function setSubscriptionId($value) - { - $this->subscriptionId = $value; - return $this; - } - - /** - * Get Plan - * Plan used to create the addon, if any - * @return object - */ - public function getPlan() - { - return $this->plan; - } - - /** - * Set Plan - * Plan used to create the addon, if any - * @param object $value - * @return $this - */ - public function setPlan($value) - { - if (is_object($value)) - $this->plan = $value; - else - { - $obj = new Plan($this->client); - $obj->fillWithData($value); - $this->plan = $obj; - } - return $this; - } - - /** - * Get PlanId - * ID of the plan used to create the addon, if any - * @return string - */ - public function getPlanId() - { - return $this->planId; - } - - /** - * Set PlanId - * ID of the plan used to create the addon, if any - * @param string $value - * @return $this - */ - public function setPlanId($value) - { - $this->planId = $value; - return $this; - } - - /** - * Get Type - * Type of the addon. Can be either metered or recurring - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * Set Type - * Type of the addon. Can be either metered or recurring - * @param string $value - * @return $this - */ - public function setType($value) - { - $this->type = $value; - return $this; - } - - /** - * Get Name - * Name of the addon - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set Name - * Name of the addon - * @param string $value - * @return $this - */ - public function setName($value) - { - $this->name = $value; - return $this; - } - - /** - * Get Amount - * Amount of the addon - * @return string - */ - public function getAmount() - { - return $this->amount; - } - - /** - * Set Amount - * Amount of the addon - * @param string $value - * @return $this - */ - public function setAmount($value) - { - $this->amount = $value; - return $this; - } - - /** - * Get Quantity - * Quantity of the addon - * @return int - */ - public function getQuantity() - { - return $this->quantity; - } - - /** - * Set Quantity - * Quantity of the addon - * @param int $value - * @return $this - */ - public function setQuantity($value) - { - $this->quantity = $value; - return $this; - } - - /** - * Get Metadata - * Metadata related to the addon, in the form of a dictionary (key-value pair) - * @return array - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * Set Metadata - * Metadata related to the addon, in the form of a dictionary (key-value pair) - * @param array $value - * @return $this - */ - public function setMetadata($value) - { - $this->metadata = $value; - return $this; - } - - /** - * Get Sandbox - * Define whether or not the addon is in sandbox environment - * @return bool - */ - public function getSandbox() - { - return $this->sandbox; - } - - /** - * Set Sandbox - * Define whether or not the addon is in sandbox environment - * @param bool $value - * @return $this - */ - public function setSandbox($value) - { - $this->sandbox = $value; - return $this; - } - - /** - * Get CreatedAt - * Date at which the addon was created - * @return string - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * Set CreatedAt - * Date at which the addon was created - * @param string $value - * @return $this - */ - public function setCreatedAt($value) - { - $this->createdAt = $value; - return $this; - } - - - /** - * Fills the current object with the new values pulled from the data - * @param array $data - * @return Addon - */ - public function fillWithData($data) - { - if(! empty($data['id'])) - $this->setId($data['id']); - - if(! empty($data['project'])) - $this->setProject($data['project']); - - if(! empty($data['project_id'])) - $this->setProjectId($data['project_id']); - - if(! empty($data['subscription'])) - $this->setSubscription($data['subscription']); - - if(! empty($data['subscription_id'])) - $this->setSubscriptionId($data['subscription_id']); - - if(! empty($data['plan'])) - $this->setPlan($data['plan']); - - if(! empty($data['plan_id'])) - $this->setPlanId($data['plan_id']); - - if(! empty($data['type'])) - $this->setType($data['type']); - - if(! empty($data['name'])) - $this->setName($data['name']); - - if(! empty($data['amount'])) - $this->setAmount($data['amount']); - - if(! empty($data['quantity'])) - $this->setQuantity($data['quantity']); - - if(! empty($data['metadata'])) - $this->setMetadata($data['metadata']); - - if(! empty($data['sandbox'])) - $this->setSandbox($data['sandbox']); - - if(! empty($data['created_at'])) - $this->setCreatedAt($data['created_at']); - - return $this; - } - - /** - * Implements the JsonSerializable interface - * @return object - */ - public function jsonSerialize() { - return array( - "id" => $this->getId(), - "project" => $this->getProject(), - "project_id" => $this->getProjectId(), - "subscription" => $this->getSubscription(), - "subscription_id" => $this->getSubscriptionId(), - "plan" => $this->getPlan(), - "plan_id" => $this->getPlanId(), - "type" => $this->getType(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "quantity" => $this->getQuantity(), - "metadata" => $this->getMetadata(), - "sandbox" => $this->getSandbox(), - "created_at" => $this->getCreatedAt(), - ); - } - - - /** - * Get the addons applied to the subscription. - * @param string $subscriptionId - * @param array $options - * @return array - */ - public function fetchSubscriptionAddons($subscriptionId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($subscriptionId) . "/addons"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field addons - $a = array(); - $body = $response->getBody(); - foreach($body['addons'] as $v) - { - $tmp = new Addon($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Addons'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Create a new addon to the given subscription ID. - * @param array $options - * @return $this - */ - public function create($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getSubscriptionId()) . "/addons"; - - $data = array( - "plan_id" => $this->getPlanId(), - "type" => $this->getType(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "quantity" => $this->getQuantity(), - "metadata" => $this->getMetadata(), - "prorate" => (!empty($options["prorate"])) ? $options["prorate"] : null, - "proration_date" => (!empty($options["proration_date"])) ? $options["proration_date"] : null, - "preview" => (!empty($options["preview"])) ? $options["preview"] : null - ); - - $response = $request->post($path, $data, $options); - $returnValues = array(); - - - // Handling for field addon - $body = $response->getBody(); - if (isset($body['addon'])) { - $body = $body['addon']; - $returnValues['create'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Find a subscription's addon by its ID. - * @param string $subscriptionId - * @param string $addonId - * @param array $options - * @return $this - */ - public function find($subscriptionId, $addonId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($subscriptionId) . "/addons/" . urlencode($addonId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field addon - $body = $response->getBody(); - if (isset($body['addon'])) { - $body = $body['addon']; - $returnValues['find'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Save the updated addon attributes. - * @param array $options - * @return $this - */ - public function save($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getSubscriptionId()) . "/addons/" . urlencode($this->getId()) . ""; - - $data = array( - "plan_id" => $this->getPlanId(), - "type" => $this->getType(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "quantity" => $this->getQuantity(), - "metadata" => $this->getMetadata(), - "prorate" => (!empty($options["prorate"])) ? $options["prorate"] : null, - "proration_date" => (!empty($options["proration_date"])) ? $options["proration_date"] : null, - "preview" => (!empty($options["preview"])) ? $options["preview"] : null, - "increment_quantity_by" => (!empty($options["increment_quantity_by"])) ? $options["increment_quantity_by"] : null - ); - - $response = $request->put($path, $data, $options); - $returnValues = array(); - - - // Handling for field addon - $body = $response->getBody(); - if (isset($body['addon'])) { - $body = $body['addon']; - $returnValues['save'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Delete an addon applied to a subscription. - * @param array $options - * @return bool - */ - public function delete($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getSubscriptionId()) . "/addons/" . urlencode($this->getId()) . ""; - - $data = array( - "prorate" => (!empty($options["prorate"])) ? $options["prorate"] : null, - "proration_date" => (!empty($options["proration_date"])) ? $options["proration_date"] : null, - "preview" => (!empty($options["preview"])) ? $options["preview"] : null - ); - - $response = $request->delete($path, $data, $options); - $returnValues = array(); - - $returnValues['success'] = $response->isSuccess(); - - return array_values($returnValues)[0]; - } - -} diff --git a/src/AlternativeMerchantCertificate.php b/src/AlternativeMerchantCertificate.php index 69daef9..bd814bd 100755 --- a/src/AlternativeMerchantCertificate.php +++ b/src/AlternativeMerchantCertificate.php @@ -73,9 +73,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), ); diff --git a/src/ApplePayAlternativeMerchantCertificates.php b/src/ApplePayAlternativeMerchantCertificates.php index e593dd7..fb9a8e1 100755 --- a/src/ApplePayAlternativeMerchantCertificates.php +++ b/src/ApplePayAlternativeMerchantCertificates.php @@ -116,9 +116,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "count" => $this->getCount(), "alternative_merchant_certificates" => $this->getAlternativeMerchantCertificates(), diff --git a/src/Balance.php b/src/Balance.php index 9df9621..a590d3a 100755 --- a/src/Balance.php +++ b/src/Balance.php @@ -135,9 +135,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "amount" => $this->getAmount(), "currency" => $this->getCurrency(), diff --git a/src/Balances.php b/src/Balances.php index 26f7a8f..a6d0d29 100755 --- a/src/Balances.php +++ b/src/Balances.php @@ -161,9 +161,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "vouchers" => $this->getVouchers(), "available_balance" => $this->getAvailableBalance(), diff --git a/src/BalancesCustomerAction.php b/src/BalancesCustomerAction.php index d160970..8a02cf1 100755 --- a/src/BalancesCustomerAction.php +++ b/src/BalancesCustomerAction.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "type" => $this->getType(), "value" => $this->getValue(), diff --git a/src/Card.php b/src/Card.php index 8a7419b..80740e2 100755 --- a/src/Card.php +++ b/src/Card.php @@ -214,6 +214,18 @@ class Card implements \JsonSerializable */ protected $createdAt; + /** + * Preferred card type for combo cards, such as credit or debit + * @var string + */ + protected $preferredCardType; + + /** + * ID of the Vault that the card resides in + * @var string + */ + protected $vaultId; + /** * Card constructor * @param ProcessOut\ProcessOut $client @@ -967,6 +979,50 @@ public function setCreatedAt($value) return $this; } + /** + * Get PreferredCardType + * Preferred card type for combo cards, such as credit or debit + * @return string + */ + public function getPreferredCardType() + { + return $this->preferredCardType; + } + + /** + * Set PreferredCardType + * Preferred card type for combo cards, such as credit or debit + * @param string $value + * @return $this + */ + public function setPreferredCardType($value) + { + $this->preferredCardType = $value; + return $this; + } + + /** + * Get VaultId + * ID of the Vault that the card resides in + * @return string + */ + public function getVaultId() + { + return $this->vaultId; + } + + /** + * Set VaultId + * ID of the Vault that the card resides in + * @param string $value + * @return $this + */ + public function setVaultId($value) + { + $this->vaultId = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -1074,14 +1130,20 @@ public function fillWithData($data) if(! empty($data['created_at'])) $this->setCreatedAt($data['created_at']); + if(! empty($data['preferred_card_type'])) + $this->setPreferredCardType($data['preferred_card_type']); + + if(! empty($data['vault_id'])) + $this->setVaultId($data['vault_id']); + return $this; } /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), @@ -1116,6 +1178,8 @@ public function jsonSerialize() { "expires_soon" => $this->getExpiresSoon(), "sandbox" => $this->getSandbox(), "created_at" => $this->getCreatedAt(), + "preferred_card_type" => $this->getPreferredCardType(), + "vault_id" => $this->getVaultId(), ); } diff --git a/src/CardContact.php b/src/CardContact.php index ac5544e..c3a5cc7 100755 --- a/src/CardContact.php +++ b/src/CardContact.php @@ -228,9 +228,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "address1" => $this->getAddress1(), "address2" => $this->getAddress2(), diff --git a/src/CardCreateRequest.php b/src/CardCreateRequest.php index 7b02917..6526072 100755 --- a/src/CardCreateRequest.php +++ b/src/CardCreateRequest.php @@ -64,6 +64,12 @@ class CardCreateRequest implements \JsonSerializable */ protected $preferredScheme; + /** + * Preferred card type for combo cards + * @var string + */ + protected $preferredCardType; + /** * Metadata related to the card, in the form of a dictionary (key-value pair) * @var dictionary @@ -314,6 +320,28 @@ public function setPreferredScheme($value) return $this; } + /** + * Get PreferredCardType + * Preferred card type for combo cards + * @return string + */ + public function getPreferredCardType() + { + return $this->preferredCardType; + } + + /** + * Set PreferredCardType + * Preferred card type for combo cards + * @param string $value + * @return $this + */ + public function setPreferredCardType($value) + { + $this->preferredCardType = $value; + return $this; + } + /** * Get Metadata * Metadata related to the card, in the form of a dictionary (key-value pair) @@ -558,6 +586,9 @@ public function fillWithData($data) if(! empty($data['preferred_scheme'])) $this->setPreferredScheme($data['preferred_scheme']); + if(! empty($data['preferred_card_type'])) + $this->setPreferredCardType($data['preferred_card_type']); + if(! empty($data['metadata'])) $this->setMetadata($data['metadata']); @@ -590,9 +621,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "device" => $this->getDevice(), "name" => $this->getName(), @@ -602,6 +633,7 @@ public function jsonSerialize() { "exp_year" => $this->getExpYear(), "cvc2" => $this->getCvc2(), "preferred_scheme" => $this->getPreferredScheme(), + "preferred_card_type" => $this->getPreferredCardType(), "metadata" => $this->getMetadata(), "token_type" => $this->getTokenType(), "eci" => $this->getEci(), @@ -636,6 +668,7 @@ public function create($options = array()) "exp_year" => $this->getExpYear(), "cvc2" => $this->getCvc2(), "preferred_scheme" => $this->getPreferredScheme(), + "preferred_card_type" => $this->getPreferredCardType(), "metadata" => $this->getMetadata(), "token_type" => $this->getTokenType(), "eci" => $this->getEci(), @@ -644,7 +677,8 @@ public function create($options = array()) "applepay_mid" => $this->getApplepayMid(), "payment_token" => $this->getPaymentToken(), "contact" => $this->getContact(), - "shipping" => $this->getShipping() + "shipping" => $this->getShipping(), + "scheme_transaction" => $this->getSchemeTransaction() ); $response = $request->post($path, $data, $options); diff --git a/src/CardInformation.php b/src/CardInformation.php index 7c0175b..c9b86bb 100755 --- a/src/CardInformation.php +++ b/src/CardInformation.php @@ -259,9 +259,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "iin" => $this->getIin(), "scheme" => $this->getScheme(), diff --git a/src/CardShipping.php b/src/CardShipping.php index dca5d1d..71d4d3e 100755 --- a/src/CardShipping.php +++ b/src/CardShipping.php @@ -359,9 +359,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "address1" => $this->getAddress1(), "address2" => $this->getAddress2(), diff --git a/src/CardUpdateRequest.php b/src/CardUpdateRequest.php index 442abfd..c62de71 100755 --- a/src/CardUpdateRequest.php +++ b/src/CardUpdateRequest.php @@ -22,6 +22,12 @@ class CardUpdateRequest implements \JsonSerializable */ protected $preferredScheme; + /** + * Preferred card type for combo cards, such as credit or debit. + * @var string + */ + protected $preferredCardType; + /** * CardUpdateRequest constructor * @param ProcessOut\ProcessOut $client @@ -57,6 +63,28 @@ public function setPreferredScheme($value) return $this; } + /** + * Get PreferredCardType + * Preferred card type for combo cards, such as credit or debit. + * @return string + */ + public function getPreferredCardType() + { + return $this->preferredCardType; + } + + /** + * Set PreferredCardType + * Preferred card type for combo cards, such as credit or debit. + * @param string $value + * @return $this + */ + public function setPreferredCardType($value) + { + $this->preferredCardType = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -68,16 +96,20 @@ public function fillWithData($data) if(! empty($data['preferred_scheme'])) $this->setPreferredScheme($data['preferred_scheme']); + if(! empty($data['preferred_card_type'])) + $this->setPreferredCardType($data['preferred_card_type']); + return $this; } /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "preferred_scheme" => $this->getPreferredScheme(), + "preferred_card_type" => $this->getPreferredCardType(), ); } @@ -96,7 +128,8 @@ public function update($cardId, $options = array()) $path = "/cards/" . urlencode($cardId) . ""; $data = array( - "preferred_scheme" => $this->getPreferredScheme() + "preferred_scheme" => $this->getPreferredScheme(), + "scheme_transaction" => $this->getSchemeTransaction() ); $response = $request->put($path, $data, $options); diff --git a/src/CategoryErrorCodes.php b/src/CategoryErrorCodes.php index 6d58c7b..4825200 100755 --- a/src/CategoryErrorCodes.php +++ b/src/CategoryErrorCodes.php @@ -383,9 +383,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "generic" => $this->getGeneric(), "service" => $this->getService(), diff --git a/src/Coupon.php b/src/Coupon.php deleted file mode 100755 index eb811fa..0000000 --- a/src/Coupon.php +++ /dev/null @@ -1,632 +0,0 @@ -client = $client; - - $this->fillWithData($prefill); - } - - - /** - * Get Id - * ID of the coupon - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Set Id - * ID of the coupon - * @param string $value - * @return $this - */ - public function setId($value) - { - $this->id = $value; - return $this; - } - - /** - * Get Project - * Project to which the coupon belongs - * @return object - */ - public function getProject() - { - return $this->project; - } - - /** - * Set Project - * Project to which the coupon belongs - * @param object $value - * @return $this - */ - public function setProject($value) - { - if (is_object($value)) - $this->project = $value; - else - { - $obj = new Project($this->client); - $obj->fillWithData($value); - $this->project = $obj; - } - return $this; - } - - /** - * Get ProjectId - * ID of the project to which the coupon belongs - * @return string - */ - public function getProjectId() - { - return $this->projectId; - } - - /** - * Set ProjectId - * ID of the project to which the coupon belongs - * @param string $value - * @return $this - */ - public function setProjectId($value) - { - $this->projectId = $value; - return $this; - } - - /** - * Get AmountOff - * Amount to be removed from the subscription price - * @return string - */ - public function getAmountOff() - { - return $this->amountOff; - } - - /** - * Set AmountOff - * Amount to be removed from the subscription price - * @param string $value - * @return $this - */ - public function setAmountOff($value) - { - $this->amountOff = $value; - return $this; - } - - /** - * Get PercentOff - * Percent of the subscription amount to be removed (integer between 0 and 100) - * @return int - */ - public function getPercentOff() - { - return $this->percentOff; - } - - /** - * Set PercentOff - * Percent of the subscription amount to be removed (integer between 0 and 100) - * @param int $value - * @return $this - */ - public function setPercentOff($value) - { - $this->percentOff = $value; - return $this; - } - - /** - * Get Currency - * Currency of the coupon amount_off - * @return string - */ - public function getCurrency() - { - return $this->currency; - } - - /** - * Set Currency - * Currency of the coupon amount_off - * @param string $value - * @return $this - */ - public function setCurrency($value) - { - $this->currency = $value; - return $this; - } - - /** - * Get IterationCount - * Number billing cycles the coupon will last when applied to a subscription. If 0, will last forever - * @return int - */ - public function getIterationCount() - { - return $this->iterationCount; - } - - /** - * Set IterationCount - * Number billing cycles the coupon will last when applied to a subscription. If 0, will last forever - * @param int $value - * @return $this - */ - public function setIterationCount($value) - { - $this->iterationCount = $value; - return $this; - } - - /** - * Get MaxRedemptions - * Number of time the coupon can be redeemed. If 0, there's no limit - * @return int - */ - public function getMaxRedemptions() - { - return $this->maxRedemptions; - } - - /** - * Set MaxRedemptions - * Number of time the coupon can be redeemed. If 0, there's no limit - * @param int $value - * @return $this - */ - public function setMaxRedemptions($value) - { - $this->maxRedemptions = $value; - return $this; - } - - /** - * Get ExpiresAt - * Date at which the coupon will expire - * @return string - */ - public function getExpiresAt() - { - return $this->expiresAt; - } - - /** - * Set ExpiresAt - * Date at which the coupon will expire - * @param string $value - * @return $this - */ - public function setExpiresAt($value) - { - $this->expiresAt = $value; - return $this; - } - - /** - * Get Metadata - * Metadata related to the coupon, in the form of a dictionary (key-value pair) - * @return array - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * Set Metadata - * Metadata related to the coupon, in the form of a dictionary (key-value pair) - * @param array $value - * @return $this - */ - public function setMetadata($value) - { - $this->metadata = $value; - return $this; - } - - /** - * Get RedeemedNumber - * Number of times the coupon was already redeemed - * @return int - */ - public function getRedeemedNumber() - { - return $this->redeemedNumber; - } - - /** - * Set RedeemedNumber - * Number of times the coupon was already redeemed - * @param int $value - * @return $this - */ - public function setRedeemedNumber($value) - { - $this->redeemedNumber = $value; - return $this; - } - - /** - * Get Sandbox - * True if the coupon was created in the sandbox environment, false otherwise - * @return bool - */ - public function getSandbox() - { - return $this->sandbox; - } - - /** - * Set Sandbox - * True if the coupon was created in the sandbox environment, false otherwise - * @param bool $value - * @return $this - */ - public function setSandbox($value) - { - $this->sandbox = $value; - return $this; - } - - /** - * Get CreatedAt - * Date at which the coupon was created - * @return string - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * Set CreatedAt - * Date at which the coupon was created - * @param string $value - * @return $this - */ - public function setCreatedAt($value) - { - $this->createdAt = $value; - return $this; - } - - - /** - * Fills the current object with the new values pulled from the data - * @param array $data - * @return Coupon - */ - public function fillWithData($data) - { - if(! empty($data['id'])) - $this->setId($data['id']); - - if(! empty($data['project'])) - $this->setProject($data['project']); - - if(! empty($data['project_id'])) - $this->setProjectId($data['project_id']); - - if(! empty($data['amount_off'])) - $this->setAmountOff($data['amount_off']); - - if(! empty($data['percent_off'])) - $this->setPercentOff($data['percent_off']); - - if(! empty($data['currency'])) - $this->setCurrency($data['currency']); - - if(! empty($data['iteration_count'])) - $this->setIterationCount($data['iteration_count']); - - if(! empty($data['max_redemptions'])) - $this->setMaxRedemptions($data['max_redemptions']); - - if(! empty($data['expires_at'])) - $this->setExpiresAt($data['expires_at']); - - if(! empty($data['metadata'])) - $this->setMetadata($data['metadata']); - - if(! empty($data['redeemed_number'])) - $this->setRedeemedNumber($data['redeemed_number']); - - if(! empty($data['sandbox'])) - $this->setSandbox($data['sandbox']); - - if(! empty($data['created_at'])) - $this->setCreatedAt($data['created_at']); - - return $this; - } - - /** - * Implements the JsonSerializable interface - * @return object - */ - public function jsonSerialize() { - return array( - "id" => $this->getId(), - "project" => $this->getProject(), - "project_id" => $this->getProjectId(), - "amount_off" => $this->getAmountOff(), - "percent_off" => $this->getPercentOff(), - "currency" => $this->getCurrency(), - "iteration_count" => $this->getIterationCount(), - "max_redemptions" => $this->getMaxRedemptions(), - "expires_at" => $this->getExpiresAt(), - "metadata" => $this->getMetadata(), - "redeemed_number" => $this->getRedeemedNumber(), - "sandbox" => $this->getSandbox(), - "created_at" => $this->getCreatedAt(), - ); - } - - - /** - * Get all the coupons. - * @param array $options - * @return array - */ - public function all($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/coupons"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field coupons - $a = array(); - $body = $response->getBody(); - foreach($body['coupons'] as $v) - { - $tmp = new Coupon($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Coupons'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Create a new coupon. - * @param array $options - * @return $this - */ - public function create($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/coupons"; - - $data = array( - "id" => $this->getId(), - "amount_off" => $this->getAmountOff(), - "percent_off" => $this->getPercentOff(), - "currency" => $this->getCurrency(), - "iteration_count" => $this->getIterationCount(), - "max_redemptions" => $this->getMaxRedemptions(), - "expires_at" => $this->getExpiresAt(), - "metadata" => $this->getMetadata() - ); - - $response = $request->post($path, $data, $options); - $returnValues = array(); - - - // Handling for field coupon - $body = $response->getBody(); - if (isset($body['coupon'])) { - $body = $body['coupon']; - $returnValues['create'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Find a coupon by its ID. - * @param string $couponId - * @param array $options - * @return $this - */ - public function find($couponId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/coupons/" . urlencode($couponId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field coupon - $body = $response->getBody(); - if (isset($body['coupon'])) { - $body = $body['coupon']; - $returnValues['find'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Save the updated coupon attributes. - * @param array $options - * @return $this - */ - public function save($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/coupons/" . urlencode($this->getId()) . ""; - - $data = array( - "metadata" => $this->getMetadata() - ); - - $response = $request->put($path, $data, $options); - $returnValues = array(); - - - // Handling for field coupon - $body = $response->getBody(); - if (isset($body['coupon'])) { - $body = $body['coupon']; - $returnValues['save'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Delete the coupon. - * @param array $options - * @return bool - */ - public function delete($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/coupons/" . urlencode($this->getId()) . ""; - - $data = array( - - ); - - $response = $request->delete($path, $data, $options); - $returnValues = array(); - - $returnValues['success'] = $response->isSuccess(); - - return array_values($returnValues)[0]; - } - -} diff --git a/src/Customer.php b/src/Customer.php index 118b20c..3d02ef0 100755 --- a/src/Customer.php +++ b/src/Customer.php @@ -52,12 +52,6 @@ class Customer implements \JsonSerializable */ protected $tokens; - /** - * List of the customer subscriptions - * @var list - */ - protected $subscriptions; - /** * List of the customer transactions * @var list @@ -208,6 +202,12 @@ class Customer implements \JsonSerializable */ protected $referenceId; + /** + * ID of the Vault that customer resides in + * @var string + */ + protected $vaultId; + /** * Customer constructor * @param ProcessOut\ProcessOut $client @@ -379,40 +379,6 @@ public function setTokens($value) return $this; } - /** - * Get Subscriptions - * List of the customer subscriptions - * @return array - */ - public function getSubscriptions() - { - return $this->subscriptions; - } - - /** - * Set Subscriptions - * List of the customer subscriptions - * @param array $value - * @return $this - */ - public function setSubscriptions($value) - { - if (count($value) > 0 && is_object($value[0])) - $this->subscriptions = $value; - else - { - $a = array(); - foreach ($value as $v) - { - $obj = new Subscription($this->client); - $obj->fillWithData($v); - $a[] = $obj; - } - $this->subscriptions = $a; - } - return $this; - } - /** * Get Transactions * List of the customer transactions @@ -982,6 +948,28 @@ public function setReferenceId($value) return $this; } + /** + * Get VaultId + * ID of the Vault that customer resides in + * @return string + */ + public function getVaultId() + { + return $this->vaultId; + } + + /** + * Set VaultId + * ID of the Vault that customer resides in + * @param string $value + * @return $this + */ + public function setVaultId($value) + { + $this->vaultId = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -1008,9 +996,6 @@ public function fillWithData($data) if(! empty($data['tokens'])) $this->setTokens($data['tokens']); - if(! empty($data['subscriptions'])) - $this->setSubscriptions($data['subscriptions']); - if(! empty($data['transactions'])) $this->setTransactions($data['transactions']); @@ -1086,14 +1071,17 @@ public function fillWithData($data) if(! empty($data['reference_id'])) $this->setReferenceId($data['reference_id']); + if(! empty($data['vault_id'])) + $this->setVaultId($data['vault_id']); + return $this; } /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), @@ -1101,7 +1089,6 @@ public function jsonSerialize() { "default_token" => $this->getDefaultToken(), "default_token_id" => $this->getDefaultTokenId(), "tokens" => $this->getTokens(), - "subscriptions" => $this->getSubscriptions(), "transactions" => $this->getTransactions(), "balance" => $this->getBalance(), "currency" => $this->getCurrency(), @@ -1127,44 +1114,11 @@ public function jsonSerialize() { "registered_at" => $this->getRegisteredAt(), "date_of_birth" => $this->getDateOfBirth(), "reference_id" => $this->getReferenceId(), + "vault_id" => $this->getVaultId(), ); } - /** - * Get the subscriptions belonging to the customer. - * @param array $options - * @return array - */ - public function fetchSubscriptions($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/customers/" . urlencode($this->getId()) . "/subscriptions"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field subscriptions - $a = array(); - $body = $response->getBody(); - foreach($body['subscriptions'] as $v) - { - $tmp = new Subscription($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Subscriptions'] = $a; - - return array_values($returnValues)[0]; - } - /** * Get the customer's tokens. * @param array $options diff --git a/src/CustomerAction.php b/src/CustomerAction.php index 1d754c8..5b8eb21 100755 --- a/src/CustomerAction.php +++ b/src/CustomerAction.php @@ -135,9 +135,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "type" => $this->getType(), "value" => $this->getValue(), diff --git a/src/CustomerPhone.php b/src/CustomerPhone.php index 3e98b49..92a8b57 100755 --- a/src/CustomerPhone.php +++ b/src/CustomerPhone.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "number" => $this->getNumber(), "dialing_code" => $this->getDialingCode(), diff --git a/src/Device.php b/src/Device.php index 6691757..c1015bc 100755 --- a/src/Device.php +++ b/src/Device.php @@ -34,6 +34,18 @@ class Device implements \JsonSerializable */ protected $channel; + /** + * Preferred 3DS SDK type for authentication. Possible values: "web", "ios", "android", "other". This is the recommended field to use instead of channel for 3DS SDK selection + * @var string + */ + protected $threedsSdk; + + /** + * Platform of the device for analytics and metadata. Possible values: "web", "ios", "android", "other" + * @var string + */ + protected $platform; + /** * Device IP address. Use if request origin is "backend" * @var string @@ -173,6 +185,50 @@ public function setChannel($value) return $this; } + /** + * Get ThreedsSdk + * Preferred 3DS SDK type for authentication. Possible values: "web", "ios", "android", "other". This is the recommended field to use instead of channel for 3DS SDK selection + * @return string + */ + public function getThreedsSdk() + { + return $this->threedsSdk; + } + + /** + * Set ThreedsSdk + * Preferred 3DS SDK type for authentication. Possible values: "web", "ios", "android", "other". This is the recommended field to use instead of channel for 3DS SDK selection + * @param string $value + * @return $this + */ + public function setThreedsSdk($value) + { + $this->threedsSdk = $value; + return $this; + } + + /** + * Get Platform + * Platform of the device for analytics and metadata. Possible values: "web", "ios", "android", "other" + * @return string + */ + public function getPlatform() + { + return $this->platform; + } + + /** + * Set Platform + * Platform of the device for analytics and metadata. Possible values: "web", "ios", "android", "other" + * @param string $value + * @return $this + */ + public function setPlatform($value) + { + $this->platform = $value; + return $this; + } + /** * Get IpAddress * Device IP address. Use if request origin is "backend" @@ -410,6 +466,12 @@ public function fillWithData($data) if(! empty($data['channel'])) $this->setChannel($data['channel']); + if(! empty($data['threeds_sdk'])) + $this->setThreedsSdk($data['threeds_sdk']); + + if(! empty($data['platform'])) + $this->setPlatform($data['platform']); + if(! empty($data['ip_address'])) $this->setIpAddress($data['ip_address']); @@ -445,13 +507,15 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "request_origin" => $this->getRequestOrigin(), "id" => $this->getId(), "channel" => $this->getChannel(), + "threeds_sdk" => $this->getThreedsSdk(), + "platform" => $this->getPlatform(), "ip_address" => $this->getIpAddress(), "user_agent" => $this->getUserAgent(), "header_accept" => $this->getHeaderAccept(), diff --git a/src/Discount.php b/src/Discount.php deleted file mode 100755 index fcf88a6..0000000 --- a/src/Discount.php +++ /dev/null @@ -1,647 +0,0 @@ -client = $client; - - $this->fillWithData($prefill); - } - - - /** - * Get Id - * ID of the discount - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Set Id - * ID of the discount - * @param string $value - * @return $this - */ - public function setId($value) - { - $this->id = $value; - return $this; - } - - /** - * Get Project - * Project to which the discount belongs - * @return object - */ - public function getProject() - { - return $this->project; - } - - /** - * Set Project - * Project to which the discount belongs - * @param object $value - * @return $this - */ - public function setProject($value) - { - if (is_object($value)) - $this->project = $value; - else - { - $obj = new Project($this->client); - $obj->fillWithData($value); - $this->project = $obj; - } - return $this; - } - - /** - * Get ProjectId - * ID of the project to which the discount belongs - * @return string - */ - public function getProjectId() - { - return $this->projectId; - } - - /** - * Set ProjectId - * ID of the project to which the discount belongs - * @param string $value - * @return $this - */ - public function setProjectId($value) - { - $this->projectId = $value; - return $this; - } - - /** - * Get Subscription - * Subscription to which the discount belongs - * @return object - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Set Subscription - * Subscription to which the discount belongs - * @param object $value - * @return $this - */ - public function setSubscription($value) - { - if (is_object($value)) - $this->subscription = $value; - else - { - $obj = new Subscription($this->client); - $obj->fillWithData($value); - $this->subscription = $obj; - } - return $this; - } - - /** - * Get SubscriptionId - * ID of the subscription to which the addon belongs - * @return string - */ - public function getSubscriptionId() - { - return $this->subscriptionId; - } - - /** - * Set SubscriptionId - * ID of the subscription to which the addon belongs - * @param string $value - * @return $this - */ - public function setSubscriptionId($value) - { - $this->subscriptionId = $value; - return $this; - } - - /** - * Get Coupon - * Coupon used to create the discount, if any - * @return object - */ - public function getCoupon() - { - return $this->coupon; - } - - /** - * Set Coupon - * Coupon used to create the discount, if any - * @param object $value - * @return $this - */ - public function setCoupon($value) - { - if (is_object($value)) - $this->coupon = $value; - else - { - $obj = new Coupon($this->client); - $obj->fillWithData($value); - $this->coupon = $obj; - } - return $this; - } - - /** - * Get CouponId - * ID of the coupon used to create the discount, if any - * @return string - */ - public function getCouponId() - { - return $this->couponId; - } - - /** - * Set CouponId - * ID of the coupon used to create the discount, if any - * @param string $value - * @return $this - */ - public function setCouponId($value) - { - $this->couponId = $value; - return $this; - } - - /** - * Get Name - * Name of the discount - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set Name - * Name of the discount - * @param string $value - * @return $this - */ - public function setName($value) - { - $this->name = $value; - return $this; - } - - /** - * Get Amount - * Amount discounted - * @return string - */ - public function getAmount() - { - return $this->amount; - } - - /** - * Set Amount - * Amount discounted - * @param string $value - * @return $this - */ - public function setAmount($value) - { - $this->amount = $value; - return $this; - } - - /** - * Get Percent - * Percentage discounted - * @return int - */ - public function getPercent() - { - return $this->percent; - } - - /** - * Set Percent - * Percentage discounted - * @param int $value - * @return $this - */ - public function setPercent($value) - { - $this->percent = $value; - return $this; - } - - /** - * Get ExpiresAt - * Date at which the discount will expire - * @return string - */ - public function getExpiresAt() - { - return $this->expiresAt; - } - - /** - * Set ExpiresAt - * Date at which the discount will expire - * @param string $value - * @return $this - */ - public function setExpiresAt($value) - { - $this->expiresAt = $value; - return $this; - } - - /** - * Get Metadata - * Metadata related to the discount, in the form of a dictionary (key-value pair) - * @return array - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * Set Metadata - * Metadata related to the discount, in the form of a dictionary (key-value pair) - * @param array $value - * @return $this - */ - public function setMetadata($value) - { - $this->metadata = $value; - return $this; - } - - /** - * Get Sandbox - * Define whether or not the discount is in sandbox environment - * @return bool - */ - public function getSandbox() - { - return $this->sandbox; - } - - /** - * Set Sandbox - * Define whether or not the discount is in sandbox environment - * @param bool $value - * @return $this - */ - public function setSandbox($value) - { - $this->sandbox = $value; - return $this; - } - - /** - * Get CreatedAt - * Date at which the discount was created - * @return string - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * Set CreatedAt - * Date at which the discount was created - * @param string $value - * @return $this - */ - public function setCreatedAt($value) - { - $this->createdAt = $value; - return $this; - } - - - /** - * Fills the current object with the new values pulled from the data - * @param array $data - * @return Discount - */ - public function fillWithData($data) - { - if(! empty($data['id'])) - $this->setId($data['id']); - - if(! empty($data['project'])) - $this->setProject($data['project']); - - if(! empty($data['project_id'])) - $this->setProjectId($data['project_id']); - - if(! empty($data['subscription'])) - $this->setSubscription($data['subscription']); - - if(! empty($data['subscription_id'])) - $this->setSubscriptionId($data['subscription_id']); - - if(! empty($data['coupon'])) - $this->setCoupon($data['coupon']); - - if(! empty($data['coupon_id'])) - $this->setCouponId($data['coupon_id']); - - if(! empty($data['name'])) - $this->setName($data['name']); - - if(! empty($data['amount'])) - $this->setAmount($data['amount']); - - if(! empty($data['percent'])) - $this->setPercent($data['percent']); - - if(! empty($data['expires_at'])) - $this->setExpiresAt($data['expires_at']); - - if(! empty($data['metadata'])) - $this->setMetadata($data['metadata']); - - if(! empty($data['sandbox'])) - $this->setSandbox($data['sandbox']); - - if(! empty($data['created_at'])) - $this->setCreatedAt($data['created_at']); - - return $this; - } - - /** - * Implements the JsonSerializable interface - * @return object - */ - public function jsonSerialize() { - return array( - "id" => $this->getId(), - "project" => $this->getProject(), - "project_id" => $this->getProjectId(), - "subscription" => $this->getSubscription(), - "subscription_id" => $this->getSubscriptionId(), - "coupon" => $this->getCoupon(), - "coupon_id" => $this->getCouponId(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "percent" => $this->getPercent(), - "expires_at" => $this->getExpiresAt(), - "metadata" => $this->getMetadata(), - "sandbox" => $this->getSandbox(), - "created_at" => $this->getCreatedAt(), - ); - } - - - /** - * Get the discounts applied to the subscription. - * @param string $subscriptionId - * @param array $options - * @return array - */ - public function fetchSubscriptionDiscounts($subscriptionId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($subscriptionId) . "/discounts"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field discounts - $a = array(); - $body = $response->getBody(); - foreach($body['discounts'] as $v) - { - $tmp = new Discount($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Discounts'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Create a new discount for the given subscription ID. - * @param array $options - * @return $this - */ - public function create($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getSubscriptionId()) . "/discounts"; - - $data = array( - "coupon_id" => $this->getCouponId(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "expires_at" => $this->getExpiresAt(), - "metadata" => $this->getMetadata() - ); - - $response = $request->post($path, $data, $options); - $returnValues = array(); - - - // Handling for field discount - $body = $response->getBody(); - if (isset($body['discount'])) { - $body = $body['discount']; - $returnValues['create'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Find a subscription's discount by its ID. - * @param string $subscriptionId - * @param string $discountId - * @param array $options - * @return $this - */ - public function find($subscriptionId, $discountId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($subscriptionId) . "/discounts/" . urlencode($discountId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field discount - $body = $response->getBody(); - if (isset($body['discount'])) { - $body = $body['discount']; - $returnValues['find'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Delete a discount applied to a subscription. - * @param array $options - * @return bool - */ - public function delete($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getSubscriptionId()) . "/discounts/" . urlencode($this->getId()) . ""; - - $data = array( - - ); - - $response = $request->delete($path, $data, $options); - $returnValues = array(); - - $returnValues['success'] = $response->isSuccess(); - - return array_values($returnValues)[0]; - } - -} diff --git a/src/DunningAction.php b/src/DunningAction.php index da6a6c6..2b3849e 100755 --- a/src/DunningAction.php +++ b/src/DunningAction.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "action" => $this->getAction(), "delay_in_days" => $this->getDelayInDays(), diff --git a/src/ErrorCodes.php b/src/ErrorCodes.php index 9912593..5b20349 100755 --- a/src/ErrorCodes.php +++ b/src/ErrorCodes.php @@ -80,9 +80,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "gateway" => $this->getGateway(), ); diff --git a/src/Event.php b/src/Event.php index 4edfa87..b2cdc1f 100755 --- a/src/Event.php +++ b/src/Event.php @@ -266,9 +266,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), diff --git a/src/Exceptions/AuthenticationException.php b/src/Exceptions/AuthenticationException.php index 8db94ed..f10368d 100644 --- a/src/Exceptions/AuthenticationException.php +++ b/src/Exceptions/AuthenticationException.php @@ -16,7 +16,7 @@ class AuthenticationException extends Exception implements ProcessOutExceptionIn * @param integer $code * @param Exception|null $previous */ - public function __construct($errorCode, $message, $code = 0, Exception $previous = null) + public function __construct($errorCode, $message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Exceptions/GenericException.php b/src/Exceptions/GenericException.php index fcd7c67..efaad9e 100644 --- a/src/Exceptions/GenericException.php +++ b/src/Exceptions/GenericException.php @@ -16,7 +16,7 @@ class GenericException extends Exception implements ProcessOutExceptionInterface * @param integer $code * @param Exception|null $previous */ - public function __construct($errorCode, $message, $code = 0, Exception $previous = null) + public function __construct($errorCode, $message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Exceptions/InternalException.php b/src/Exceptions/InternalException.php index 492a1cb..bbf776e 100644 --- a/src/Exceptions/InternalException.php +++ b/src/Exceptions/InternalException.php @@ -16,7 +16,7 @@ class InternalException extends Exception implements ProcessOutExceptionInterfac * @param integer $code * @param Exception|null $previous */ - public function __construct($errorCode, $message, $code = 0, Exception $previous = null) + public function __construct($errorCode, $message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Exceptions/NotFoundException.php b/src/Exceptions/NotFoundException.php index f4e04a5..7106c50 100644 --- a/src/Exceptions/NotFoundException.php +++ b/src/Exceptions/NotFoundException.php @@ -16,7 +16,7 @@ class NotFoundException extends Exception implements ProcessOutExceptionInterfac * @param integer $code * @param Exception|null $previous */ - public function __construct($errorCode, $message, $code = 0, Exception $previous = null) + public function __construct($errorCode, $message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Exceptions/ValidationException.php b/src/Exceptions/ValidationException.php index ee3925e..83bcce2 100644 --- a/src/Exceptions/ValidationException.php +++ b/src/Exceptions/ValidationException.php @@ -16,7 +16,7 @@ class ValidationException extends Exception implements ProcessOutExceptionInterf * @param integer $code * @param Exception|null $previous */ - public function __construct($errorCode, $message, $code = 0, Exception $previous = null) + public function __construct($errorCode, $message, $code = 0, ?Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/ExportLayout.php b/src/ExportLayout.php index 4b96eaa..f839611 100755 --- a/src/ExportLayout.php +++ b/src/ExportLayout.php @@ -304,9 +304,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), diff --git a/src/ExportLayoutConfiguration.php b/src/ExportLayoutConfiguration.php index 3184e43..0ba8a5b 100755 --- a/src/ExportLayoutConfiguration.php +++ b/src/ExportLayoutConfiguration.php @@ -161,9 +161,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "columns" => $this->getColumns(), "time" => $this->getTime(), diff --git a/src/ExportLayoutConfigurationAmount.php b/src/ExportLayoutConfigurationAmount.php index c0f6079..5dd600a 100755 --- a/src/ExportLayoutConfigurationAmount.php +++ b/src/ExportLayoutConfigurationAmount.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "precision" => $this->getPrecision(), "separator" => $this->getSeparator(), diff --git a/src/ExportLayoutConfigurationColumn.php b/src/ExportLayoutConfigurationColumn.php index 21f1a86..5bc8cae 100755 --- a/src/ExportLayoutConfigurationColumn.php +++ b/src/ExportLayoutConfigurationColumn.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "name" => $this->getName(), "rename" => $this->getRename(), diff --git a/src/ExportLayoutConfigurationConfigurationOptionsAmount.php b/src/ExportLayoutConfigurationConfigurationOptionsAmount.php index 9aa0d2b..20922ba 100755 --- a/src/ExportLayoutConfigurationConfigurationOptionsAmount.php +++ b/src/ExportLayoutConfigurationConfigurationOptionsAmount.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "precision" => $this->getPrecision(), "separator" => $this->getSeparator(), diff --git a/src/ExportLayoutConfigurationConfigurationOptionsTime.php b/src/ExportLayoutConfigurationConfigurationOptionsTime.php index fe60fdc..44ed06e 100755 --- a/src/ExportLayoutConfigurationConfigurationOptionsTime.php +++ b/src/ExportLayoutConfigurationConfigurationOptionsTime.php @@ -73,9 +73,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "format" => $this->getFormat(), ); diff --git a/src/ExportLayoutConfigurationOptions.php b/src/ExportLayoutConfigurationOptions.php index c91543f..e5191f2 100755 --- a/src/ExportLayoutConfigurationOptions.php +++ b/src/ExportLayoutConfigurationOptions.php @@ -149,9 +149,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "columns" => $this->getColumns(), "time" => $this->getTime(), diff --git a/src/ExportLayoutConfigurationTime.php b/src/ExportLayoutConfigurationTime.php index b162715..342f86b 100755 --- a/src/ExportLayoutConfigurationTime.php +++ b/src/ExportLayoutConfigurationTime.php @@ -73,9 +73,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "format" => $this->getFormat(), ); diff --git a/src/ExternalThreeDS.php b/src/ExternalThreeDS.php index 0e0293f..5572e39 100755 --- a/src/ExternalThreeDS.php +++ b/src/ExternalThreeDS.php @@ -259,9 +259,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "xid" => $this->getXid(), "trans_status" => $this->getTransStatus(), diff --git a/src/Gateway.php b/src/Gateway.php index a79c1de..7819737 100755 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -383,9 +383,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "name" => $this->getName(), diff --git a/src/GatewayConfiguration.php b/src/GatewayConfiguration.php index 44eb692..2b94e09 100755 --- a/src/GatewayConfiguration.php +++ b/src/GatewayConfiguration.php @@ -459,9 +459,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), diff --git a/src/Invoice.php b/src/Invoice.php index d73cfd1..3143853 100755 --- a/src/Invoice.php +++ b/src/Invoice.php @@ -58,18 +58,6 @@ class Invoice implements \JsonSerializable */ protected $customerId; - /** - * Subscription to which the invoice is linked to, if any - * @var object - */ - protected $subscription; - - /** - * ID of the subscription to which the invoice is linked to, if any - * @var string - */ - protected $subscriptionId; - /** * Token used to pay the invoice, if any * @var object @@ -516,57 +504,6 @@ public function setCustomerId($value) return $this; } - /** - * Get Subscription - * Subscription to which the invoice is linked to, if any - * @return object - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Set Subscription - * Subscription to which the invoice is linked to, if any - * @param object $value - * @return $this - */ - public function setSubscription($value) - { - if (is_object($value)) - $this->subscription = $value; - else - { - $obj = new Subscription($this->client); - $obj->fillWithData($value); - $this->subscription = $obj; - } - return $this; - } - - /** - * Get SubscriptionId - * ID of the subscription to which the invoice is linked to, if any - * @return string - */ - public function getSubscriptionId() - { - return $this->subscriptionId; - } - - /** - * Set SubscriptionId - * ID of the subscription to which the invoice is linked to, if any - * @param string $value - * @return $this - */ - public function setSubscriptionId($value) - { - $this->subscriptionId = $value; - return $this; - } - /** * Get Token * Token used to pay the invoice, if any @@ -1624,12 +1561,6 @@ public function fillWithData($data) if(! empty($data['customer_id'])) $this->setCustomerId($data['customer_id']); - if(! empty($data['subscription'])) - $this->setSubscription($data['subscription']); - - if(! empty($data['subscription_id'])) - $this->setSubscriptionId($data['subscription_id']); - if(! empty($data['token'])) $this->setToken($data['token']); @@ -1764,9 +1695,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), @@ -1775,8 +1706,6 @@ public function jsonSerialize() { "transaction_id" => $this->getTransactionId(), "customer" => $this->getCustomer(), "customer_id" => $this->getCustomerId(), - "subscription" => $this->getSubscription(), - "subscription_id" => $this->getSubscriptionId(), "token" => $this->getToken(), "token_id" => $this->getTokenId(), "details" => $this->getDetails(), @@ -1824,6 +1753,62 @@ public function jsonSerialize() { } + /** + * Autheticate the invoice using the given source (customer or token) + * @param string $source + * @param array $options + * @return array + */ + public function authenticate($source, $options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/invoices/:invoice_id/authenticate"; + + $data = array( + "device" => $this->getDevice(), + "incremental" => $this->getIncremental(), + "capture_type" => $this->getCaptureType(), + "split_allocations" => $this->getSplitAllocations(), + "installment_plan_id" => $this->getInstallmentPlanId(), + "synchronous" => (!empty($options["synchronous"])) ? $options["synchronous"] : null, + "retry_drop_liability_shift" => (!empty($options["retry_drop_liability_shift"])) ? $options["retry_drop_liability_shift"] : null, + "capture_amount" => (!empty($options["capture_amount"])) ? $options["capture_amount"] : null, + "enable_three_d_s_2" => (!empty($options["enable_three_d_s_2"])) ? $options["enable_three_d_s_2"] : null, + "allow_fallback_to_sale" => (!empty($options["allow_fallback_to_sale"])) ? $options["allow_fallback_to_sale"] : null, + "auto_capture_at" => (!empty($options["auto_capture_at"])) ? $options["auto_capture_at"] : null, + "metadata" => (!empty($options["metadata"])) ? $options["metadata"] : null, + "override_mac_blocking" => (!empty($options["override_mac_blocking"])) ? $options["override_mac_blocking"] : null, + "external_three_d_s" => (!empty($options["external_three_d_s"])) ? $options["external_three_d_s"] : null, + "save_source" => (!empty($options["save_source"])) ? $options["save_source"] : null, + "source" => $source + ); + + $response = $request->post($path, $data, $options); + $returnValues = array(); + + + // Handling for field transaction + $body = $response->getBody(); + if (isset($body['transaction'])) { + $body = $body['transaction']; + $transaction = new Transaction($this->client); + $returnValues['transaction'] = $transaction->fillWithData($body); + } + + // Handling for field customer_action + $body = $response->getBody(); + if (isset($body['customer_action'])) { + $body = $body['customer_action']; + $customerAction = new CustomerAction($this->client); + $returnValues['customerAction'] = $customerAction->fillWithData($body); + } + + + return (object) $returnValues; + } + /** * Create an incremental authorization * @param string $amount @@ -1874,6 +1859,9 @@ public function authorize($source, $options = array()) $data = array( "device" => $this->getDevice(), "incremental" => $this->getIncremental(), + "capture_type" => $this->getCaptureType(), + "split_allocations" => $this->getSplitAllocations(), + "installment_plan_id" => $this->getInstallmentPlanId(), "synchronous" => (!empty($options["synchronous"])) ? $options["synchronous"] : null, "retry_drop_liability_shift" => (!empty($options["retry_drop_liability_shift"])) ? $options["retry_drop_liability_shift"] : null, "capture_amount" => (!empty($options["capture_amount"])) ? $options["capture_amount"] : null, @@ -1926,7 +1914,9 @@ public function capture($source, $options = array()) $data = array( "device" => $this->getDevice(), + "authenticate_only" => $this->getAuthenticateOnly(), "incremental" => $this->getIncremental(), + "installment_plan_id" => $this->getInstallmentPlanId(), "authorize_only" => (!empty($options["authorize_only"])) ? $options["authorize_only"] : null, "synchronous" => (!empty($options["synchronous"])) ? $options["synchronous"] : null, "retry_drop_liability_shift" => (!empty($options["retry_drop_liability_shift"])) ? $options["retry_drop_liability_shift"] : null, @@ -2046,6 +2036,7 @@ public function payout($gatewayConfigurationId, $source, $options = array()) $data = array( "force_gateway_configuration_id" => (!empty($options["force_gateway_configuration_id"])) ? $options["force_gateway_configuration_id"] : null, + "metadata" => (!empty($options["metadata"])) ? $options["metadata"] : null, "gateway_configuration_id" => $gatewayConfigurationId, "source" => $source ); @@ -2323,7 +2314,8 @@ public function create($options = array()) "unsupported_feature_bypass" => $this->getUnsupportedFeatureBypass(), "verification" => $this->getVerification(), "auto_capture_at" => $this->getAutoCaptureAt(), - "expires_at" => $this->getExpiresAt() + "expires_at" => $this->getExpiresAt(), + "split_allocations" => $this->getSplitAllocations() ); $response = $request->post($path, $data, $options); diff --git a/src/InvoiceBilling.php b/src/InvoiceBilling.php index 6d7d0d7..50b232d 100755 --- a/src/InvoiceBilling.php +++ b/src/InvoiceBilling.php @@ -228,9 +228,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "address1" => $this->getAddress1(), "address2" => $this->getAddress2(), diff --git a/src/InvoiceDetail.php b/src/InvoiceDetail.php index 2456b86..655b4d5 100755 --- a/src/InvoiceDetail.php +++ b/src/InvoiceDetail.php @@ -538,9 +538,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "name" => $this->getName(), diff --git a/src/InvoiceDevice.php b/src/InvoiceDevice.php index bfd1a42..67b02a0 100755 --- a/src/InvoiceDevice.php +++ b/src/InvoiceDevice.php @@ -22,6 +22,12 @@ class InvoiceDevice implements \JsonSerializable */ protected $channel; + /** + * Platform of the device for analytics and metadata. Possible values: "web", "ios", "android", "other" + * @var string + */ + protected $platform; + /** * IP address of the device * @var string @@ -69,6 +75,28 @@ public function setChannel($value) return $this; } + /** + * Get Platform + * Platform of the device for analytics and metadata. Possible values: "web", "ios", "android", "other" + * @return string + */ + public function getPlatform() + { + return $this->platform; + } + + /** + * Set Platform + * Platform of the device for analytics and metadata. Possible values: "web", "ios", "android", "other" + * @param string $value + * @return $this + */ + public function setPlatform($value) + { + $this->platform = $value; + return $this; + } + /** * Get IpAddress * IP address of the device @@ -124,6 +152,9 @@ public function fillWithData($data) if(! empty($data['channel'])) $this->setChannel($data['channel']); + if(! empty($data['platform'])) + $this->setPlatform($data['platform']); + if(! empty($data['ip_address'])) $this->setIpAddress($data['ip_address']); @@ -135,11 +166,12 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "channel" => $this->getChannel(), + "platform" => $this->getPlatform(), "ip_address" => $this->getIpAddress(), "id" => $this->getId(), ); diff --git a/src/InvoiceExternalFraudTools.php b/src/InvoiceExternalFraudTools.php index f14bd80..5ba76c7 100755 --- a/src/InvoiceExternalFraudTools.php +++ b/src/InvoiceExternalFraudTools.php @@ -34,6 +34,12 @@ class InvoiceExternalFraudTools implements \JsonSerializable */ protected $signifyd; + /** + * Riskified + * @var object + */ + protected $riskified; + /** * InvoiceExternalFraudTools constructor * @param ProcessOut\ProcessOut $client @@ -113,6 +119,28 @@ public function setSignifyd($value) return $this; } + /** + * Get Riskified + * Riskified + * @return object + */ + public function getRiskified() + { + return $this->riskified; + } + + /** + * Set Riskified + * Riskified + * @param object $value + * @return $this + */ + public function setRiskified($value) + { + $this->riskified = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -130,18 +158,22 @@ public function fillWithData($data) if(! empty($data['signifyd'])) $this->setSignifyd($data['signifyd']); + if(! empty($data['riskified'])) + $this->setRiskified($data['riskified']); + return $this; } /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "forter" => $this->getForter(), "ravelin" => $this->getRavelin(), "signifyd" => $this->getSignifyd(), + "riskified" => $this->getRiskified(), ); } diff --git a/src/InvoiceRisk.php b/src/InvoiceRisk.php index fc02c03..f03c4dd 100755 --- a/src/InvoiceRisk.php +++ b/src/InvoiceRisk.php @@ -135,9 +135,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "score" => $this->getScore(), "is_legit" => $this->getIsLegit(), diff --git a/src/InvoiceShipping.php b/src/InvoiceShipping.php index 9bf65f7..eb5e157 100755 --- a/src/InvoiceShipping.php +++ b/src/InvoiceShipping.php @@ -576,9 +576,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "amount" => $this->getAmount(), "method" => $this->getMethod(), diff --git a/src/InvoiceShippingPhone.php b/src/InvoiceShippingPhone.php index 7358f95..3bc6231 100755 --- a/src/InvoiceShippingPhone.php +++ b/src/InvoiceShippingPhone.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "number" => $this->getNumber(), "dialing_code" => $this->getDialingCode(), diff --git a/src/InvoiceSubmerchant.php b/src/InvoiceSubmerchant.php index 7365fd4..c1a004d 100755 --- a/src/InvoiceSubmerchant.php +++ b/src/InvoiceSubmerchant.php @@ -335,9 +335,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "name" => $this->getName(), diff --git a/src/InvoiceTax.php b/src/InvoiceTax.php index 128c6bc..5431b46 100755 --- a/src/InvoiceTax.php +++ b/src/InvoiceTax.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "amount" => $this->getAmount(), "rate" => $this->getRate(), diff --git a/src/NativeAPMParameterDefinition.php b/src/NativeAPMParameterDefinition.php index b9561c3..c5e64c8 100755 --- a/src/NativeAPMParameterDefinition.php +++ b/src/NativeAPMParameterDefinition.php @@ -240,9 +240,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "key" => $this->getKey(), "type" => $this->getType(), diff --git a/src/NativeAPMParameterValue.php b/src/NativeAPMParameterValue.php index bbecca1..9a2026e 100755 --- a/src/NativeAPMParameterValue.php +++ b/src/NativeAPMParameterValue.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "key" => $this->getKey(), "value" => $this->getValue(), diff --git a/src/NativeAPMParameterValueDefinition.php b/src/NativeAPMParameterValueDefinition.php index f40de66..f26a811 100755 --- a/src/NativeAPMParameterValueDefinition.php +++ b/src/NativeAPMParameterValueDefinition.php @@ -135,9 +135,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "value" => $this->getValue(), "default" => $this->getDefault(), diff --git a/src/NativeAPMRequest.php b/src/NativeAPMRequest.php index f0c27f4..51ccc52 100755 --- a/src/NativeAPMRequest.php +++ b/src/NativeAPMRequest.php @@ -85,9 +85,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "parameter_values" => $this->getParameterValues(), ); diff --git a/src/NativeAPMResponse.php b/src/NativeAPMResponse.php index e68e5c6..7796445 100755 --- a/src/NativeAPMResponse.php +++ b/src/NativeAPMResponse.php @@ -159,9 +159,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "state" => $this->getState(), "parameter_definitions" => $this->getParameterDefinitions(), diff --git a/src/NativeAPMTransactionDetails.php b/src/NativeAPMTransactionDetails.php index c5aa544..5a6594e 100755 --- a/src/NativeAPMTransactionDetails.php +++ b/src/NativeAPMTransactionDetails.php @@ -192,9 +192,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "gateway" => $this->getGateway(), "invoice" => $this->getInvoice(), diff --git a/src/NativeAPMTransactionDetailsGateway.php b/src/NativeAPMTransactionDetailsGateway.php index d6019ee..97de14f 100755 --- a/src/NativeAPMTransactionDetailsGateway.php +++ b/src/NativeAPMTransactionDetailsGateway.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "display_name" => $this->getDisplayName(), "logo_url" => $this->getLogoUrl(), diff --git a/src/NativeAPMTransactionDetailsInvoice.php b/src/NativeAPMTransactionDetailsInvoice.php index dc5fc3c..db1e962 100755 --- a/src/NativeAPMTransactionDetailsInvoice.php +++ b/src/NativeAPMTransactionDetailsInvoice.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "amount" => $this->getAmount(), "currency_code" => $this->getCurrencyCode(), diff --git a/src/Networking/Request.php b/src/Networking/Request.php index 78d290a..1c8395e 100644 --- a/src/Networking/Request.php +++ b/src/Networking/Request.php @@ -27,11 +27,11 @@ public function __construct(ProcessOut $client) */ protected function prepare($options, $len = null) { - $request = curl_init(); + $request = curl_init(); $headers = array( 'API-Version: 1.4.0.0', 'Content-Type: application/json', - 'User-Agent: ProcessOut PHP-Bindings/7.4.0' + 'User-Agent: ProcessOut PHP-Bindings/8.0.0' ); if (! empty($options['idempotencyKey'])) $headers[] = 'Idempotency-Key: ' . $options['idempotencyKey']; @@ -39,16 +39,16 @@ protected function prepare($options, $len = null) $headers[] = 'Disable-Logging' . $options['disableLogging'] ? 'true' : ''; if ($len != null) $headers[] = 'Content-Length' . ((string) $len); - + curl_setopt($request, CURLOPT_USERPWD, $this->client->getProjectID().':'. $this->client->getProjectSecret()); - curl_setopt($request, CURLOPT_HTTPHEADER, $headers); + curl_setopt($request, CURLOPT_HTTPHEADER, $headers); curl_setopt($request, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); curl_setopt($request, CURLOPT_TIMEOUT, 65); - curl_setopt($request, CURLOPT_MAXREDIRS, 4); - curl_setopt($request, CURLOPT_RETURNTRANSFER, true); - curl_setopt($request, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($request, CURLOPT_MAXREDIRS, 4); + curl_setopt($request, CURLOPT_RETURNTRANSFER, true); + curl_setopt($request, CURLOPT_FOLLOWLOCATION, true); return $request; } @@ -110,14 +110,13 @@ public function get($path, $data, $options) { $req = $this->prepare($options); curl_setopt($req, CURLOPT_URL, $this->client->getHost() . $path . '?' . - $this->httpBuildQuery($this->getData($data, $options))); - $r = curl_exec($req); + $this->httpBuildQuery($this->getData($data, $options))); + $r = curl_exec($req); if (!$r) throw new \Exception('curl exception: '.curl_error($req). ', code: '.curl_errno($req)); - $status = curl_getinfo($req, CURLINFO_HTTP_CODE); - curl_close($req); + $status = curl_getinfo($req, CURLINFO_HTTP_CODE); return new Response($r, $status); } @@ -137,14 +136,13 @@ public function post($path, $data, $options) curl_setopt($req, CURLOPT_POST, true); curl_setopt($req, CURLOPT_POSTFIELDS, $body); - curl_setopt($req, CURLOPT_URL, $this->client->getHost() . $path); - $r = curl_exec($req); + curl_setopt($req, CURLOPT_URL, $this->client->getHost() . $path); + $r = curl_exec($req); if (!$r) throw new \Exception('curl exception: '.curl_error($req). ', code: '.curl_errno($req)); - $status = curl_getinfo($req, CURLINFO_HTTP_CODE); - curl_close($req); + $status = curl_getinfo($req, CURLINFO_HTTP_CODE); return new Response($r, $status); } @@ -164,14 +162,13 @@ public function put($path, $data, $options) curl_setopt($req, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($req, CURLOPT_POSTFIELDS, $body); - curl_setopt($req, CURLOPT_URL, $this->client->getHost() . $path); - $r = curl_exec($req); + curl_setopt($req, CURLOPT_URL, $this->client->getHost() . $path); + $r = curl_exec($req); if (!$r) throw new \Exception('curl exception: '.curl_error($req). ', code: '.curl_errno($req)); - $status = curl_getinfo($req, CURLINFO_HTTP_CODE); - curl_close($req); + $status = curl_getinfo($req, CURLINFO_HTTP_CODE); return new Response($r, $status); } @@ -188,14 +185,13 @@ public function delete($path, $data, $options) $req = $this->prepare($options); curl_setopt($req, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($req, CURLOPT_URL, $this->client->getHost() . $path . '?' . - http_build_query($this->getData($data, $options))); - $r = curl_exec($req); + http_build_query($this->getData($data, $options))); + $r = curl_exec($req); if (!$r) throw new \Exception('curl exception: '.curl_error($req). ', code: '.curl_errno($req)); - $status = curl_getinfo($req, CURLINFO_HTTP_CODE); - curl_close($req); + $status = curl_getinfo($req, CURLINFO_HTTP_CODE); return new Response($r, $status); } diff --git a/src/PaymentDataNetworkAuthentication.php b/src/PaymentDataNetworkAuthentication.php index 64f3e16..1d0c292 100755 --- a/src/PaymentDataNetworkAuthentication.php +++ b/src/PaymentDataNetworkAuthentication.php @@ -73,9 +73,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "cavv" => $this->getCavv(), ); diff --git a/src/PaymentDataThreeDSAuthentication.php b/src/PaymentDataThreeDSAuthentication.php index 6e2017e..610e1b6 100755 --- a/src/PaymentDataThreeDSAuthentication.php +++ b/src/PaymentDataThreeDSAuthentication.php @@ -73,9 +73,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "XID" => $this->getXID(), ); diff --git a/src/PaymentDataThreeDSRequest.php b/src/PaymentDataThreeDSRequest.php index b115a67..8392a01 100755 --- a/src/PaymentDataThreeDSRequest.php +++ b/src/PaymentDataThreeDSRequest.php @@ -166,9 +166,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "acs_url" => $this->getAcsUrl(), "pareq" => $this->getPareq(), diff --git a/src/Payout.php b/src/Payout.php index 02ebe18..9ef7e98 100755 --- a/src/Payout.php +++ b/src/Payout.php @@ -669,9 +669,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), diff --git a/src/PayoutItem.php b/src/PayoutItem.php index 2bbbc52..f1b8b48 100755 --- a/src/PayoutItem.php +++ b/src/PayoutItem.php @@ -504,9 +504,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), diff --git a/src/PayoutItemAmountBreakdowns.php b/src/PayoutItemAmountBreakdowns.php index a34423f..6aee29f 100755 --- a/src/PayoutItemAmountBreakdowns.php +++ b/src/PayoutItemAmountBreakdowns.php @@ -228,9 +228,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "scheme_fee" => $this->getSchemeFee(), "interchange_fee" => $this->getInterchangeFee(), diff --git a/src/Phone.php b/src/Phone.php index 94c770b..a3bfe98 100755 --- a/src/Phone.php +++ b/src/Phone.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "number" => $this->getNumber(), "dialing_code" => $this->getDialingCode(), diff --git a/src/Plan.php b/src/Plan.php deleted file mode 100755 index 37ce238..0000000 --- a/src/Plan.php +++ /dev/null @@ -1,669 +0,0 @@ -client = $client; - - $this->fillWithData($prefill); - } - - - /** - * Get Id - * ID of the plan - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Set Id - * ID of the plan - * @param string $value - * @return $this - */ - public function setId($value) - { - $this->id = $value; - return $this; - } - - /** - * Get Project - * Project to which the plan belongs - * @return object - */ - public function getProject() - { - return $this->project; - } - - /** - * Set Project - * Project to which the plan belongs - * @param object $value - * @return $this - */ - public function setProject($value) - { - if (is_object($value)) - $this->project = $value; - else - { - $obj = new Project($this->client); - $obj->fillWithData($value); - $this->project = $obj; - } - return $this; - } - - /** - * Get ProjectId - * ID of the project to which the plan belongs - * @return string - */ - public function getProjectId() - { - return $this->projectId; - } - - /** - * Set ProjectId - * ID of the project to which the plan belongs - * @param string $value - * @return $this - */ - public function setProjectId($value) - { - $this->projectId = $value; - return $this; - } - - /** - * Get Url - * URL to which you may redirect your customer to activate the subscription plan - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Set Url - * URL to which you may redirect your customer to activate the subscription plan - * @param string $value - * @return $this - */ - public function setUrl($value) - { - $this->url = $value; - return $this; - } - - /** - * Get Name - * Name of the plan - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set Name - * Name of the plan - * @param string $value - * @return $this - */ - public function setName($value) - { - $this->name = $value; - return $this; - } - - /** - * Get Amount - * Amount of the plan - * @return string - */ - public function getAmount() - { - return $this->amount; - } - - /** - * Set Amount - * Amount of the plan - * @param string $value - * @return $this - */ - public function setAmount($value) - { - $this->amount = $value; - return $this; - } - - /** - * Get Currency - * Currency of the plan - * @return string - */ - public function getCurrency() - { - return $this->currency; - } - - /** - * Set Currency - * Currency of the plan - * @param string $value - * @return $this - */ - public function setCurrency($value) - { - $this->currency = $value; - return $this; - } - - /** - * Get Metadata - * Metadata related to the plan, in the form of a dictionary (key-value pair) - * @return array - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * Set Metadata - * Metadata related to the plan, in the form of a dictionary (key-value pair) - * @param array $value - * @return $this - */ - public function setMetadata($value) - { - $this->metadata = $value; - return $this; - } - - /** - * Get Interval - * The plan interval, formatted in the format "1d2w3m4y" (day, week, month, year) - * @return string - */ - public function getInterval() - { - return $this->interval; - } - - /** - * Set Interval - * The plan interval, formatted in the format "1d2w3m4y" (day, week, month, year) - * @param string $value - * @return $this - */ - public function setInterval($value) - { - $this->interval = $value; - return $this; - } - - /** - * Get TrialPeriod - * The trial period. The customer will not be charged during this time span. Formatted in the format "1d2w3m4y" (day, week, month, year) - * @return string - */ - public function getTrialPeriod() - { - return $this->trialPeriod; - } - - /** - * Set TrialPeriod - * The trial period. The customer will not be charged during this time span. Formatted in the format "1d2w3m4y" (day, week, month, year) - * @param string $value - * @return $this - */ - public function setTrialPeriod($value) - { - $this->trialPeriod = $value; - return $this; - } - - /** - * Get ReturnUrl - * URL where the customer will be redirected when activating the subscription created using this plan - * @return string - */ - public function getReturnUrl() - { - return $this->returnUrl; - } - - /** - * Set ReturnUrl - * URL where the customer will be redirected when activating the subscription created using this plan - * @param string $value - * @return $this - */ - public function setReturnUrl($value) - { - $this->returnUrl = $value; - return $this; - } - - /** - * Get CancelUrl - * URL where the customer will be redirected when cancelling the subscription created using this plan - * @return string - */ - public function getCancelUrl() - { - return $this->cancelUrl; - } - - /** - * Set CancelUrl - * URL where the customer will be redirected when cancelling the subscription created using this plan - * @param string $value - * @return $this - */ - public function setCancelUrl($value) - { - $this->cancelUrl = $value; - return $this; - } - - /** - * Get Sandbox - * Define whether or not the plan is in sandbox environment - * @return bool - */ - public function getSandbox() - { - return $this->sandbox; - } - - /** - * Set Sandbox - * Define whether or not the plan is in sandbox environment - * @param bool $value - * @return $this - */ - public function setSandbox($value) - { - $this->sandbox = $value; - return $this; - } - - /** - * Get CreatedAt - * Date at which the plan was created - * @return string - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * Set CreatedAt - * Date at which the plan was created - * @param string $value - * @return $this - */ - public function setCreatedAt($value) - { - $this->createdAt = $value; - return $this; - } - - - /** - * Fills the current object with the new values pulled from the data - * @param array $data - * @return Plan - */ - public function fillWithData($data) - { - if(! empty($data['id'])) - $this->setId($data['id']); - - if(! empty($data['project'])) - $this->setProject($data['project']); - - if(! empty($data['project_id'])) - $this->setProjectId($data['project_id']); - - if(! empty($data['url'])) - $this->setUrl($data['url']); - - if(! empty($data['name'])) - $this->setName($data['name']); - - if(! empty($data['amount'])) - $this->setAmount($data['amount']); - - if(! empty($data['currency'])) - $this->setCurrency($data['currency']); - - if(! empty($data['metadata'])) - $this->setMetadata($data['metadata']); - - if(! empty($data['interval'])) - $this->setInterval($data['interval']); - - if(! empty($data['trial_period'])) - $this->setTrialPeriod($data['trial_period']); - - if(! empty($data['return_url'])) - $this->setReturnUrl($data['return_url']); - - if(! empty($data['cancel_url'])) - $this->setCancelUrl($data['cancel_url']); - - if(! empty($data['sandbox'])) - $this->setSandbox($data['sandbox']); - - if(! empty($data['created_at'])) - $this->setCreatedAt($data['created_at']); - - return $this; - } - - /** - * Implements the JsonSerializable interface - * @return object - */ - public function jsonSerialize() { - return array( - "id" => $this->getId(), - "project" => $this->getProject(), - "project_id" => $this->getProjectId(), - "url" => $this->getUrl(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "currency" => $this->getCurrency(), - "metadata" => $this->getMetadata(), - "interval" => $this->getInterval(), - "trial_period" => $this->getTrialPeriod(), - "return_url" => $this->getReturnUrl(), - "cancel_url" => $this->getCancelUrl(), - "sandbox" => $this->getSandbox(), - "created_at" => $this->getCreatedAt(), - ); - } - - - /** - * Get all the plans. - * @param array $options - * @return array - */ - public function all($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/plans"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field plans - $a = array(); - $body = $response->getBody(); - foreach($body['plans'] as $v) - { - $tmp = new Plan($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Plans'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Create a new plan. - * @param array $options - * @return $this - */ - public function create($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/plans"; - - $data = array( - "id" => $this->getId(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "currency" => $this->getCurrency(), - "interval" => $this->getInterval(), - "trial_period" => $this->getTrialPeriod(), - "metadata" => $this->getMetadata(), - "return_url" => $this->getReturnUrl(), - "cancel_url" => $this->getCancelUrl() - ); - - $response = $request->post($path, $data, $options); - $returnValues = array(); - - - // Handling for field plan - $body = $response->getBody(); - if (isset($body['plan'])) { - $body = $body['plan']; - $returnValues['create'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Find a plan by its ID. - * @param string $planId - * @param array $options - * @return $this - */ - public function find($planId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/plans/" . urlencode($planId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field plan - $body = $response->getBody(); - if (isset($body['plan'])) { - $body = $body['plan']; - $returnValues['find'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Save the updated plan attributes. This action won't affect subscriptions already linked to this plan. - * @param array $options - * @return $this - */ - public function save($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/plans/" . urlencode($this->getId()) . ""; - - $data = array( - "name" => $this->getName(), - "trial_period" => $this->getTrialPeriod(), - "metadata" => $this->getMetadata(), - "return_url" => $this->getReturnUrl(), - "cancel_url" => $this->getCancelUrl() - ); - - $response = $request->put($path, $data, $options); - $returnValues = array(); - - - // Handling for field plan - $body = $response->getBody(); - if (isset($body['plan'])) { - $body = $body['plan']; - $returnValues['save'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Delete a plan. Subscriptions linked to this plan won't be affected. - * @param array $options - * @return bool - */ - public function end($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/plans/" . urlencode($this->getId()) . ""; - - $data = array( - - ); - - $response = $request->delete($path, $data, $options); - $returnValues = array(); - - $returnValues['success'] = $response->isSuccess(); - - return array_values($returnValues)[0]; - } - -} diff --git a/src/ProcessOut.php b/src/ProcessOut.php index bdd8ae3..16918c7 100644 --- a/src/ProcessOut.php +++ b/src/ProcessOut.php @@ -73,24 +73,6 @@ public function getProjectSecret() } - /** - * Create a new Activity instance - * @param array|null $prefill array used to prefill the object - * @return Activity - */ - public function newActivity($prefill = array()) { - return new Activity($this, $prefill); - } - - /** - * Create a new Addon instance - * @param array|null $prefill array used to prefill the object - * @return Addon - */ - public function newAddon($prefill = array()) { - return new Addon($this, $prefill); - } - /** * Create a new APIVersion instance * @param array|null $prefill array used to prefill the object @@ -172,15 +154,6 @@ public function newPhone($prefill = array()) { return new Phone($this, $prefill); } - /** - * Create a new Coupon instance - * @param array|null $prefill array used to prefill the object - * @return Coupon - */ - public function newCoupon($prefill = array()) { - return new Coupon($this, $prefill); - } - /** * Create a new Customer instance * @param array|null $prefill array used to prefill the object @@ -208,15 +181,6 @@ public function newToken($prefill = array()) { return new Token($this, $prefill); } - /** - * Create a new Discount instance - * @param array|null $prefill array used to prefill the object - * @return Discount - */ - public function newDiscount($prefill = array()) { - return new Discount($this, $prefill); - } - /** * Create a new Event instance * @param array|null $prefill array used to prefill the object @@ -496,15 +460,6 @@ public function newPayoutItemAmountBreakdowns($prefill = array()) { return new PayoutItemAmountBreakdowns($this, $prefill); } - /** - * Create a new Plan instance - * @param array|null $prefill array used to prefill the object - * @return Plan - */ - public function newPlan($prefill = array()) { - return new Plan($this, $prefill); - } - /** * Create a new Product instance * @param array|null $prefill array used to prefill the object @@ -550,15 +505,6 @@ public function newRefund($prefill = array()) { return new Refund($this, $prefill); } - /** - * Create a new Subscription instance - * @param array|null $prefill array used to prefill the object - * @return Subscription - */ - public function newSubscription($prefill = array()) { - return new Subscription($this, $prefill); - } - /** * Create a new Transaction instance * @param array|null $prefill array used to prefill the object @@ -658,6 +604,24 @@ public function newWebhookEndpoint($prefill = array()) { return new WebhookEndpoint($this, $prefill); } + /** + * Create a new CardUpdateRequest instance + * @param array|null $prefill array used to prefill the object + * @return CardUpdateRequest + */ + public function newCardUpdateRequest($prefill = array()) { + return new CardUpdateRequest($this, $prefill); + } + + /** + * Create a new CardCreateRequest instance + * @param array|null $prefill array used to prefill the object + * @return CardCreateRequest + */ + public function newCardCreateRequest($prefill = array()) { + return new CardCreateRequest($this, $prefill); + } + /** * Create a new Device instance * @param array|null $prefill array used to prefill the object @@ -685,24 +649,6 @@ public function newCardShipping($prefill = array()) { return new CardShipping($this, $prefill); } - /** - * Create a new CardUpdateRequest instance - * @param array|null $prefill array used to prefill the object - * @return CardUpdateRequest - */ - public function newCardUpdateRequest($prefill = array()) { - return new CardUpdateRequest($this, $prefill); - } - - /** - * Create a new CardCreateRequest instance - * @param array|null $prefill array used to prefill the object - * @return CardCreateRequest - */ - public function newCardCreateRequest($prefill = array()) { - return new CardCreateRequest($this, $prefill); - } - /** * Create a new ErrorCodes instance * @param array|null $prefill array used to prefill the object diff --git a/src/Product.php b/src/Product.php index ac012c3..6448d49 100755 --- a/src/Product.php +++ b/src/Product.php @@ -421,9 +421,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), diff --git a/src/Project.php b/src/Project.php index 8c3c9de..c0228d9 100755 --- a/src/Project.php +++ b/src/Project.php @@ -409,9 +409,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "supervisor_project" => $this->getSupervisorProject(), @@ -512,73 +512,4 @@ public function delete($options = array()) return array_values($returnValues)[0]; } - /** - * Get all the supervised projects. - * @param array $options - * @return array - */ - public function fetchSupervised($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/supervised-projects"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field projects - $a = array(); - $body = $response->getBody(); - foreach($body['projects'] as $v) - { - $tmp = new Project($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Projects'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Create a new supervised project. - * @param array $options - * @return $this - */ - public function createSupervised($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/supervised-projects"; - - $data = array( - "id" => $this->getId(), - "name" => $this->getName(), - "default_currency" => $this->getDefaultCurrency(), - "dunning_configuration" => $this->getDunningConfiguration(), - "applepay_settings" => (!empty($options["applepay_settings"])) ? $options["applepay_settings"] : null, - "public_metadata" => (!empty($options["public_metadata"])) ? $options["public_metadata"] : null - ); - - $response = $request->post($path, $data, $options); - $returnValues = array(); - - - // Handling for field project - $body = $response->getBody(); - if (isset($body['project'])) { - $body = $body['project']; - $returnValues['createSupervised'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - } diff --git a/src/ProjectSFTPSettings.php b/src/ProjectSFTPSettings.php index 3ec66c6..26487ab 100755 --- a/src/ProjectSFTPSettings.php +++ b/src/ProjectSFTPSettings.php @@ -166,9 +166,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "endpoint" => $this->getEndpoint(), "username" => $this->getUsername(), diff --git a/src/ProjectSFTPSettingsPublic.php b/src/ProjectSFTPSettingsPublic.php index 50d2d72..e873542 100755 --- a/src/ProjectSFTPSettingsPublic.php +++ b/src/ProjectSFTPSettingsPublic.php @@ -135,9 +135,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "enabled" => $this->getEnabled(), "endpoint" => $this->getEndpoint(), diff --git a/src/Refund.php b/src/Refund.php index 617890d..7ca5af2 100755 --- a/src/Refund.php +++ b/src/Refund.php @@ -390,9 +390,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "transaction" => $this->getTransaction(), @@ -427,6 +427,7 @@ public function createForInvoice($invoiceId, $options = array()) "reason" => $this->getReason(), "information" => $this->getInformation(), "invoice_detail_ids" => $this->getInvoiceDetailIds(), + "split_allocations" => $this->getSplitAllocations(), "metadata" => (!empty($options["metadata"])) ? $options["metadata"] : null ); @@ -522,6 +523,7 @@ public function create($options = array()) "reason" => $this->getReason(), "information" => $this->getInformation(), "invoice_detail_ids" => $this->getInvoiceDetailIds(), + "split_allocations" => $this->getSplitAllocations(), "metadata" => (!empty($options["metadata"])) ? $options["metadata"] : null ); diff --git a/src/SubmerchantAddress.php b/src/SubmerchantAddress.php index c77cab9..a960686 100755 --- a/src/SubmerchantAddress.php +++ b/src/SubmerchantAddress.php @@ -259,9 +259,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "line1" => $this->getLine1(), "line2" => $this->getLine2(), diff --git a/src/SubmerchantPhoneNumber.php b/src/SubmerchantPhoneNumber.php index 5ae53f3..14627bc 100755 --- a/src/SubmerchantPhoneNumber.php +++ b/src/SubmerchantPhoneNumber.php @@ -104,9 +104,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "dialing_code" => $this->getDialingCode(), "number" => $this->getNumber(), diff --git a/src/Subscription.php b/src/Subscription.php deleted file mode 100755 index eb563bd..0000000 --- a/src/Subscription.php +++ /dev/null @@ -1,1668 +0,0 @@ -client = $client; - - $this->fillWithData($prefill); - } - - - /** - * Get Id - * ID of the subscription - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Set Id - * ID of the subscription - * @param string $value - * @return $this - */ - public function setId($value) - { - $this->id = $value; - return $this; - } - - /** - * Get Project - * Project to which the subscription belongs - * @return object - */ - public function getProject() - { - return $this->project; - } - - /** - * Set Project - * Project to which the subscription belongs - * @param object $value - * @return $this - */ - public function setProject($value) - { - if (is_object($value)) - $this->project = $value; - else - { - $obj = new Project($this->client); - $obj->fillWithData($value); - $this->project = $obj; - } - return $this; - } - - /** - * Get ProjectId - * ID of the project to which the subscription belongs - * @return string - */ - public function getProjectId() - { - return $this->projectId; - } - - /** - * Set ProjectId - * ID of the project to which the subscription belongs - * @param string $value - * @return $this - */ - public function setProjectId($value) - { - $this->projectId = $value; - return $this; - } - - /** - * Get Plan - * Plan linked to this subscription, if any - * @return object - */ - public function getPlan() - { - return $this->plan; - } - - /** - * Set Plan - * Plan linked to this subscription, if any - * @param object $value - * @return $this - */ - public function setPlan($value) - { - if (is_object($value)) - $this->plan = $value; - else - { - $obj = new Plan($this->client); - $obj->fillWithData($value); - $this->plan = $obj; - } - return $this; - } - - /** - * Get PlanId - * ID of the plan linked to this subscription, if any - * @return string - */ - public function getPlanId() - { - return $this->planId; - } - - /** - * Set PlanId - * ID of the plan linked to this subscription, if any - * @param string $value - * @return $this - */ - public function setPlanId($value) - { - $this->planId = $value; - return $this; - } - - /** - * Get Discounts - * List of the subscription discounts - * @return array - */ - public function getDiscounts() - { - return $this->discounts; - } - - /** - * Set Discounts - * List of the subscription discounts - * @param array $value - * @return $this - */ - public function setDiscounts($value) - { - if (count($value) > 0 && is_object($value[0])) - $this->discounts = $value; - else - { - $a = array(); - foreach ($value as $v) - { - $obj = new Discount($this->client); - $obj->fillWithData($v); - $a[] = $obj; - } - $this->discounts = $a; - } - return $this; - } - - /** - * Get Addons - * List of the subscription addons - * @return array - */ - public function getAddons() - { - return $this->addons; - } - - /** - * Set Addons - * List of the subscription addons - * @param array $value - * @return $this - */ - public function setAddons($value) - { - if (count($value) > 0 && is_object($value[0])) - $this->addons = $value; - else - { - $a = array(); - foreach ($value as $v) - { - $obj = new Addon($this->client); - $obj->fillWithData($v); - $a[] = $obj; - } - $this->addons = $a; - } - return $this; - } - - /** - * Get Transactions - * List of the subscription transactions - * @return array - */ - public function getTransactions() - { - return $this->transactions; - } - - /** - * Set Transactions - * List of the subscription transactions - * @param array $value - * @return $this - */ - public function setTransactions($value) - { - if (count($value) > 0 && is_object($value[0])) - $this->transactions = $value; - else - { - $a = array(); - foreach ($value as $v) - { - $obj = new Transaction($this->client); - $obj->fillWithData($v); - $a[] = $obj; - } - $this->transactions = $a; - } - return $this; - } - - /** - * Get Customer - * Customer linked to the subscription - * @return object - */ - public function getCustomer() - { - return $this->customer; - } - - /** - * Set Customer - * Customer linked to the subscription - * @param object $value - * @return $this - */ - public function setCustomer($value) - { - if (is_object($value)) - $this->customer = $value; - else - { - $obj = new Customer($this->client); - $obj->fillWithData($value); - $this->customer = $obj; - } - return $this; - } - - /** - * Get CustomerId - * ID of the customer linked to the subscription - * @return string - */ - public function getCustomerId() - { - return $this->customerId; - } - - /** - * Set CustomerId - * ID of the customer linked to the subscription - * @param string $value - * @return $this - */ - public function setCustomerId($value) - { - $this->customerId = $value; - return $this; - } - - /** - * Get Token - * Token used to capture payments on this subscription - * @return object - */ - public function getToken() - { - return $this->token; - } - - /** - * Set Token - * Token used to capture payments on this subscription - * @param object $value - * @return $this - */ - public function setToken($value) - { - if (is_object($value)) - $this->token = $value; - else - { - $obj = new Token($this->client); - $obj->fillWithData($value); - $this->token = $obj; - } - return $this; - } - - /** - * Get TokenId - * ID of the token used to capture payments on this subscription - * @return string - */ - public function getTokenId() - { - return $this->tokenId; - } - - /** - * Set TokenId - * ID of the token used to capture payments on this subscription - * @param string $value - * @return $this - */ - public function setTokenId($value) - { - $this->tokenId = $value; - return $this; - } - - /** - * Get Url - * URL to which you may redirect your customer to activate the subscription - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Set Url - * URL to which you may redirect your customer to activate the subscription - * @param string $value - * @return $this - */ - public function setUrl($value) - { - $this->url = $value; - return $this; - } - - /** - * Get Name - * Name of the subscription - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Set Name - * Name of the subscription - * @param string $value - * @return $this - */ - public function setName($value) - { - $this->name = $value; - return $this; - } - - /** - * Get Amount - * Base amount of the subscription - * @return string - */ - public function getAmount() - { - return $this->amount; - } - - /** - * Set Amount - * Base amount of the subscription - * @param string $value - * @return $this - */ - public function setAmount($value) - { - $this->amount = $value; - return $this; - } - - /** - * Get BillableAmount - * Amount to be paid at each billing cycle of the subscription - * @return string - */ - public function getBillableAmount() - { - return $this->billableAmount; - } - - /** - * Set BillableAmount - * Amount to be paid at each billing cycle of the subscription - * @param string $value - * @return $this - */ - public function setBillableAmount($value) - { - $this->billableAmount = $value; - return $this; - } - - /** - * Get DiscountedAmount - * Amount discounted by discounts applied to the subscription - * @return string - */ - public function getDiscountedAmount() - { - return $this->discountedAmount; - } - - /** - * Set DiscountedAmount - * Amount discounted by discounts applied to the subscription - * @param string $value - * @return $this - */ - public function setDiscountedAmount($value) - { - $this->discountedAmount = $value; - return $this; - } - - /** - * Get AddonsAmount - * Amount applied on top of the subscription base price with addons - * @return string - */ - public function getAddonsAmount() - { - return $this->addonsAmount; - } - - /** - * Set AddonsAmount - * Amount applied on top of the subscription base price with addons - * @param string $value - * @return $this - */ - public function setAddonsAmount($value) - { - $this->addonsAmount = $value; - return $this; - } - - /** - * Get Currency - * Currency of the subscription - * @return string - */ - public function getCurrency() - { - return $this->currency; - } - - /** - * Set Currency - * Currency of the subscription - * @param string $value - * @return $this - */ - public function setCurrency($value) - { - $this->currency = $value; - return $this; - } - - /** - * Get Metadata - * Metadata related to the subscription, in the form of a dictionary (key-value pair) - * @return array - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * Set Metadata - * Metadata related to the subscription, in the form of a dictionary (key-value pair) - * @param array $value - * @return $this - */ - public function setMetadata($value) - { - $this->metadata = $value; - return $this; - } - - /** - * Get Interval - * The subscription interval, formatted in the format "1d2w3m4y" (day, week, month, year) - * @return string - */ - public function getInterval() - { - return $this->interval; - } - - /** - * Set Interval - * The subscription interval, formatted in the format "1d2w3m4y" (day, week, month, year) - * @param string $value - * @return $this - */ - public function setInterval($value) - { - $this->interval = $value; - return $this; - } - - /** - * Get TrialEndAt - * Date at which the subscription trial should end. Can be null to set no trial - * @return string - */ - public function getTrialEndAt() - { - return $this->trialEndAt; - } - - /** - * Set TrialEndAt - * Date at which the subscription trial should end. Can be null to set no trial - * @param string $value - * @return $this - */ - public function setTrialEndAt($value) - { - $this->trialEndAt = $value; - return $this; - } - - /** - * Get Activated - * Whether or not the subscription was activated. This field does not take into account whether or not the subscription was canceled. Use the active field to know if the subscription is currently active - * @return bool - */ - public function getActivated() - { - return $this->activated; - } - - /** - * Set Activated - * Whether or not the subscription was activated. This field does not take into account whether or not the subscription was canceled. Use the active field to know if the subscription is currently active - * @param bool $value - * @return $this - */ - public function setActivated($value) - { - $this->activated = $value; - return $this; - } - - /** - * Get Active - * Whether or not the subscription is currently active (ie activated and not cancelled) - * @return bool - */ - public function getActive() - { - return $this->active; - } - - /** - * Set Active - * Whether or not the subscription is currently active (ie activated and not cancelled) - * @param bool $value - * @return $this - */ - public function setActive($value) - { - $this->active = $value; - return $this; - } - - /** - * Get CancelAt - * Date at which the subscription will automatically be canceled. Can be null - * @return string - */ - public function getCancelAt() - { - return $this->cancelAt; - } - - /** - * Set CancelAt - * Date at which the subscription will automatically be canceled. Can be null - * @param string $value - * @return $this - */ - public function setCancelAt($value) - { - $this->cancelAt = $value; - return $this; - } - - /** - * Get Canceled - * Whether or not the subscription was canceled. The cancellation reason can be found in the cancellation_reason field - * @return bool - */ - public function getCanceled() - { - return $this->canceled; - } - - /** - * Set Canceled - * Whether or not the subscription was canceled. The cancellation reason can be found in the cancellation_reason field - * @param bool $value - * @return $this - */ - public function setCanceled($value) - { - $this->canceled = $value; - return $this; - } - - /** - * Get CancellationReason - * Reason as to why the subscription was cancelled - * @return string - */ - public function getCancellationReason() - { - return $this->cancellationReason; - } - - /** - * Set CancellationReason - * Reason as to why the subscription was cancelled - * @param string $value - * @return $this - */ - public function setCancellationReason($value) - { - $this->cancellationReason = $value; - return $this; - } - - /** - * Get PendingCancellation - * Whether or not the subscription is pending cancellation (meaning a cancel_at date was set) - * @return bool - */ - public function getPendingCancellation() - { - return $this->pendingCancellation; - } - - /** - * Set PendingCancellation - * Whether or not the subscription is pending cancellation (meaning a cancel_at date was set) - * @param bool $value - * @return $this - */ - public function setPendingCancellation($value) - { - $this->pendingCancellation = $value; - return $this; - } - - /** - * Get ReturnUrl - * URL where the customer will be redirected upon activation of the subscription - * @return string - */ - public function getReturnUrl() - { - return $this->returnUrl; - } - - /** - * Set ReturnUrl - * URL where the customer will be redirected upon activation of the subscription - * @param string $value - * @return $this - */ - public function setReturnUrl($value) - { - $this->returnUrl = $value; - return $this; - } - - /** - * Get CancelUrl - * URL where the customer will be redirected if the subscription activation was canceled - * @return string - */ - public function getCancelUrl() - { - return $this->cancelUrl; - } - - /** - * Set CancelUrl - * URL where the customer will be redirected if the subscription activation was canceled - * @param string $value - * @return $this - */ - public function setCancelUrl($value) - { - $this->cancelUrl = $value; - return $this; - } - - /** - * Get UnpaidState - * When the subscription has unpaid invoices, defines the dunning logic of the subscription (as specified in the project settings) - * @return string - */ - public function getUnpaidState() - { - return $this->unpaidState; - } - - /** - * Set UnpaidState - * When the subscription has unpaid invoices, defines the dunning logic of the subscription (as specified in the project settings) - * @param string $value - * @return $this - */ - public function setUnpaidState($value) - { - $this->unpaidState = $value; - return $this; - } - - /** - * Get Sandbox - * Define whether or not the subscription is in sandbox environment - * @return bool - */ - public function getSandbox() - { - return $this->sandbox; - } - - /** - * Set Sandbox - * Define whether or not the subscription is in sandbox environment - * @param bool $value - * @return $this - */ - public function setSandbox($value) - { - $this->sandbox = $value; - return $this; - } - - /** - * Get CreatedAt - * Date at which the subscription was created - * @return string - */ - public function getCreatedAt() - { - return $this->createdAt; - } - - /** - * Set CreatedAt - * Date at which the subscription was created - * @param string $value - * @return $this - */ - public function setCreatedAt($value) - { - $this->createdAt = $value; - return $this; - } - - /** - * Get ActivatedAt - * Date at which the subscription was activated. Null if the subscription hasn't been activated yet - * @return string - */ - public function getActivatedAt() - { - return $this->activatedAt; - } - - /** - * Set ActivatedAt - * Date at which the subscription was activated. Null if the subscription hasn't been activated yet - * @param string $value - * @return $this - */ - public function setActivatedAt($value) - { - $this->activatedAt = $value; - return $this; - } - - /** - * Get IterateAt - * Next iteration date, corresponding to the next billing cycle start date - * @return string - */ - public function getIterateAt() - { - return $this->iterateAt; - } - - /** - * Set IterateAt - * Next iteration date, corresponding to the next billing cycle start date - * @param string $value - * @return $this - */ - public function setIterateAt($value) - { - $this->iterateAt = $value; - return $this; - } - - - /** - * Fills the current object with the new values pulled from the data - * @param array $data - * @return Subscription - */ - public function fillWithData($data) - { - if(! empty($data['id'])) - $this->setId($data['id']); - - if(! empty($data['project'])) - $this->setProject($data['project']); - - if(! empty($data['project_id'])) - $this->setProjectId($data['project_id']); - - if(! empty($data['plan'])) - $this->setPlan($data['plan']); - - if(! empty($data['plan_id'])) - $this->setPlanId($data['plan_id']); - - if(! empty($data['discounts'])) - $this->setDiscounts($data['discounts']); - - if(! empty($data['addons'])) - $this->setAddons($data['addons']); - - if(! empty($data['transactions'])) - $this->setTransactions($data['transactions']); - - if(! empty($data['customer'])) - $this->setCustomer($data['customer']); - - if(! empty($data['customer_id'])) - $this->setCustomerId($data['customer_id']); - - if(! empty($data['token'])) - $this->setToken($data['token']); - - if(! empty($data['token_id'])) - $this->setTokenId($data['token_id']); - - if(! empty($data['url'])) - $this->setUrl($data['url']); - - if(! empty($data['name'])) - $this->setName($data['name']); - - if(! empty($data['amount'])) - $this->setAmount($data['amount']); - - if(! empty($data['billable_amount'])) - $this->setBillableAmount($data['billable_amount']); - - if(! empty($data['discounted_amount'])) - $this->setDiscountedAmount($data['discounted_amount']); - - if(! empty($data['addons_amount'])) - $this->setAddonsAmount($data['addons_amount']); - - if(! empty($data['currency'])) - $this->setCurrency($data['currency']); - - if(! empty($data['metadata'])) - $this->setMetadata($data['metadata']); - - if(! empty($data['interval'])) - $this->setInterval($data['interval']); - - if(! empty($data['trial_end_at'])) - $this->setTrialEndAt($data['trial_end_at']); - - if(! empty($data['activated'])) - $this->setActivated($data['activated']); - - if(! empty($data['active'])) - $this->setActive($data['active']); - - if(! empty($data['cancel_at'])) - $this->setCancelAt($data['cancel_at']); - - if(! empty($data['canceled'])) - $this->setCanceled($data['canceled']); - - if(! empty($data['cancellation_reason'])) - $this->setCancellationReason($data['cancellation_reason']); - - if(! empty($data['pending_cancellation'])) - $this->setPendingCancellation($data['pending_cancellation']); - - if(! empty($data['return_url'])) - $this->setReturnUrl($data['return_url']); - - if(! empty($data['cancel_url'])) - $this->setCancelUrl($data['cancel_url']); - - if(! empty($data['unpaid_state'])) - $this->setUnpaidState($data['unpaid_state']); - - if(! empty($data['sandbox'])) - $this->setSandbox($data['sandbox']); - - if(! empty($data['created_at'])) - $this->setCreatedAt($data['created_at']); - - if(! empty($data['activated_at'])) - $this->setActivatedAt($data['activated_at']); - - if(! empty($data['iterate_at'])) - $this->setIterateAt($data['iterate_at']); - - return $this; - } - - /** - * Implements the JsonSerializable interface - * @return object - */ - public function jsonSerialize() { - return array( - "id" => $this->getId(), - "project" => $this->getProject(), - "project_id" => $this->getProjectId(), - "plan" => $this->getPlan(), - "plan_id" => $this->getPlanId(), - "discounts" => $this->getDiscounts(), - "addons" => $this->getAddons(), - "transactions" => $this->getTransactions(), - "customer" => $this->getCustomer(), - "customer_id" => $this->getCustomerId(), - "token" => $this->getToken(), - "token_id" => $this->getTokenId(), - "url" => $this->getUrl(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "billable_amount" => $this->getBillableAmount(), - "discounted_amount" => $this->getDiscountedAmount(), - "addons_amount" => $this->getAddonsAmount(), - "currency" => $this->getCurrency(), - "metadata" => $this->getMetadata(), - "interval" => $this->getInterval(), - "trial_end_at" => $this->getTrialEndAt(), - "activated" => $this->getActivated(), - "active" => $this->getActive(), - "cancel_at" => $this->getCancelAt(), - "canceled" => $this->getCanceled(), - "cancellation_reason" => $this->getCancellationReason(), - "pending_cancellation" => $this->getPendingCancellation(), - "return_url" => $this->getReturnUrl(), - "cancel_url" => $this->getCancelUrl(), - "unpaid_state" => $this->getUnpaidState(), - "sandbox" => $this->getSandbox(), - "created_at" => $this->getCreatedAt(), - "activated_at" => $this->getActivatedAt(), - "iterate_at" => $this->getIterateAt(), - ); - } - - - /** - * Get the addons applied to the subscription. - * @param array $options - * @return array - */ - public function fetchAddons($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/addons"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field addons - $a = array(); - $body = $response->getBody(); - foreach($body['addons'] as $v) - { - $tmp = new Addon($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Addons'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Find a subscription's addon by its ID. - * @param string $addonId - * @param array $options - * @return Addon - */ - public function findAddon($addonId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/addons/" . urlencode($addonId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field addon - $body = $response->getBody(); - if (isset($body['addon'])) { - $body = $body['addon']; - $addon = new Addon($this->client); - $returnValues['addon'] = $addon->fillWithData($body); - } - - - return array_values($returnValues)[0]; - } - - /** - * Delete an addon applied to a subscription. - * @param string $addonId - * @param array $options - * @return bool - */ - public function deleteAddon($addonId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/addons/" . urlencode($addonId) . ""; - - $data = array( - "prorate" => (!empty($options["prorate"])) ? $options["prorate"] : null, - "proration_date" => (!empty($options["proration_date"])) ? $options["proration_date"] : null, - "preview" => (!empty($options["preview"])) ? $options["preview"] : null - ); - - $response = $request->delete($path, $data, $options); - $returnValues = array(); - - $returnValues['success'] = $response->isSuccess(); - - return array_values($returnValues)[0]; - } - - /** - * Get the customer owning the subscription. - * @param array $options - * @return Customer - */ - public function fetchCustomer($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/customers"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field customer - $body = $response->getBody(); - if (isset($body['customer'])) { - $body = $body['customer']; - $customer = new Customer($this->client); - $returnValues['customer'] = $customer->fillWithData($body); - } - - - return array_values($returnValues)[0]; - } - - /** - * Get the discounts applied to the subscription. - * @param array $options - * @return array - */ - public function fetchDiscounts($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/discounts"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field discounts - $a = array(); - $body = $response->getBody(); - foreach($body['discounts'] as $v) - { - $tmp = new Discount($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Discounts'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Find a subscription's discount by its ID. - * @param string $discountId - * @param array $options - * @return Discount - */ - public function findDiscount($discountId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/discounts/" . urlencode($discountId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field discount - $body = $response->getBody(); - if (isset($body['discount'])) { - $body = $body['discount']; - $discount = new Discount($this->client); - $returnValues['discount'] = $discount->fillWithData($body); - } - - - return array_values($returnValues)[0]; - } - - /** - * Delete a discount applied to a subscription. - * @param string $discountId - * @param array $options - * @return bool - */ - public function deleteDiscount($discountId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/discounts/" . urlencode($discountId) . ""; - - $data = array( - - ); - - $response = $request->delete($path, $data, $options); - $returnValues = array(); - - $returnValues['success'] = $response->isSuccess(); - - return array_values($returnValues)[0]; - } - - /** - * Get the subscriptions past transactions. - * @param array $options - * @return array - */ - public function fetchTransactions($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . "/transactions"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field transactions - $a = array(); - $body = $response->getBody(); - foreach($body['transactions'] as $v) - { - $tmp = new Transaction($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Transactions'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Get all the subscriptions. - * @param array $options - * @return array - */ - public function all($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions"; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field subscriptions - $a = array(); - $body = $response->getBody(); - foreach($body['subscriptions'] as $v) - { - $tmp = new Subscription($this->client); - $tmp->fillWithData($v); - $a[] = $tmp; - } - $returnValues['Subscriptions'] = $a; - - return array_values($returnValues)[0]; - } - - /** - * Create a new subscription for the given customer. - * @param array $options - * @return $this - */ - public function create($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions"; - - $data = array( - "plan_id" => $this->getPlanId(), - "cancel_at" => $this->getCancelAt(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "currency" => $this->getCurrency(), - "metadata" => $this->getMetadata(), - "interval" => $this->getInterval(), - "trial_end_at" => $this->getTrialEndAt(), - "customer_id" => $this->getCustomerId(), - "return_url" => $this->getReturnUrl(), - "cancel_url" => $this->getCancelUrl(), - "source" => (!empty($options["source"])) ? $options["source"] : null, - "coupon_id" => (!empty($options["coupon_id"])) ? $options["coupon_id"] : null - ); - - $response = $request->post($path, $data, $options); - $returnValues = array(); - - - // Handling for field subscription - $body = $response->getBody(); - if (isset($body['subscription'])) { - $body = $body['subscription']; - $returnValues['create'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Find a subscription by its ID. - * @param string $subscriptionId - * @param array $options - * @return $this - */ - public function find($subscriptionId, $options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($subscriptionId) . ""; - - $data = array( - - ); - - $response = $request->get($path, $data, $options); - $returnValues = array(); - - - // Handling for field subscription - $body = $response->getBody(); - if (isset($body['subscription'])) { - $body = $body['subscription']; - $returnValues['find'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Save the updated subscription attributes. - * @param array $options - * @return $this - */ - public function save($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . ""; - - $data = array( - "plan_id" => $this->getPlanId(), - "name" => $this->getName(), - "amount" => $this->getAmount(), - "interval" => $this->getInterval(), - "trial_end_at" => $this->getTrialEndAt(), - "metadata" => $this->getMetadata(), - "coupon_id" => (!empty($options["coupon_id"])) ? $options["coupon_id"] : null, - "source" => (!empty($options["source"])) ? $options["source"] : null, - "prorate" => (!empty($options["prorate"])) ? $options["prorate"] : null, - "proration_date" => (!empty($options["proration_date"])) ? $options["proration_date"] : null, - "preview" => (!empty($options["preview"])) ? $options["preview"] : null - ); - - $response = $request->put($path, $data, $options); - $returnValues = array(); - - - // Handling for field subscription - $body = $response->getBody(); - if (isset($body['subscription'])) { - $body = $body['subscription']; - $returnValues['save'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - - /** - * Cancel a subscription. The reason may be provided as well. - * @param array $options - * @return $this - */ - public function cancel($options = array()) - { - $this->fillWithData($options); - - $request = new Request($this->client); - $path = "/subscriptions/" . urlencode($this->getId()) . ""; - - $data = array( - "cancel_at" => $this->getCancelAt(), - "cancellation_reason" => $this->getCancellationReason(), - "cancel_at_end" => (!empty($options["cancel_at_end"])) ? $options["cancel_at_end"] : null - ); - - $response = $request->delete($path, $data, $options); - $returnValues = array(); - - - // Handling for field subscription - $body = $response->getBody(); - if (isset($body['subscription'])) { - $body = $body['subscription']; - $returnValues['cancel'] = $this->fillWithData($body); - } - - return array_values($returnValues)[0]; - } - -} diff --git a/src/ThreeDS.php b/src/ThreeDS.php index 1270564..2c41e2f 100755 --- a/src/ThreeDS.php +++ b/src/ThreeDS.php @@ -321,9 +321,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "version" => $this->getVersion(), "status" => $this->getStatus(), diff --git a/src/Token.php b/src/Token.php index c7d7f0a..fa94b46 100755 --- a/src/Token.php +++ b/src/Token.php @@ -154,6 +154,12 @@ class Token implements \JsonSerializable */ protected $webhookUrl; + /** + * ID of the Vault that customer token resides in + * @var string + */ + protected $vaultId; + /** * Token constructor * @param ProcessOut\ProcessOut $client @@ -701,6 +707,28 @@ public function setWebhookUrl($value) return $this; } + /** + * Get VaultId + * ID of the Vault that customer token resides in + * @return string + */ + public function getVaultId() + { + return $this->vaultId; + } + + /** + * Set VaultId + * ID of the Vault that customer token resides in + * @param string $value + * @return $this + */ + public function setVaultId($value) + { + $this->vaultId = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -778,14 +806,17 @@ public function fillWithData($data) if(! empty($data['webhook_url'])) $this->setWebhookUrl($data['webhook_url']); + if(! empty($data['vault_id'])) + $this->setVaultId($data['vault_id']); + return $this; } /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "customer" => $this->getCustomer(), @@ -810,6 +841,7 @@ public function jsonSerialize() { "verification_status" => $this->getVerificationStatus(), "can_get_balance" => $this->getCanGetBalance(), "webhook_url" => $this->getWebhookUrl(), + "vault_id" => $this->getVaultId(), ); } diff --git a/src/Transaction.php b/src/Transaction.php index 52214c0..f80ed12 100755 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -58,18 +58,6 @@ class Transaction implements \JsonSerializable */ protected $customerId; - /** - * Subscription to which this transaction belongs - * @var object - */ - protected $subscription; - - /** - * ID of the subscription to which the transaction belongs, if any - * @var string - */ - protected $subscriptionId; - /** * Token that was used to capture the payment of the transaction, if any * @var object @@ -418,6 +406,12 @@ class Transaction implements \JsonSerializable */ protected $externalDetails; + /** + * The origin of the transaction, can be either 'api' - processed in the ProcessOut or 'pulling' - processed outside and pulled into the system. + * @var string + */ + protected $origin; + /** * Transaction constructor * @param ProcessOut\ProcessOut $client @@ -606,57 +600,6 @@ public function setCustomerId($value) return $this; } - /** - * Get Subscription - * Subscription to which this transaction belongs - * @return object - */ - public function getSubscription() - { - return $this->subscription; - } - - /** - * Set Subscription - * Subscription to which this transaction belongs - * @param object $value - * @return $this - */ - public function setSubscription($value) - { - if (is_object($value)) - $this->subscription = $value; - else - { - $obj = new Subscription($this->client); - $obj->fillWithData($value); - $this->subscription = $obj; - } - return $this; - } - - /** - * Get SubscriptionId - * ID of the subscription to which the transaction belongs, if any - * @return string - */ - public function getSubscriptionId() - { - return $this->subscriptionId; - } - - /** - * Set SubscriptionId - * ID of the subscription to which the transaction belongs, if any - * @param string $value - * @return $this - */ - public function setSubscriptionId($value) - { - $this->subscriptionId = $value; - return $this; - } - /** * Get Token * Token that was used to capture the payment of the transaction, if any @@ -1999,6 +1942,28 @@ public function setExternalDetails($value) return $this; } + /** + * Get Origin + * The origin of the transaction, can be either 'api' - processed in the ProcessOut or 'pulling' - processed outside and pulled into the system. + * @return string + */ + public function getOrigin() + { + return $this->origin; + } + + /** + * Set Origin + * The origin of the transaction, can be either 'api' - processed in the ProcessOut or 'pulling' - processed outside and pulled into the system. + * @param string $value + * @return $this + */ + public function setOrigin($value) + { + $this->origin = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -2028,12 +1993,6 @@ public function fillWithData($data) if(! empty($data['customer_id'])) $this->setCustomerId($data['customer_id']); - if(! empty($data['subscription'])) - $this->setSubscription($data['subscription']); - - if(! empty($data['subscription_id'])) - $this->setSubscriptionId($data['subscription_id']); - if(! empty($data['token'])) $this->setToken($data['token']); @@ -2208,14 +2167,17 @@ public function fillWithData($data) if(! empty($data['external_details'])) $this->setExternalDetails($data['external_details']); + if(! empty($data['origin'])) + $this->setOrigin($data['origin']); + return $this; } /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), @@ -2224,8 +2186,6 @@ public function jsonSerialize() { "invoice_id" => $this->getInvoiceId(), "customer" => $this->getCustomer(), "customer_id" => $this->getCustomerId(), - "subscription" => $this->getSubscription(), - "subscription_id" => $this->getSubscriptionId(), "token" => $this->getToken(), "token_id" => $this->getTokenId(), "card" => $this->getCard(), @@ -2284,6 +2244,7 @@ public function jsonSerialize() { "eci" => $this->getEci(), "native_apm" => $this->getNativeApm(), "external_details" => $this->getExternalDetails(), + "origin" => $this->getOrigin(), ); } diff --git a/src/TransactionOperation.php b/src/TransactionOperation.php index 5c9efbc..db9d495 100755 --- a/src/TransactionOperation.php +++ b/src/TransactionOperation.php @@ -178,6 +178,12 @@ class TransactionOperation implements \JsonSerializable */ protected $paymentType; + /** + * Capture type of the transaction + * @var string + */ + protected $captureType; + /** * Metadata related to the operation, in the form of a dictionary (key-value pair) * @var dictionary @@ -852,6 +858,28 @@ public function setPaymentType($value) return $this; } + /** + * Get CaptureType + * Capture type of the transaction + * @return string + */ + public function getCaptureType() + { + return $this->captureType; + } + + /** + * Set CaptureType + * Capture type of the transaction + * @param string $value + * @return $this + */ + public function setCaptureType($value) + { + $this->captureType = $value; + return $this; + } + /** * Get Metadata * Metadata related to the operation, in the form of a dictionary (key-value pair) @@ -1007,6 +1035,9 @@ public function fillWithData($data) if(! empty($data['payment_type'])) $this->setPaymentType($data['payment_type']); + if(! empty($data['capture_type'])) + $this->setCaptureType($data['capture_type']); + if(! empty($data['metadata'])) $this->setMetadata($data['metadata']); @@ -1021,9 +1052,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "transaction" => $this->getTransaction(), @@ -1052,6 +1083,7 @@ public function jsonSerialize() { "scheme_id" => $this->getSchemeId(), "processed_with_network_token" => $this->getProcessedWithNetworkToken(), "payment_type" => $this->getPaymentType(), + "capture_type" => $this->getCaptureType(), "metadata" => $this->getMetadata(), "gateway_fee" => $this->getGatewayFee(), "created_at" => $this->getCreatedAt(), diff --git a/src/UnsupportedFeatureBypass.php b/src/UnsupportedFeatureBypass.php index d9267ba..b9fe57d 100755 --- a/src/UnsupportedFeatureBypass.php +++ b/src/UnsupportedFeatureBypass.php @@ -22,6 +22,12 @@ class UnsupportedFeatureBypass implements \JsonSerializable */ protected $incrementalAuthorization; + /** + * Indicates whether to fallback to normal payment if split payments are not supported + * @var boolean + */ + protected $splitPayments; + /** * UnsupportedFeatureBypass constructor * @param ProcessOut\ProcessOut $client @@ -57,6 +63,28 @@ public function setIncrementalAuthorization($value) return $this; } + /** + * Get SplitPayments + * Indicates whether to fallback to normal payment if split payments are not supported + * @return bool + */ + public function getSplitPayments() + { + return $this->splitPayments; + } + + /** + * Set SplitPayments + * Indicates whether to fallback to normal payment if split payments are not supported + * @param bool $value + * @return $this + */ + public function setSplitPayments($value) + { + $this->splitPayments = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -68,16 +96,20 @@ public function fillWithData($data) if(! empty($data['incremental_authorization'])) $this->setIncrementalAuthorization($data['incremental_authorization']); + if(! empty($data['split_payments'])) + $this->setSplitPayments($data['split_payments']); + return $this; } /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "incremental_authorization" => $this->getIncrementalAuthorization(), + "split_payments" => $this->getSplitPayments(), ); } diff --git a/src/Webhook.php b/src/Webhook.php index 1212885..51a875c 100755 --- a/src/Webhook.php +++ b/src/Webhook.php @@ -490,9 +490,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(), diff --git a/src/WebhookEndpoint.php b/src/WebhookEndpoint.php index 623682c..5484f06 100755 --- a/src/WebhookEndpoint.php +++ b/src/WebhookEndpoint.php @@ -266,9 +266,9 @@ public function fillWithData($data) /** * Implements the JsonSerializable interface - * @return object + * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return array( "id" => $this->getId(), "project" => $this->getProject(),