From d3f9728b5af45db239c7dcf93ff05ad477e998f0 Mon Sep 17 00:00:00 2001 From: Andre Walker Date: Wed, 27 Oct 2021 10:24:41 -0300 Subject: [PATCH] fix: Remove Holder restriction Now it's possible pass Customer or Holder as $holder in setCreditCardHolder, setCreditCardHash and setCreditCard methods. --- src/Resource/Payment.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Resource/Payment.php b/src/Resource/Payment.php index 8bfabd8..33b7c4d 100644 --- a/src/Resource/Payment.php +++ b/src/Resource/Payment.php @@ -445,9 +445,9 @@ public function setBoleto($expirationDate, $logoUri, array $instructionLines = [ /** * Set credit card holder. * - * @param \Moip\Resource\Customer $holder + * @param \Moip\Resource\Customer|\Moip\Resource\Holder $holder */ - private function setCreditCardHolder(Holder $holder) + private function setCreditCardHolder($holder) { $birthdate = $holder->getBirthDate(); if ($birthdate instanceof \DateTime) { @@ -469,13 +469,13 @@ private function setCreditCardHolder(Holder $holder) /** * Set credit cardHash. * - * @param string $hash Credit card hash encripted using Moip.js - * @param \Moip\Resource\Customer $holder - * @param bool $store Flag to know if credit card should be saved. + * @param string $hash Credit card hash encripted using Moip.js + * @param \Moip\Resource\Customer|\Moip\Resource\Holder $holder + * @param bool $store Flag to know if credit card should be saved. * * @return $this */ - public function setCreditCardHash($hash, Holder $holder, $store = true) + public function setCreditCardHash($hash, $holder, $store = true) { $this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD; $this->data->fundingInstrument->creditCard = new stdClass(); @@ -491,16 +491,16 @@ public function setCreditCardHash($hash, Holder $holder, $store = true) * Credit card used in a payment. * The card when returned within a parent resource is presented in its minimum representation. * - * @param int $expirationMonth Card expiration month - * @param int $expirationYear Year of card expiration. - * @param string $number Card number. - * @param int $cvc Card Security Code. - * @param \Moip\Resource\Customer $holder - * @param bool $store Flag to know if credit card should be saved. + * @param int $expirationMonth Card expiration month + * @param int $expirationYear Year of card expiration. + * @param string $number Card number. + * @param int $cvc Card Security Code. + * @param \Moip\Resource\Customer|\Moip\Resource\Holder $holder + * @param bool $store Flag to know if credit card should be saved. * * @return $this */ - public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, Holder $holder, $store = true) + public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, $holder, $store = true) { $this->data->fundingInstrument->method = self::METHOD_CREDIT_CARD; $this->data->fundingInstrument->creditCard = new stdClass();