Skip to content

Commit

Permalink
feat: add auto_capture_at field within the invoice object (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: ProcessOut Fountain <internal@processout.com>
  • Loading branch information
roshan-gorasia-cko and processout-machine authored Apr 10, 2024
1 parent 30b9f10 commit b938d91
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
```
Expand Down
35 changes: 34 additions & 1 deletion src/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -1653,6 +1684,7 @@ public function jsonSerialize() {
"billing" => $this->getBilling(),
"unsupported_feature_bypass" => $this->getUnsupportedFeatureBypass(),
"verification" => $this->getVerification(),
"auto_capture_at" => $this->getAutoCaptureAt(),
);
}

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Networking/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down

0 comments on commit b938d91

Please sign in to comment.