diff --git a/src/Api/RecurringPayment.php b/src/Api/RecurringPayment.php index c0dd422..b0450ea 100644 --- a/src/Api/RecurringPayment.php +++ b/src/Api/RecurringPayment.php @@ -7,6 +7,7 @@ use zaporylie\Vipps\Model\RecurringPayment\RequestCreateCharge; use zaporylie\Vipps\Model\RecurringPayment\RequestRefundCharge; use zaporylie\Vipps\Model\RecurringPayment\RequestUpdateAgreementBase; +use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge; use zaporylie\Vipps\Resource\RecurringPayment\CancelCharge; use zaporylie\Vipps\Resource\RecurringPayment\CaptureCharge; use zaporylie\Vipps\Resource\RecurringPayment\CreateAgreement; @@ -152,9 +153,9 @@ public function cancelCharge($agreement_id, $charge_id) /** * {@inheritDoc} */ - public function captureCharge($agreement_id, $charge_id) + public function captureCharge($agreement_id, $charge_id, RequestCaptureCharge $requestObject) { - $resource = new CaptureCharge($this->app, $this->api_endpoint_version, $this->getSubscriptionKey(), $agreement_id, $charge_id); + $resource = new CaptureCharge($this->app, $this->api_endpoint_version, $this->getSubscriptionKey(), $agreement_id, $charge_id, $requestObject); $response = $resource->call(); return $response; } diff --git a/src/Api/RecurringPaymentInterface.php b/src/Api/RecurringPaymentInterface.php index efa9592..e516b95 100644 --- a/src/Api/RecurringPaymentInterface.php +++ b/src/Api/RecurringPaymentInterface.php @@ -6,6 +6,7 @@ use zaporylie\Vipps\Model\RecurringPayment\RequestCreateCharge; use zaporylie\Vipps\Model\RecurringPayment\RequestRefundCharge; use zaporylie\Vipps\Model\RecurringPayment\RequestUpdateAgreementBase; +use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge; /** * Interface PaymentInterface @@ -77,7 +78,7 @@ public function cancelCharge($agreement_id, $charge_id); * * @return string */ - public function captureCharge($agreement_id, $charge_id); + public function captureCharge($agreement_id, $charge_id, RequestCaptureCharge $requestObject); /** * @param string $agreement_id diff --git a/src/Model/RecurringPayment/v3/RequestCaptureCharge.php b/src/Model/RecurringPayment/v3/RequestCaptureCharge.php new file mode 100644 index 0000000..ff5c90b --- /dev/null +++ b/src/Model/RecurringPayment/v3/RequestCaptureCharge.php @@ -0,0 +1,73 @@ +amount; + } + + /** + * Set the value of amount + * + * @param int $amount + * + * @return self + */ + public function setAmount(int $amount) + { + $this->amount = $amount; + + return $this; + } + + /** + * Get the value of description + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set the value of description + * + * @param string $description + * + * @return self + */ + public function setDescription(string $description) + { + $this->description = $description; + + return $this; + } +} diff --git a/src/Resource/RecurringPayment/CaptureCharge.php b/src/Resource/RecurringPayment/CaptureCharge.php index ffbb75e..d66b8c3 100644 --- a/src/Resource/RecurringPayment/CaptureCharge.php +++ b/src/Resource/RecurringPayment/CaptureCharge.php @@ -5,6 +5,7 @@ use zaporylie\Vipps\Model\RecurringPayment\RequestCreateCharge; use zaporylie\Vipps\Model\RecurringPayment\ResponseCaptureCharge; use zaporylie\Vipps\Model\RecurringPayment\ResponseCreateCharge; +use zaporylie\Vipps\Model\RecurringPayment\v3\RequestCaptureCharge; use zaporylie\Vipps\Resource\HttpMethod; use zaporylie\Vipps\Resource\IdempotencyKeyFactory; use zaporylie\Vipps\Resource\RequestIdFactory; @@ -41,11 +42,18 @@ public function __construct( $api_endpoint_version, $subscription_key, $agreement_id, - $charge_id + $charge_id, + RequestCaptureCharge $requestObject ) { $this->id = $agreement_id; $this->charge_id = $charge_id; parent::__construct($vipps, $api_endpoint_version, $subscription_key); + $this->body = $this + ->getSerializer() + ->serialize( + $requestObject, + 'json' + ); } /**