From 8210d4c1e844ed7e37d775197f8075dce5fc8e32 Mon Sep 17 00:00:00 2001 From: ProcessOut Fountain Date: Tue, 17 Sep 2024 05:35:47 -0400 Subject: [PATCH] feat: Add custom action structure to the create token flow --- README.md | 2 +- init.php | 11 +- src/ExportLayout.php | 502 ++++++++++++++++++ src/ExportLayoutConfiguration.php | 175 ++++++ src/ExportLayoutConfigurationAmount.php | 117 ++++ src/ExportLayoutConfigurationColumn.php | 117 ++++ ...onfigurationConfigurationOptionsAmount.php | 117 ++++ ...tConfigurationConfigurationOptionsTime.php | 85 +++ src/ExportLayoutConfigurationOptions.php | 192 +++++++ src/ExportLayoutConfigurationTime.php | 85 +++ src/ExternalThreeDS.php | 277 ++++++++++ src/Invoice.php | 4 + src/Networking/Request.php | 2 +- src/ProcessOut.php | 99 +++- src/Token.php | 10 +- 15 files changed, 1781 insertions(+), 14 deletions(-) create mode 100755 src/ExportLayout.php create mode 100755 src/ExportLayoutConfiguration.php create mode 100755 src/ExportLayoutConfigurationAmount.php create mode 100755 src/ExportLayoutConfigurationColumn.php create mode 100755 src/ExportLayoutConfigurationConfigurationOptionsAmount.php create mode 100755 src/ExportLayoutConfigurationConfigurationOptionsTime.php create mode 100755 src/ExportLayoutConfigurationOptions.php create mode 100755 src/ExportLayoutConfigurationTime.php create mode 100755 src/ExternalThreeDS.php diff --git a/README.md b/README.md index 5595750..23257b5 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The package's installation is done using composer. Simply add these lines to you ```json { "require": { - "processout/processout-php": "^7.0.0" + "processout/processout-php": "^7.1.0" } } ``` diff --git a/init.php b/init.php index 07b22cb..724a87c 100644 --- a/init.php +++ b/init.php @@ -28,6 +28,14 @@ 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"); +include_once(dirname(__FILE__) . "/src/ExportLayoutConfigurationColumn.php"); +include_once(dirname(__FILE__) . "/src/ExportLayoutConfigurationTime.php"); +include_once(dirname(__FILE__) . "/src/ExportLayoutConfigurationAmount.php"); +include_once(dirname(__FILE__) . "/src/ExportLayoutConfigurationOptions.php"); +include_once(dirname(__FILE__) . "/src/ExportLayoutConfigurationConfigurationOptionsTime.php"); +include_once(dirname(__FILE__) . "/src/ExportLayoutConfigurationConfigurationOptionsAmount.php"); include_once(dirname(__FILE__) . "/src/Gateway.php"); include_once(dirname(__FILE__) . "/src/GatewayConfiguration.php"); include_once(dirname(__FILE__) . "/src/Invoice.php"); @@ -72,8 +80,9 @@ include_once(dirname(__FILE__) . "/src/CardUpdateRequest.php"); include_once(dirname(__FILE__) . "/src/ErrorCodes.php"); include_once(dirname(__FILE__) . "/src/CategoryErrorCodes.php"); +include_once(dirname(__FILE__) . "/src/ExternalThreeDS.php"); +include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetails.php"); include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetailsGateway.php"); include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetailsInvoice.php"); -include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetails.php"); include_once(dirname(__FILE__) . "/src/GatewayRequest.php"); diff --git a/src/ExportLayout.php b/src/ExportLayout.php new file mode 100755 index 0000000..658b626 --- /dev/null +++ b/src/ExportLayout.php @@ -0,0 +1,502 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Id + * ID of the export layout + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Set Id + * ID of the export layout + * @param string $value + * @return $this + */ + public function setId($value) + { + $this->id = $value; + return $this; + } + + /** + * Get Project + * Project to which the export layout belongs + * @return object + */ + public function getProject() + { + return $this->project; + } + + /** + * Set Project + * Project to which the export layout 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 export layout belongs + * @return string + */ + public function getProjectId() + { + return $this->projectId; + } + + /** + * Set ProjectId + * ID of the project to which the export layout belongs + * @param string $value + * @return $this + */ + public function setProjectId($value) + { + $this->projectId = $value; + return $this; + } + + /** + * Get CreatedAt + * Date at which the export layout was created + * @return string + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set CreatedAt + * Date at which the export layout was created + * @param string $value + * @return $this + */ + public function setCreatedAt($value) + { + $this->createdAt = $value; + return $this; + } + + /** + * Get Name + * Name of the export layout. + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set Name + * Name of the export layout. + * @param string $value + * @return $this + */ + public function setName($value) + { + $this->name = $value; + return $this; + } + + /** + * Get Type + * Type of the export layout. + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set Type + * Type of the export layout. + * @param string $value + * @return $this + */ + public function setType($value) + { + $this->type = $value; + return $this; + } + + /** + * Get IsDefault + * Whether the export layout is the default one for the project. It will be used for automatic exports. + * @return bool + */ + public function getIsDefault() + { + return $this->isDefault; + } + + /** + * Set IsDefault + * Whether the export layout is the default one for the project. It will be used for automatic exports. + * @param bool $value + * @return $this + */ + public function setIsDefault($value) + { + $this->isDefault = $value; + return $this; + } + + /** + * Get Configuration + * Configuration of the export layout. + * @return object + */ + public function getConfiguration() + { + return $this->configuration; + } + + /** + * Set Configuration + * Configuration of the export layout. + * @param object $value + * @return $this + */ + public function setConfiguration($value) + { + if (is_object($value)) + $this->configuration = $value; + else + { + $obj = new ExportLayoutConfiguration($this->client); + $obj->fillWithData($value); + $this->configuration = $obj; + } + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayout + */ + 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['created_at'])) + $this->setCreatedAt($data['created_at']); + + if(! empty($data['name'])) + $this->setName($data['name']); + + if(! empty($data['type'])) + $this->setType($data['type']); + + if(! empty($data['is_default'])) + $this->setIsDefault($data['is_default']); + + if(! empty($data['configuration'])) + $this->setConfiguration($data['configuration']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "id" => $this->getId(), + "project" => $this->getProject(), + "project_id" => $this->getProjectId(), + "created_at" => $this->getCreatedAt(), + "name" => $this->getName(), + "type" => $this->getType(), + "is_default" => $this->getIsDefault(), + "configuration" => $this->getConfiguration(), + ); + } + + + /** + * Get all the export layouts. + * @param array $options + * @return array + */ + public function all($options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/exports/layouts"; + + $data = array( + + ); + + $response = $request->get($path, $data, $options); + $returnValues = array(); + + + // Handling for field export_layouts + $a = array(); + $body = $response->getBody(); + foreach($body['export_layouts'] as $v) + { + $tmp = new ExportLayout($this->client); + $tmp->fillWithData($v); + $a[] = $tmp; + } + $returnValues['ExportLayouts'] = $a; + + return array_values($returnValues)[0]; + } + + /** + * Find an export layout by its ID. + * @param string $exportLayoutId + * @param array $options + * @return $this + */ + public function find($exportLayoutId, $options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/exports/layouts/" . urlencode($exportLayoutId) . ""; + + $data = array( + + ); + + $response = $request->get($path, $data, $options); + $returnValues = array(); + + + // Handling for field export_layout + $body = $response->getBody(); + $body = $body['export_layout']; + $returnValues['find'] = $this->fillWithData($body); + + return array_values($returnValues)[0]; + } + + /** + * Find the default export layout for given export type. + * @param string $exportType + * @param array $options + * @return $this + */ + public function findDefault($exportType, $options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/exports/layouts/default/" . urlencode($exportType) . ""; + + $data = array( + + ); + + $response = $request->get($path, $data, $options); + $returnValues = array(); + + + // Handling for field export_layout + $body = $response->getBody(); + $body = $body['export_layout']; + $returnValues['findDefault'] = $this->fillWithData($body); + + return array_values($returnValues)[0]; + } + + /** + * Create a new export layout. + * @param array $options + * @return $this + */ + public function create($options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/exports/layouts"; + + $data = array( + "name" => $this->getName(), + "type" => $this->getType(), + "is_default" => $this->getIsDefault(), + "configuration" => $this->getConfiguration() + ); + + $response = $request->post($path, $data, $options); + $returnValues = array(); + + + // Handling for field export_layout + $body = $response->getBody(); + $body = $body['export_layout']; + $returnValues['create'] = $this->fillWithData($body); + + return array_values($returnValues)[0]; + } + + /** + * Update the export layout. + * @param string $exportLayoutId + * @param array $options + * @return $this + */ + public function update($exportLayoutId, $options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/exports/layouts/" . urlencode($exportLayoutId) . ""; + + $data = array( + "name" => $this->getName(), + "is_default" => $this->getIsDefault(), + "configuration" => $this->getConfiguration() + ); + + $response = $request->put($path, $data, $options); + $returnValues = array(); + + + // Handling for field export_layout + $body = $response->getBody(); + $body = $body['export_layout']; + $returnValues['update'] = $this->fillWithData($body); + + return array_values($returnValues)[0]; + } + + /** + * Delete the export layout. + * @param string $exportLayoutId + * @param array $options + * @return bool + */ + public function delete($exportLayoutId, $options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/exports/layouts/" . urlencode($exportLayoutId) . ""; + + $data = array( + + ); + + $response = $request->delete($path, $data, $options); + $returnValues = array(); + + $returnValues['success'] = $response->isSuccess(); + + return array_values($returnValues)[0]; + } + +} diff --git a/src/ExportLayoutConfiguration.php b/src/ExportLayoutConfiguration.php new file mode 100755 index 0000000..3184e43 --- /dev/null +++ b/src/ExportLayoutConfiguration.php @@ -0,0 +1,175 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Columns + * Columns that will be exported. + * @return array + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Set Columns + * Columns that will be exported. + * @param array $value + * @return $this + */ + public function setColumns($value) + { + if (count($value) > 0 && is_object($value[0])) + $this->columns = $value; + else + { + $a = array(); + foreach ($value as $v) + { + $obj = new ExportLayoutConfigurationColumn($this->client); + $obj->fillWithData($v); + $a[] = $obj; + } + $this->columns = $a; + } + return $this; + } + + /** + * Get Time + * Time related configurations. + * @return object + */ + public function getTime() + { + return $this->time; + } + + /** + * Set Time + * Time related configurations. + * @param object $value + * @return $this + */ + public function setTime($value) + { + if (is_object($value)) + $this->time = $value; + else + { + $obj = new ExportLayoutConfigurationTime($this->client); + $obj->fillWithData($value); + $this->time = $obj; + } + return $this; + } + + /** + * Get Amount + * Amount related configurations. + * @return object + */ + public function getAmount() + { + return $this->amount; + } + + /** + * Set Amount + * Amount related configurations. + * @param object $value + * @return $this + */ + public function setAmount($value) + { + if (is_object($value)) + $this->amount = $value; + else + { + $obj = new ExportLayoutConfigurationAmount($this->client); + $obj->fillWithData($value); + $this->amount = $obj; + } + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayoutConfiguration + */ + public function fillWithData($data) + { + if(! empty($data['columns'])) + $this->setColumns($data['columns']); + + if(! empty($data['time'])) + $this->setTime($data['time']); + + if(! empty($data['amount'])) + $this->setAmount($data['amount']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "columns" => $this->getColumns(), + "time" => $this->getTime(), + "amount" => $this->getAmount(), + ); + } + + +} diff --git a/src/ExportLayoutConfigurationAmount.php b/src/ExportLayoutConfigurationAmount.php new file mode 100755 index 0000000..c0f6079 --- /dev/null +++ b/src/ExportLayoutConfigurationAmount.php @@ -0,0 +1,117 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Precision + * Chosen precision for the amount fields in the export. + * @return string + */ + public function getPrecision() + { + return $this->precision; + } + + /** + * Set Precision + * Chosen precision for the amount fields in the export. + * @param string $value + * @return $this + */ + public function setPrecision($value) + { + $this->precision = $value; + return $this; + } + + /** + * Get Separator + * Chosen separator for the amount fields in the export. + * @return string + */ + public function getSeparator() + { + return $this->separator; + } + + /** + * Set Separator + * Chosen separator for the amount fields in the export. + * @param string $value + * @return $this + */ + public function setSeparator($value) + { + $this->separator = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayoutConfigurationAmount + */ + public function fillWithData($data) + { + if(! empty($data['precision'])) + $this->setPrecision($data['precision']); + + if(! empty($data['separator'])) + $this->setSeparator($data['separator']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "precision" => $this->getPrecision(), + "separator" => $this->getSeparator(), + ); + } + + +} diff --git a/src/ExportLayoutConfigurationColumn.php b/src/ExportLayoutConfigurationColumn.php new file mode 100755 index 0000000..21f1a86 --- /dev/null +++ b/src/ExportLayoutConfigurationColumn.php @@ -0,0 +1,117 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Name + * Name of the column. Must match with supported ones for chosen export type. + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set Name + * Name of the column. Must match with supported ones for chosen export type. + * @param string $value + * @return $this + */ + public function setName($value) + { + $this->name = $value; + return $this; + } + + /** + * Get Rename + * Rename of the chosen column if needed. + * @return string + */ + public function getRename() + { + return $this->rename; + } + + /** + * Set Rename + * Rename of the chosen column if needed. + * @param string $value + * @return $this + */ + public function setRename($value) + { + $this->rename = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayoutConfigurationColumn + */ + public function fillWithData($data) + { + if(! empty($data['name'])) + $this->setName($data['name']); + + if(! empty($data['rename'])) + $this->setRename($data['rename']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "name" => $this->getName(), + "rename" => $this->getRename(), + ); + } + + +} diff --git a/src/ExportLayoutConfigurationConfigurationOptionsAmount.php b/src/ExportLayoutConfigurationConfigurationOptionsAmount.php new file mode 100755 index 0000000..9aa0d2b --- /dev/null +++ b/src/ExportLayoutConfigurationConfigurationOptionsAmount.php @@ -0,0 +1,117 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Precision + * Precision options for configuration. + * @return array + */ + public function getPrecision() + { + return $this->precision; + } + + /** + * Set Precision + * Precision options for configuration. + * @param array $value + * @return $this + */ + public function setPrecision($value) + { + $this->precision = $value; + return $this; + } + + /** + * Get Separator + * Separator options for configuration. + * @return array + */ + public function getSeparator() + { + return $this->separator; + } + + /** + * Set Separator + * Separator options for configuration. + * @param array $value + * @return $this + */ + public function setSeparator($value) + { + $this->separator = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayoutConfigurationConfigurationOptionsAmount + */ + public function fillWithData($data) + { + if(! empty($data['precision'])) + $this->setPrecision($data['precision']); + + if(! empty($data['separator'])) + $this->setSeparator($data['separator']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "precision" => $this->getPrecision(), + "separator" => $this->getSeparator(), + ); + } + + +} diff --git a/src/ExportLayoutConfigurationConfigurationOptionsTime.php b/src/ExportLayoutConfigurationConfigurationOptionsTime.php new file mode 100755 index 0000000..fe60fdc --- /dev/null +++ b/src/ExportLayoutConfigurationConfigurationOptionsTime.php @@ -0,0 +1,85 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Format + * Format options for configuration. + * @return array + */ + public function getFormat() + { + return $this->format; + } + + /** + * Set Format + * Format options for configuration. + * @param array $value + * @return $this + */ + public function setFormat($value) + { + $this->format = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayoutConfigurationConfigurationOptionsTime + */ + public function fillWithData($data) + { + if(! empty($data['format'])) + $this->setFormat($data['format']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "format" => $this->getFormat(), + ); + } + + +} diff --git a/src/ExportLayoutConfigurationOptions.php b/src/ExportLayoutConfigurationOptions.php new file mode 100755 index 0000000..d7a75c3 --- /dev/null +++ b/src/ExportLayoutConfigurationOptions.php @@ -0,0 +1,192 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Columns + * Columns options for configuration. + * @return array + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Set Columns + * Columns options for configuration. + * @param array $value + * @return $this + */ + public function setColumns($value) + { + $this->columns = $value; + return $this; + } + + /** + * Get Time + * Time options for configuration. + * @return object + */ + public function getTime() + { + return $this->time; + } + + /** + * Set Time + * Time options for configuration. + * @param object $value + * @return $this + */ + public function setTime($value) + { + if (is_object($value)) + $this->time = $value; + else + { + $obj = new ExportLayoutConfigurationConfigurationOptionsTime($this->client); + $obj->fillWithData($value); + $this->time = $obj; + } + return $this; + } + + /** + * Get Amount + * Amount options for configuration. + * @return object + */ + public function getAmount() + { + return $this->amount; + } + + /** + * Set Amount + * Amount options for configuration. + * @param object $value + * @return $this + */ + public function setAmount($value) + { + if (is_object($value)) + $this->amount = $value; + else + { + $obj = new ExportLayoutConfigurationConfigurationOptionsAmount($this->client); + $obj->fillWithData($value); + $this->amount = $obj; + } + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayoutConfigurationOptions + */ + public function fillWithData($data) + { + if(! empty($data['columns'])) + $this->setColumns($data['columns']); + + if(! empty($data['time'])) + $this->setTime($data['time']); + + if(! empty($data['amount'])) + $this->setAmount($data['amount']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "columns" => $this->getColumns(), + "time" => $this->getTime(), + "amount" => $this->getAmount(), + ); + } + + + /** + * Fetch export layout configuration options. + * @param string $exportType + * @param array $options + * @return $this + */ + public function fetch($exportType, $options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/exports/layouts/options/" . urlencode($exportType) . ""; + + $data = array( + + ); + + $response = $request->get($path, $data, $options); + $returnValues = array(); + + + // Handling for field export_layout_configuration_options + $body = $response->getBody(); + $body = $body['export_layout_configuration_options']; + $returnValues['fetch'] = $this->fillWithData($body); + + return array_values($returnValues)[0]; + } + +} diff --git a/src/ExportLayoutConfigurationTime.php b/src/ExportLayoutConfigurationTime.php new file mode 100755 index 0000000..b162715 --- /dev/null +++ b/src/ExportLayoutConfigurationTime.php @@ -0,0 +1,85 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Format + * Format of the time fields in the export. + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Set Format + * Format of the time fields in the export. + * @param string $value + * @return $this + */ + public function setFormat($value) + { + $this->format = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExportLayoutConfigurationTime + */ + public function fillWithData($data) + { + if(! empty($data['format'])) + $this->setFormat($data['format']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "format" => $this->getFormat(), + ); + } + + +} diff --git a/src/ExternalThreeDS.php b/src/ExternalThreeDS.php new file mode 100755 index 0000000..0e0293f --- /dev/null +++ b/src/ExternalThreeDS.php @@ -0,0 +1,277 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Xid + * ThreeDS v1 ID + * @return string + */ + public function getXid() + { + return $this->xid; + } + + /** + * Set Xid + * ThreeDS v1 ID + * @param string $value + * @return $this + */ + public function setXid($value) + { + $this->xid = $value; + return $this; + } + + /** + * Get TransStatus + * Transaction status + * @return string + */ + public function getTransStatus() + { + return $this->transStatus; + } + + /** + * Set TransStatus + * Transaction status + * @param string $value + * @return $this + */ + public function setTransStatus($value) + { + $this->transStatus = $value; + return $this; + } + + /** + * Get Eci + * ECI + * @return string + */ + public function getEci() + { + return $this->eci; + } + + /** + * Set Eci + * ECI + * @param string $value + * @return $this + */ + public function setEci($value) + { + $this->eci = $value; + return $this; + } + + /** + * Get Cavv + * Authentication value + * @return string + */ + public function getCavv() + { + return $this->cavv; + } + + /** + * Set Cavv + * Authentication value + * @param string $value + * @return $this + */ + public function setCavv($value) + { + $this->cavv = $value; + return $this; + } + + /** + * Get DsTransId + * DS Transaction ID + * @return string + */ + public function getDsTransId() + { + return $this->dsTransId; + } + + /** + * Set DsTransId + * DS Transaction ID + * @param string $value + * @return $this + */ + public function setDsTransId($value) + { + $this->dsTransId = $value; + return $this; + } + + /** + * Get Version + * ThreeDS Message version + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Set Version + * ThreeDS Message version + * @param string $value + * @return $this + */ + public function setVersion($value) + { + $this->version = $value; + return $this; + } + + /** + * Get AuthenticationFlow + * Authentication flow: one of `frictionless` or 'challenge` + * @return string + */ + public function getAuthenticationFlow() + { + return $this->authenticationFlow; + } + + /** + * Set AuthenticationFlow + * Authentication flow: one of `frictionless` or 'challenge` + * @param string $value + * @return $this + */ + public function setAuthenticationFlow($value) + { + $this->authenticationFlow = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ExternalThreeDS + */ + public function fillWithData($data) + { + if(! empty($data['xid'])) + $this->setXid($data['xid']); + + if(! empty($data['trans_status'])) + $this->setTransStatus($data['trans_status']); + + if(! empty($data['eci'])) + $this->setEci($data['eci']); + + if(! empty($data['cavv'])) + $this->setCavv($data['cavv']); + + if(! empty($data['ds_trans_id'])) + $this->setDsTransId($data['ds_trans_id']); + + if(! empty($data['version'])) + $this->setVersion($data['version']); + + if(! empty($data['authentication_flow'])) + $this->setAuthenticationFlow($data['authentication_flow']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "xid" => $this->getXid(), + "trans_status" => $this->getTransStatus(), + "eci" => $this->getEci(), + "cavv" => $this->getCavv(), + "ds_trans_id" => $this->getDsTransId(), + "version" => $this->getVersion(), + "authentication_flow" => $this->getAuthenticationFlow(), + ); + } + + +} diff --git a/src/Invoice.php b/src/Invoice.php index d9ed6f5..4af65c2 100755 --- a/src/Invoice.php +++ b/src/Invoice.php @@ -1809,6 +1809,8 @@ public function authorize($source, $options = array()) "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 ); @@ -1857,6 +1859,8 @@ public function capture($source, $options = array()) "metadata" => (!empty($options["metadata"])) ? $options["metadata"] : null, "capture_statement_descriptor" => (!empty($options["capture_statement_descriptor"])) ? $options["capture_statement_descriptor"] : 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 ); diff --git a/src/Networking/Request.php b/src/Networking/Request.php index bfc4b32..7acad78 100644 --- a/src/Networking/Request.php +++ b/src/Networking/Request.php @@ -31,7 +31,7 @@ protected function prepare($options, $len = null) $headers = array( 'API-Version: 1.4.0.0', 'Content-Type: application/json', - 'User-Agent: ProcessOut PHP-Bindings/7.0.0' + 'User-Agent: ProcessOut PHP-Bindings/7.1.0' ); if (! empty($options['idempotencyKey'])) $headers[] = 'Idempotency-Key: ' . $options['idempotencyKey']; diff --git a/src/ProcessOut.php b/src/ProcessOut.php index e3fa468..79a7180 100644 --- a/src/ProcessOut.php +++ b/src/ProcessOut.php @@ -217,6 +217,78 @@ public function newEvent($prefill = array()) { return new Event($this, $prefill); } + /** + * Create a new ExportLayout instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayout + */ + public function newExportLayout($prefill = array()) { + return new ExportLayout($this, $prefill); + } + + /** + * Create a new ExportLayoutConfiguration instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayoutConfiguration + */ + public function newExportLayoutConfiguration($prefill = array()) { + return new ExportLayoutConfiguration($this, $prefill); + } + + /** + * Create a new ExportLayoutConfigurationColumn instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayoutConfigurationColumn + */ + public function newExportLayoutConfigurationColumn($prefill = array()) { + return new ExportLayoutConfigurationColumn($this, $prefill); + } + + /** + * Create a new ExportLayoutConfigurationTime instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayoutConfigurationTime + */ + public function newExportLayoutConfigurationTime($prefill = array()) { + return new ExportLayoutConfigurationTime($this, $prefill); + } + + /** + * Create a new ExportLayoutConfigurationAmount instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayoutConfigurationAmount + */ + public function newExportLayoutConfigurationAmount($prefill = array()) { + return new ExportLayoutConfigurationAmount($this, $prefill); + } + + /** + * Create a new ExportLayoutConfigurationOptions instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayoutConfigurationOptions + */ + public function newExportLayoutConfigurationOptions($prefill = array()) { + return new ExportLayoutConfigurationOptions($this, $prefill); + } + + /** + * Create a new ExportLayoutConfigurationConfigurationOptionsTime instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayoutConfigurationConfigurationOptionsTime + */ + public function newExportLayoutConfigurationConfigurationOptionsTime($prefill = array()) { + return new ExportLayoutConfigurationConfigurationOptionsTime($this, $prefill); + } + + /** + * Create a new ExportLayoutConfigurationConfigurationOptionsAmount instance + * @param array|null $prefill array used to prefill the object + * @return ExportLayoutConfigurationConfigurationOptionsAmount + */ + public function newExportLayoutConfigurationConfigurationOptionsAmount($prefill = array()) { + return new ExportLayoutConfigurationConfigurationOptionsAmount($this, $prefill); + } + /** * Create a new Gateway instance * @param array|null $prefill array used to prefill the object @@ -613,6 +685,24 @@ public function newCategoryErrorCodes($prefill = array()) { return new CategoryErrorCodes($this, $prefill); } + /** + * Create a new ExternalThreeDS instance + * @param array|null $prefill array used to prefill the object + * @return ExternalThreeDS + */ + public function newExternalThreeDS($prefill = array()) { + return new ExternalThreeDS($this, $prefill); + } + + /** + * Create a new NativeAPMTransactionDetails instance + * @param array|null $prefill array used to prefill the object + * @return NativeAPMTransactionDetails + */ + public function newNativeAPMTransactionDetails($prefill = array()) { + return new NativeAPMTransactionDetails($this, $prefill); + } + /** * Create a new NativeAPMTransactionDetailsGateway instance * @param array|null $prefill array used to prefill the object @@ -631,13 +721,4 @@ public function newNativeAPMTransactionDetailsInvoice($prefill = array()) { return new NativeAPMTransactionDetailsInvoice($this, $prefill); } - /** - * Create a new NativeAPMTransactionDetails instance - * @param array|null $prefill array used to prefill the object - * @return NativeAPMTransactionDetails - */ - public function newNativeAPMTransactionDetails($prefill = array()) { - return new NativeAPMTransactionDetails($this, $prefill); - } - } diff --git a/src/Token.php b/src/Token.php index 6718499..bafe9d5 100755 --- a/src/Token.php +++ b/src/Token.php @@ -850,7 +850,7 @@ public function find($customerId, $tokenId, $options = array()) /** * Create a new token for the given customer ID. * @param array $options - * @return $this + * @return array */ public function create($options = array()) { @@ -885,8 +885,14 @@ public function create($options = array()) $body = $response->getBody(); $body = $body['token']; $returnValues['create'] = $this->fillWithData($body); + // Handling for field customer_action + $body = $response->getBody(); + $body = $body['customer_action']; + $customerAction = new CustomerAction($this->client); + $returnValues['customerAction'] = $customerAction->fillWithData($body); + - return array_values($returnValues)[0]; + return (object) $returnValues; } /**