diff --git a/src/Artistas/PagSeguro.php b/src/Artistas/PagSeguro.php index 7779682..c649c85 100644 --- a/src/Artistas/PagSeguro.php +++ b/src/Artistas/PagSeguro.php @@ -97,13 +97,13 @@ public function setSenderInfo(array $senderInfo) $senderPhone = $this->sanitizeNumber($senderInfo, 'senderPhone'); $senderInfo = [ - 'senderName' => $this->sanitize($senderInfo, 'senderName'), - 'senderAreaCode' => substr($senderPhone, 0, 2), - 'senderPhone' => substr($senderPhone, 2), - 'senderEmail' => $senderEmail, - 'senderHash' => $this->checkValue($senderInfo, 'senderHash'), - 'senderCNPJ' => $this->sanitizeNumber($senderInfo, 'senderCNPJ'), - 'senderCPF' => $this->sanitizeNumber($senderInfo, 'senderCPF'), + 'senderName' => $this->sanitize($senderInfo, 'senderName'), + 'senderAreaCode' => substr($senderPhone, 0, 2), + 'senderPhone' => substr($senderPhone, 2), + 'senderEmail' => $senderEmail, + 'senderHash' => $this->checkValue($senderInfo, 'senderHash'), + 'senderCNPJ' => $this->sanitizeNumber($senderInfo, 'senderCNPJ'), + 'senderCPF' => $this->sanitizeNumber($senderInfo, 'senderCPF'), ]; $this->validateSenderInfo($senderInfo); @@ -120,13 +120,13 @@ public function setSenderInfo(array $senderInfo) private function validateSenderInfo(array $senderInfo) { $rules = [ - 'senderName' => 'required|max:50', - 'senderAreaCode' => 'required|digits:2', - 'senderPhone' => 'required|digits_between:8,9', - 'senderEmail' => 'required|email|max:60', - 'senderHash' => 'required', - 'senderCPF' => 'required_without:senderCNPJ|digits:11', - 'senderCNPJ' => 'required_without:senderCPF|digits:14', + 'senderName' => 'required|max:50', + 'senderAreaCode' => 'required|digits:2', + 'senderPhone' => 'required|digits_between:8,9', + 'senderEmail' => 'required|email|max:60', + 'senderHash' => 'required', + 'senderCPF' => 'required_without:senderCNPJ|digits:11', + 'senderCNPJ' => 'required_without:senderCPF|digits:14', ]; $this->validate($senderInfo, $rules); @@ -144,11 +144,11 @@ public function setCreditCardHolder(array $creditCardHolder) $cardHolderPhone = $this->sanitizeNumber($creditCardHolder, 'creditCardHolderPhone'); $creditCardHolder = [ - 'creditCardHolderName' => $this->fallbackValue($this->sanitize($creditCardHolder, 'creditCardHolderName'), $this->senderInfo, 'senderName'), - 'creditCardHolderAreaCode' => $this->fallbackValue(substr($cardHolderPhone, 0, 2), $this->senderInfo, 'senderAreaCode'), - 'creditCardHolderPhone' => $this->fallbackValue(substr($cardHolderPhone, 2), $this->senderInfo, 'senderPhone'), - 'creditCardHolderCPF' => $this->fallbackValue($this->sanitizeNumber($creditCardHolder, 'creditCardHolderCPF'), $this->senderInfo, 'senderCPF'), - 'creditCardHolderBirthDate' => $this->sanitize($creditCardHolder, 'creditCardHolderBirthDate'), + 'creditCardHolderName' => $this->fallbackValue($this->sanitize($creditCardHolder, 'creditCardHolderName'), $this->senderInfo, 'senderName'), + 'creditCardHolderAreaCode' => $this->fallbackValue(substr($cardHolderPhone, 0, 2), $this->senderInfo, 'senderAreaCode'), + 'creditCardHolderPhone' => $this->fallbackValue(substr($cardHolderPhone, 2), $this->senderInfo, 'senderPhone'), + 'creditCardHolderCPF' => $this->fallbackValue($this->sanitizeNumber($creditCardHolder, 'creditCardHolderCPF'), $this->senderInfo, 'senderCPF'), + 'creditCardHolderBirthDate' => $this->sanitize($creditCardHolder, 'creditCardHolderBirthDate'), ]; $this->validateCreditCardHolder($creditCardHolder); @@ -165,11 +165,11 @@ public function setCreditCardHolder(array $creditCardHolder) private function validateCreditCardHolder(array $creditCardHolder) { $rules = [ - 'creditCardHolderName' => 'required|max:50', - 'creditCardHolderAreaCode' => 'required|digits:2', - 'creditCardHolderPhone' => 'required|digits_between:8,9', - 'creditCardHolderCPF' => 'required|digits:11', - 'creditCardHolderBirthDate' => 'required', + 'creditCardHolderName' => 'required|max:50', + 'creditCardHolderAreaCode' => 'required|digits:2', + 'creditCardHolderPhone' => 'required|digits_between:8,9', + 'creditCardHolderCPF' => 'required|digits:11', + 'creditCardHolderBirthDate' => 'required', ]; $this->validate($creditCardHolder, $rules); @@ -185,14 +185,14 @@ private function validateCreditCardHolder(array $creditCardHolder) public function setShippingAddress(array $shippingAddress) { $shippingAddress = [ - 'shippingAddressStreet' => $this->sanitize($shippingAddress, 'shippingAddressStreet'), - 'shippingAddressNumber' => $this->sanitize($shippingAddress, 'shippingAddressNumber'), - 'shippingAddressComplement' => $this->sanitize($shippingAddress, 'shippingAddressComplement'), - 'shippingAddressDistrict' => $this->sanitize($shippingAddress, 'shippingAddressDistrict'), - 'shippingAddressPostalCode' => $this->sanitizeNumber($shippingAddress, 'shippingAddressPostalCode'), - 'shippingAddressCity' => $this->sanitize($shippingAddress, 'shippingAddressCity'), - 'shippingAddressState' => strtoupper($this->checkValue($shippingAddress, 'shippingAddressState')), - 'shippingAddressCountry' => 'BRA', + 'shippingAddressStreet' => $this->sanitize($shippingAddress, 'shippingAddressStreet'), + 'shippingAddressNumber' => $this->sanitize($shippingAddress, 'shippingAddressNumber'), + 'shippingAddressComplement' => $this->sanitize($shippingAddress, 'shippingAddressComplement'), + 'shippingAddressDistrict' => $this->sanitize($shippingAddress, 'shippingAddressDistrict'), + 'shippingAddressPostalCode' => $this->sanitizeNumber($shippingAddress, 'shippingAddressPostalCode'), + 'shippingAddressCity' => $this->sanitize($shippingAddress, 'shippingAddressCity'), + 'shippingAddressState' => strtoupper($this->checkValue($shippingAddress, 'shippingAddressState')), + 'shippingAddressCountry' => 'BRA', ]; $this->validateShippingAddress($shippingAddress); @@ -235,14 +235,14 @@ private function validateShippingAddress(array $shippingAddress) public function setBillingAddress(array $billingAddress) { $billingAddress = [ - 'billingAddressStreet' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressStreet'), $this->shippingAddress, 'shippingAddressStreet'), - 'billingAddressNumber' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressNumber'), $this->shippingAddress, 'shippingAddressNumber'), - 'billingAddressComplement' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressComplement'), $this->shippingAddress, 'shippingAddressComplement'), - 'billingAddressDistrict' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressDistrict'), $this->shippingAddress, 'shippingAddressDistrict'), - 'billingAddressPostalCode' => $this->fallbackValue($this->sanitizeNumber($billingAddress, 'billingAddressPostalCode'), $this->shippingAddress, 'shippingAddressPostalCode'), - 'billingAddressCity' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressCity'), $this->shippingAddress, 'shippingAddressCity'), - 'billingAddressState' => strtoupper($this->fallbackValue($this->checkValue($billingAddress, 'billingAddressState'), $this->shippingAddress, 'shippingAddressState')), - 'billingAddressCountry' => 'BRA', + 'billingAddressStreet' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressStreet'), $this->shippingAddress, 'shippingAddressStreet'), + 'billingAddressNumber' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressNumber'), $this->shippingAddress, 'shippingAddressNumber'), + 'billingAddressComplement' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressComplement'), $this->shippingAddress, 'shippingAddressComplement'), + 'billingAddressDistrict' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressDistrict'), $this->shippingAddress, 'shippingAddressDistrict'), + 'billingAddressPostalCode' => $this->fallbackValue($this->sanitizeNumber($billingAddress, 'billingAddressPostalCode'), $this->shippingAddress, 'shippingAddressPostalCode'), + 'billingAddressCity' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressCity'), $this->shippingAddress, 'shippingAddressCity'), + 'billingAddressState' => strtoupper($this->fallbackValue($this->checkValue($billingAddress, 'billingAddressState'), $this->shippingAddress, 'shippingAddressState')), + 'billingAddressCountry' => 'BRA', ]; $this->validateBillingAddress($billingAddress); @@ -259,13 +259,13 @@ public function setBillingAddress(array $billingAddress) private function validateBillingAddress(array $billingAddress) { $rules = [ - 'billingAddressStreet' => 'required|max:80', - 'billingAddressNumber' => 'required|max:20', - 'billingAddressComplement' => 'max:40', - 'billingAddressDistrict' => 'required|max:60', - 'billingAddressPostalCode' => 'required|digits:8', - 'billingAddressCity' => 'required|min:2|max:60', - 'billingAddressState' => 'required|min:2|max:2', + 'billingAddressStreet' => 'required|max:80', + 'billingAddressNumber' => 'required|max:20', + 'billingAddressComplement' => 'max:40', + 'billingAddressDistrict' => 'required|max:60', + 'billingAddressPostalCode' => 'required|digits:8', + 'billingAddressCity' => 'required|min:2|max:60', + 'billingAddressState' => 'required|min:2|max:2', ]; $this->validate($billingAddress, $rules); @@ -286,10 +286,10 @@ public function setItems(array $items) $cont++; $fItems = array_merge($fItems, [ - 'itemId'.$cont => $this->sanitize($item, 'itemId'), - 'itemDescription'.$cont => $this->sanitize($item, 'itemDescription'), - 'itemAmount'.$cont => $this->sanitizeMoney($item, 'itemAmount'), - 'itemQuantity'.$cont => $this->sanitizeNumber($item, 'itemQuantity'), + 'itemId'.$cont => $this->sanitize($item, 'itemId'), + 'itemDescription'.$cont => $this->sanitize($item, 'itemDescription'), + 'itemAmount'.$cont => $this->sanitizeMoney($item, 'itemAmount'), + 'itemQuantity'.$cont => $this->sanitizeNumber($item, 'itemQuantity'), ]); } @@ -310,10 +310,10 @@ private function validateItems($items) $rules = []; for ($cont = 1; $cont <= $this->itemsCount; $cont++) { $rules = array_merge($rules, [ - 'itemId'.$cont => 'required|max:100', - 'itemDescription'.$cont => 'required|max:100', - 'itemAmount'.$cont => 'required|numeric|between:0.00,9999999.00', - 'itemQuantity'.$cont => 'required|integer|between:1,999', + 'itemId'.$cont => 'required|max:100', + 'itemDescription'.$cont => 'required|max:100', + 'itemAmount'.$cont => 'required|numeric|between:0.00,9999999.00', + 'itemQuantity'.$cont => 'required|integer|between:1,999', ]); } @@ -358,8 +358,8 @@ public function setReference($reference) public function setShippingInfo(array $shippingInfo) { $shippingInfo = [ - 'shippingType' => $this->sanitizeNumber($shippingInfo, 'shippingType'), - 'shippingCost' => $this->sanitizeMoney($shippingInfo, 'shippingCost'), + 'shippingType' => $this->sanitizeNumber($shippingInfo, 'shippingType'), + 'shippingCost' => $this->sanitizeMoney($shippingInfo, 'shippingCost'), ]; $this->validateShippingInfo($shippingInfo); @@ -376,8 +376,8 @@ public function setShippingInfo(array $shippingInfo) private function validateShippingInfo(array $shippingInfo) { $rules = [ - 'shippingType' => 'required|integer|between:1,3', - 'shippingCost' => 'required|numeric|between:0.00,9999999.00', + 'shippingType' => 'required|integer|between:1,3', + 'shippingCost' => 'required|numeric|between:0.00,9999999.00', ]; $this->validate($shippingInfo, $rules); @@ -397,25 +397,25 @@ public function send(array $paymentSettings) } $paymentSettings = [ - 'paymentMethod' => $this->checkValue($paymentSettings, 'paymentMethod'), - 'bankName' => $this->checkValue($paymentSettings, 'bankName'), - 'creditCardToken' => $this->checkValue($paymentSettings, 'creditCardToken'), - 'installmentQuantity' => $this->sanitizeNumber($paymentSettings, 'installmentQuantity'), - 'installmentValue' => $this->sanitizeMoney($paymentSettings, 'installmentValue'), - 'noInterestInstallmentQuantity' => $this->sanitizeNumber($paymentSettings, 'noInterestInstallmentQuantity'), + 'paymentMethod' => $this->checkValue($paymentSettings, 'paymentMethod'), + 'bankName' => $this->checkValue($paymentSettings, 'bankName'), + 'creditCardToken' => $this->checkValue($paymentSettings, 'creditCardToken'), + 'installmentQuantity' => $this->sanitizeNumber($paymentSettings, 'installmentQuantity'), + 'installmentValue' => $this->sanitizeMoney($paymentSettings, 'installmentValue'), + 'noInterestInstallmentQuantity' => $this->sanitizeNumber($paymentSettings, 'noInterestInstallmentQuantity'), ]; $this->validatePaymentSettings($paymentSettings); $config = [ - 'email' => $this->email, - 'token' => $this->token, - 'paymentMode' => 'default', - 'receiverEmail' => $this->email, - 'currency' => 'BRL', - 'reference' => $this->reference, - 'extraAmount' => $this->extraAmount, - 'notificationURL' => $this->notificationURL, + 'email' => $this->email, + 'token' => $this->token, + 'paymentMode' => 'default', + 'receiverEmail' => $this->email, + 'currency' => 'BRL', + 'reference' => $this->reference, + 'extraAmount' => $this->extraAmount, + 'notificationURL' => $this->notificationURL, ]; $data = array_filter(array_merge($config, $paymentSettings, $this->senderInfo, $this->shippingAddress, $this->items, $this->creditCardHolder, $this->billingAddress, $this->shippingInfo)); @@ -447,12 +447,12 @@ public function cancelTransaction($transactionCode) private function validatePaymentSettings(array $paymentSettings) { $rules = [ - 'paymentMethod' => 'required', - 'bankName' => 'required_if:paymentMethod,eft', - 'creditCardToken' => 'required_if:paymentMethod,creditCard', - 'installmentQuantity' => 'required_if:paymentMethod,creditCard|integer|between:1,18', - 'installmentValue' => 'required_if:paymentMethod,creditCard|numeric|between:0.00,9999999.00', - 'noInterestInstallmentQuantity' => 'integer|between:1,18', + 'paymentMethod' => 'required', + 'bankName' => 'required_if:paymentMethod,eft', + 'creditCardToken' => 'required_if:paymentMethod,creditCard', + 'installmentQuantity' => 'required_if:paymentMethod,creditCard|integer|between:1,18', + 'installmentValue' => 'required_if:paymentMethod,creditCard|numeric|between:0.00,9999999.00', + 'noInterestInstallmentQuantity' => 'integer|between:1,18', ]; $this->validate($paymentSettings, $rules); diff --git a/src/Artistas/PagSeguroClient.php b/src/Artistas/PagSeguroClient.php index 12885ef..956cbb4 100644 --- a/src/Artistas/PagSeguroClient.php +++ b/src/Artistas/PagSeguroClient.php @@ -209,8 +209,8 @@ private function formatResultJson($result) public function startSession() { return (string) $this->sendTransaction([ - 'email' => $this->email, - 'token' => $this->token, + 'email' => $this->email, + 'token' => $this->token, ], $this->url['session'])->id; } @@ -228,13 +228,13 @@ public function notification($notificationCode, $notificationType = 'transaction { if ($notificationType == 'transaction') { return $this->sendTransaction([ - 'email' => $this->email, - 'token' => $this->token, + 'email' => $this->email, + 'token' => $this->token, ], $this->url['notifications'].$notificationCode, false); } elseif ($notificationType == 'preApproval') { return $this->sendTransaction([ - 'email' => $this->email, - 'token' => $this->token, + 'email' => $this->email, + 'token' => $this->token, ], $this->url['preApprovalNotifications'].$notificationCode, false); } } diff --git a/src/Artistas/PagSeguroRecorrente.php b/src/Artistas/PagSeguroRecorrente.php index 6ff76fb..853e480 100644 --- a/src/Artistas/PagSeguroRecorrente.php +++ b/src/Artistas/PagSeguroRecorrente.php @@ -206,14 +206,14 @@ public function setSenderInfo(array $senderInfo) private function validateSenderInfo(array $senderInfo) { $rules = [ - 'name' => 'required|max:50', - 'ip' => 'ip', - 'senderAreaCode' => 'required|digits:2', - 'senderPhone' => 'required|digits_between:8,9', - 'email' => 'required|email|max:60', - 'hash' => 'required', - 'senderCPF' => 'required_without:senderCNPJ|digits:11', - 'senderCNPJ' => 'required_without:senderCPF|digits:14', + 'name' => 'required|max:50', + 'ip' => 'ip', + 'senderAreaCode' => 'required|digits:2', + 'senderPhone' => 'required|digits_between:8,9', + 'email' => 'required|email|max:60', + 'hash' => 'required', + 'senderCPF' => 'required_without:senderCNPJ|digits:11', + 'senderCNPJ' => 'required_without:senderCPF|digits:14', ]; $this->validate($senderInfo, $rules); @@ -231,11 +231,11 @@ public function setCreditCardHolder(array $creditCardHolder) $cardHolderPhone = $this->sanitizeNumber($creditCardHolder, 'creditCardHolderPhone'); $creditCardHolder = [ - 'name' => $this->fallbackValue($this->sanitize($creditCardHolder, 'creditCardHolderName'), $this->senderInfo, 'name'), - 'creditCardHolderAreaCode' => $this->fallbackValue(substr($cardHolderPhone, 0, 2), $this->senderInfo, 'senderAreaCode'), - 'creditCardHolderPhone' => $this->fallbackValue(substr($cardHolderPhone, 2), $this->senderInfo, 'senderPhone'), - 'creditCardHolderCPF' => $this->fallbackValue($this->sanitizeNumber($creditCardHolder, 'creditCardHolderCPF'), $this->senderInfo, 'senderCPF'), - 'birthDate' => $this->sanitize($creditCardHolder, 'creditCardHolderBirthDate'), + 'name' => $this->fallbackValue($this->sanitize($creditCardHolder, 'creditCardHolderName'), $this->senderInfo, 'name'), + 'creditCardHolderAreaCode' => $this->fallbackValue(substr($cardHolderPhone, 0, 2), $this->senderInfo, 'senderAreaCode'), + 'creditCardHolderPhone' => $this->fallbackValue(substr($cardHolderPhone, 2), $this->senderInfo, 'senderPhone'), + 'creditCardHolderCPF' => $this->fallbackValue($this->sanitizeNumber($creditCardHolder, 'creditCardHolderCPF'), $this->senderInfo, 'senderCPF'), + 'birthDate' => $this->sanitize($creditCardHolder, 'creditCardHolderBirthDate'), ]; $this->validateCreditCardHolder($creditCardHolder); @@ -252,11 +252,11 @@ public function setCreditCardHolder(array $creditCardHolder) private function validateCreditCardHolder(array $creditCardHolder) { $rules = [ - 'name' => 'required|max:50', - 'creditCardHolderAreaCode' => 'required|digits:2', - 'creditCardHolderPhone' => 'required|digits_between:8,9', - 'creditCardHolderCPF' => 'required|digits:11', - 'birthDate' => 'required', + 'name' => 'required|max:50', + 'creditCardHolderAreaCode' => 'required|digits:2', + 'creditCardHolderPhone' => 'required|digits_between:8,9', + 'creditCardHolderCPF' => 'required|digits:11', + 'birthDate' => 'required', ]; $this->validate($creditCardHolder, $rules); @@ -272,14 +272,14 @@ private function validateCreditCardHolder(array $creditCardHolder) public function setSenderAddress(array $senderAddress) { $senderAddress = [ - 'street' => $this->sanitize($senderAddress, 'senderAddressStreet'), - 'number' => $this->sanitize($senderAddress, 'senderAddressNumber'), - 'complement' => $this->sanitize($senderAddress, 'senderAddressComplement'), - 'district' => $this->sanitize($senderAddress, 'senderAddressDistrict'), - 'postalCode' => $this->sanitizeNumber($senderAddress, 'senderAddressPostalCode'), - 'city' => $this->sanitize($senderAddress, 'senderAddressCity'), - 'state' => strtoupper($this->checkValue($senderAddress, 'senderAddressState')), - 'country' => 'BRA', + 'street' => $this->sanitize($senderAddress, 'senderAddressStreet'), + 'number' => $this->sanitize($senderAddress, 'senderAddressNumber'), + 'complement' => $this->sanitize($senderAddress, 'senderAddressComplement'), + 'district' => $this->sanitize($senderAddress, 'senderAddressDistrict'), + 'postalCode' => $this->sanitizeNumber($senderAddress, 'senderAddressPostalCode'), + 'city' => $this->sanitize($senderAddress, 'senderAddressCity'), + 'state' => strtoupper($this->checkValue($senderAddress, 'senderAddressState')), + 'country' => 'BRA', ]; $this->validateSenderAddress($senderAddress); @@ -296,13 +296,13 @@ public function setSenderAddress(array $senderAddress) private function validateSenderAddress(array $senderAddress) { $rules = [ - 'street' => 'required|max:80', - 'number' => 'required|max:20', - 'complement' => 'max:40', - 'district' => 'required|max:60', - 'postalCode' => 'required|digits:8', - 'city' => 'required|min:2|max:60', - 'state' => 'required|min:2|max:2', + 'street' => 'required|max:80', + 'number' => 'required|max:20', + 'complement' => 'max:40', + 'district' => 'required|max:60', + 'postalCode' => 'required|digits:8', + 'city' => 'required|min:2|max:60', + 'state' => 'required|min:2|max:2', ]; $this->validate($senderAddress, $rules); @@ -318,14 +318,14 @@ private function validateSenderAddress(array $senderAddress) public function setBillingAddress(array $billingAddress) { $billingAddress = [ - 'street' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressStreet'), $this->senderAddress, 'street'), - 'number' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressNumber'), $this->senderAddress, 'number'), - 'complement' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressComplement'), $this->senderAddress, 'complement'), - 'district' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressDistrict'), $this->senderAddress, 'district'), - 'postalCode' => $this->fallbackValue($this->sanitizeNumber($billingAddress, 'billingAddressPostalCode'), $this->senderAddress, 'postalCode'), - 'city' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressCity'), $this->senderAddress, 'city'), - 'state' => strtoupper($this->fallbackValue($this->checkValue($billingAddress, 'billingAddressState'), $this->senderAddress, 'state')), - 'country' => 'BRA', + 'street' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressStreet'), $this->senderAddress, 'street'), + 'number' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressNumber'), $this->senderAddress, 'number'), + 'complement' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressComplement'), $this->senderAddress, 'complement'), + 'district' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressDistrict'), $this->senderAddress, 'district'), + 'postalCode' => $this->fallbackValue($this->sanitizeNumber($billingAddress, 'billingAddressPostalCode'), $this->senderAddress, 'postalCode'), + 'city' => $this->fallbackValue($this->sanitize($billingAddress, 'billingAddressCity'), $this->senderAddress, 'city'), + 'state' => strtoupper($this->fallbackValue($this->checkValue($billingAddress, 'billingAddressState'), $this->senderAddress, 'state')), + 'country' => 'BRA', ]; $this->validateBillingAddress($billingAddress); @@ -342,13 +342,13 @@ public function setBillingAddress(array $billingAddress) private function validateBillingAddress(array $billingAddress) { $rules = [ - 'street' => 'required|max:80', - 'number' => 'required|max:20', - 'complement' => 'max:40', - 'district' => 'required|max:60', - 'postalCode' => 'required|digits:8', - 'city' => 'required|min:2|max:60', - 'state' => 'required|min:2|max:2', + 'street' => 'required|max:80', + 'number' => 'required|max:20', + 'complement' => 'max:40', + 'district' => 'required|max:60', + 'postalCode' => 'required|digits:8', + 'city' => 'required|min:2|max:60', + 'state' => 'required|min:2|max:2', ]; $this->validate($billingAddress, $rules); @@ -400,7 +400,7 @@ public function sendPreApprovalPaymentMethod(array $paymentSettings) private function validatePaymentSettings(array $paymentSettings) { $rules = [ - 'creditCardToken' => 'required', + 'creditCardToken' => 'required', ]; $this->validate($paymentSettings, $rules); @@ -587,8 +587,8 @@ public function showPreApproval($preApprovalCode) public function sendDiscount(array $discountSettings) { $discountSettings = [ - 'type' => $this->sanitize($discountSettings, 'type'), - 'value' => $this->sanitize($discountSettings, 'value'), + 'type' => $this->sanitize($discountSettings, 'type'), + 'value' => $this->sanitize($discountSettings, 'value'), ]; $this->validateDiscountSettings($discountSettings); @@ -605,8 +605,8 @@ public function sendDiscount(array $discountSettings) private function validateDiscountSettings(array $discountSettings) { $rules = [ - 'type' => 'required|in:DISCOUNT_PERCENT,DISCOUNT_AMOUNT', - 'value' => 'required|numeric|min:0', + 'type' => 'required|in:DISCOUNT_PERCENT,DISCOUNT_AMOUNT', + 'value' => 'required|numeric|min:0', ]; $this->validate($discountSettings, $rules); diff --git a/src/Artistas/PagSeguroServiceProvider.php b/src/Artistas/PagSeguroServiceProvider.php index 44c9ea6..ff8f84f 100644 --- a/src/Artistas/PagSeguroServiceProvider.php +++ b/src/Artistas/PagSeguroServiceProvider.php @@ -33,9 +33,11 @@ public function boot() require __DIR__.'/routes.php'; } - $this->publishes([ - __DIR__.'/Config.php' => config_path('pagseguro.php'), - ], - 'config'); + $this->publishes( + [ + __DIR__.'/Config.php' => config_path('pagseguro.php'), + ], + 'config' + ); } }