From fcafeb9adb4786079f05190a59b1c6b44ce9bfbc Mon Sep 17 00:00:00 2001 From: ProcessOut Fountain Date: Wed, 10 Apr 2024 14:06:35 +0100 Subject: [PATCH] feat: add auto_capture_at field within the invoice object --- README.md | 2 +- src/Invoice.php | 35 ++++++++++++++++++++++++++++++++++- src/Networking/Request.php | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9fa124f..b16be30 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": "^6.32.0" + "processout/processout-php": "^6.33.0" } } ``` diff --git a/src/Invoice.php b/src/Invoice.php index 2a66cea..593101a 100755 --- a/src/Invoice.php +++ b/src/Invoice.php @@ -298,6 +298,12 @@ class Invoice implements \JsonSerializable */ protected $verification; + /** + * A timestamp to indicate when an auto capture should take place following an authorization. This takes priority over the value sent in the authorization request. + * @var string + */ + protected $autoCaptureAt; + /** * Invoice constructor * @param ProcessOut\ProcessOut $client @@ -1448,6 +1454,28 @@ public function setVerification($value) return $this; } + /** + * Get AutoCaptureAt + * A timestamp to indicate when an auto capture should take place following an authorization. This takes priority over the value sent in the authorization request. + * @return string + */ + public function getAutoCaptureAt() + { + return $this->autoCaptureAt; + } + + /** + * Set AutoCaptureAt + * A timestamp to indicate when an auto capture should take place following an authorization. This takes priority over the value sent in the authorization request. + * @param string $value + * @return $this + */ + public function setAutoCaptureAt($value) + { + $this->autoCaptureAt = $value; + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -1597,6 +1625,9 @@ public function fillWithData($data) if(! empty($data['verification'])) $this->setVerification($data['verification']); + if(! empty($data['auto_capture_at'])) + $this->setAutoCaptureAt($data['auto_capture_at']); + return $this; } @@ -1653,6 +1684,7 @@ public function jsonSerialize() { "billing" => $this->getBilling(), "unsupported_feature_bypass" => $this->getUnsupportedFeatureBypass(), "verification" => $this->getVerification(), + "auto_capture_at" => $this->getAutoCaptureAt(), ); } @@ -2101,7 +2133,8 @@ public function create($options = array()) "payment_type" => $this->getPaymentType(), "billing" => $this->getBilling(), "unsupported_feature_bypass" => $this->getUnsupportedFeatureBypass(), - "verification" => $this->getVerification() + "verification" => $this->getVerification(), + "auto_capture_at" => $this->getAutoCaptureAt() ); $response = $request->post($path, $data, $options); diff --git a/src/Networking/Request.php b/src/Networking/Request.php index cf420ea..21820f0 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/6.32.0' + 'User-Agent: ProcessOut PHP-Bindings/6.33.0' ); if (! empty($options['idempotencyKey'])) $headers[] = 'Idempotency-Key: ' . $options['idempotencyKey'];