@@ -166,7 +166,7 @@ |
||
| 166 | 166 | /** |
| 167 | 167 | * Create a new order in MoIP. |
| 168 | 168 | * |
| 169 | - * @return Orders |
|
| 169 | + * @return stdClass |
|
| 170 | 170 | */ |
| 171 | 171 | public function create() |
| 172 | 172 | { |
@@ -74,6 +74,9 @@ |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | + /** |
|
| 78 | + * @param string $key |
|
| 79 | + */ |
|
| 77 | 80 | protected function getIfSetDateFmt($key, $fmt, stdClass $data = null) |
| 78 | 81 | { |
| 79 | 82 | $val = $this->getIfSet($key, $data); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * |
| 38 | 38 | * @param \Requests_Hooks $hooks Hook system |
| 39 | 39 | */ |
| 40 | - public function register(Requests_Hooks &$hooks) |
|
| 40 | + public function register(Requests_Hooks & $hooks) |
|
| 41 | 41 | { |
| 42 | 42 | $hooks->register('requests.before_request', [&$this, 'before_request']); |
| 43 | 43 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @param string $moip_id |
| 104 | 104 | * |
| 105 | - * @return \Moip\Resource\Account |
|
| 105 | + * @return stdClass |
|
| 106 | 106 | */ |
| 107 | 107 | public function get($moip_id) |
| 108 | 108 | { |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | /** |
| 292 | 292 | * Set name from account. |
| 293 | 293 | * |
| 294 | - * @param string $name Account's person name. |
|
| 295 | 294 | * |
| 295 | + * @param string $lastname |
|
| 296 | 296 | * @return \Moip\Resource\Account |
| 297 | 297 | */ |
| 298 | 298 | public function setLastName($lastname) |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | /** |
| 306 | 306 | * Set birth date from account. |
| 307 | 307 | * |
| 308 | - * @param \DateTime|string $birthDate Date of birth of the credit card holder. |
|
| 308 | + * @param string $birthDate Date of birth of the credit card holder. |
|
| 309 | 309 | * |
| 310 | 310 | * @return \Moip\Resource\Account |
| 311 | 311 | */ |
@@ -361,8 +361,8 @@ discard block |
||
| 361 | 361 | * |
| 362 | 362 | * @param string $number Número do documento. |
| 363 | 363 | * @param string $issuer Emissor do documento. |
| 364 | - * @param \DateTime|string $birthDate $issueDate Data de emissão do documento. |
|
| 365 | 364 | * @param string $type Tipo do documento. Valores possíveis: RG. |
| 365 | + * @param string $issueDate |
|
| 366 | 366 | * |
| 367 | 367 | * @return \Moip\Resource\Account |
| 368 | 368 | */ |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Moip\Resource; |
| 4 | 4 | |
| 5 | 5 | use stdClass; |
| 6 | -use UnexpectedValueException; |
|
| 7 | 6 | |
| 8 | 7 | /** |
| 9 | 8 | * Class Account. |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | */ |
| 137 | 137 | public function getFullname() |
| 138 | 138 | { |
| 139 | - return $this->getIfSet('name', $this->data->person) . ' ' . $this->getIfSet('lastName', $this->data->person); |
|
| 139 | + return $this->getIfSet('name', $this->data->person).' '.$this->getIfSet('lastName', $this->data->person); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function getType() |
| 216 | 216 | { |
| 217 | - return $this->getIfSet('type', $this->data); |
|
| 217 | + return $this->getIfSet('type', $this->data); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | //Account's company getters |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public function setName($name) |
| 429 | 429 | { |
| 430 | - $this->data->person->name = $name; |
|
| 430 | + $this->data->person->name = $name; |
|
| 431 | 431 | |
| 432 | - return $this; |
|
| 432 | + return $this; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -441,9 +441,9 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | public function setLastName($lastname) |
| 443 | 443 | { |
| 444 | - $this->data->person->lastName = $lastname; |
|
| 444 | + $this->data->person->lastName = $lastname; |
|
| 445 | 445 | |
| 446 | - return $this; |
|
| 446 | + return $this; |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -512,13 +512,13 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | public function setIdentityDocument($number, $issuer, $issueDate, $type = 'RG') |
| 514 | 514 | { |
| 515 | - $this->data->person->identityDocument = new stdClass(); |
|
| 516 | - $this->data->person->identityDocument->type = $type; |
|
| 517 | - $this->data->person->identityDocument->number = $number; |
|
| 518 | - $this->data->person->identityDocument->issuer = $issuer; |
|
| 519 | - $this->data->person->identityDocument->issueDate = $issueDate; |
|
| 515 | + $this->data->person->identityDocument = new stdClass(); |
|
| 516 | + $this->data->person->identityDocument->type = $type; |
|
| 517 | + $this->data->person->identityDocument->number = $number; |
|
| 518 | + $this->data->person->identityDocument->issuer = $issuer; |
|
| 519 | + $this->data->person->identityDocument->issueDate = $issueDate; |
|
| 520 | 520 | |
| 521 | - return $this; |
|
| 521 | + return $this; |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | /** |
@@ -530,9 +530,9 @@ discard block |
||
| 530 | 530 | */ |
| 531 | 531 | public function setType($type) |
| 532 | 532 | { |
| 533 | - $this->data->type = $type; |
|
| 533 | + $this->data->type = $type; |
|
| 534 | 534 | |
| 535 | - return $this; |
|
| 535 | + return $this; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | //Account's company setters |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | /** |
| 145 | 145 | * Creates a account. |
| 146 | 146 | * |
| 147 | - * @return Account |
|
| 147 | + * @return \stdClass |
|
| 148 | 148 | */ |
| 149 | 149 | public function createAccount() |
| 150 | 150 | { |
@@ -141,30 +141,30 @@ |
||
| 141 | 141 | return $customer; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Creates a account. |
|
| 146 | - * |
|
| 147 | - * @return Account |
|
| 148 | - */ |
|
| 149 | - public function createAccount() |
|
| 150 | - { |
|
| 151 | - $moip = new Moip(new MoipOAuth('1tldio91gi74r34zv30d4saz8yuuws5'), Moip::ENDPOINT_SANDBOX); |
|
| 144 | + /** |
|
| 145 | + * Creates a account. |
|
| 146 | + * |
|
| 147 | + * @return Account |
|
| 148 | + */ |
|
| 149 | + public function createAccount() |
|
| 150 | + { |
|
| 151 | + $moip = new Moip(new MoipOAuth('1tldio91gi74r34zv30d4saz8yuuws5'), Moip::ENDPOINT_SANDBOX); |
|
| 152 | 152 | |
| 153 | - $uniqEmail = 'fulano' . uniqid('MPA-') . '@detal123.com.br'; |
|
| 153 | + $uniqEmail = 'fulano' . uniqid('MPA-') . '@detal123.com.br'; |
|
| 154 | 154 | |
| 155 | - $account = $moip->accounts() |
|
| 156 | - ->setEmail($uniqEmail) |
|
| 157 | - ->setName('Fulano') |
|
| 158 | - ->setLastName('de Tal') |
|
| 159 | - ->setBirthDate('1987-11-27') |
|
| 160 | - ->setTaxDocument('22222222222') |
|
| 161 | - ->setPhone(11,988888888) |
|
| 162 | - ->addAddress('Av. Ibirapuera', '2035', 'Moema', 'Sao Paulo', 'SP', '04078010') |
|
| 163 | - ->setIdentityDocument('411111115', 'SSP', '2000-05-06') |
|
| 164 | - ->create(); |
|
| 155 | + $account = $moip->accounts() |
|
| 156 | + ->setEmail($uniqEmail) |
|
| 157 | + ->setName('Fulano') |
|
| 158 | + ->setLastName('de Tal') |
|
| 159 | + ->setBirthDate('1987-11-27') |
|
| 160 | + ->setTaxDocument('22222222222') |
|
| 161 | + ->setPhone(11,988888888) |
|
| 162 | + ->addAddress('Av. Ibirapuera', '2035', 'Moema', 'Sao Paulo', 'SP', '04078010') |
|
| 163 | + ->setIdentityDocument('411111115', 'SSP', '2000-05-06') |
|
| 164 | + ->create(); |
|
| 165 | 165 | |
| 166 | - return $account; |
|
| 167 | - } |
|
| 166 | + return $account; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * Creates an order. |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $moip = new Moip(new MoipOAuth('1tldio91gi74r34zv30d4saz8yuuws5'), Moip::ENDPOINT_SANDBOX); |
| 152 | 152 | |
| 153 | - $uniqEmail = 'fulano' . uniqid('MPA-') . '@detal123.com.br'; |
|
| 153 | + $uniqEmail = 'fulano'.uniqid('MPA-').'@detal123.com.br'; |
|
| 154 | 154 | |
| 155 | 155 | $account = $moip->accounts() |
| 156 | 156 | ->setEmail($uniqEmail) |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | ->setLastName('de Tal') |
| 159 | 159 | ->setBirthDate('1987-11-27') |
| 160 | 160 | ->setTaxDocument('22222222222') |
| 161 | - ->setPhone(11,988888888) |
|
| 161 | + ->setPhone(11, 988888888) |
|
| 162 | 162 | ->addAddress('Av. Ibirapuera', '2035', 'Moema', 'Sao Paulo', 'SP', '04078010') |
| 163 | 163 | ->setIdentityDocument('411111115', 'SSP', '2000-05-06') |
| 164 | 164 | ->create(); |
@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | $this->assertEquals($customer, $this->moip->customers()); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Test should return instance of \Moip\Resource\Account. |
|
| 27 | - */ |
|
| 28 | - public function testShouldReceiveInstanceOfAccount() |
|
| 29 | - { |
|
| 30 | - $account = new \Moip\Resource\Account($this->moip); |
|
| 25 | + /** |
|
| 26 | + * Test should return instance of \Moip\Resource\Account. |
|
| 27 | + */ |
|
| 28 | + public function testShouldReceiveInstanceOfAccount() |
|
| 29 | + { |
|
| 30 | + $account = new \Moip\Resource\Account($this->moip); |
|
| 31 | 31 | |
| 32 | - $this->assertEquals($account, $this->moip->accounts()); |
|
| 33 | - } |
|
| 32 | + $this->assertEquals($account, $this->moip->accounts()); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Test should return instance of \Moip\Resource\Entry. |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $this->assertEquals("https://sandbox.moip.com.br/v2/orders/$order_id", $links->getLink('self')->getHref()); |
| 191 | 191 | // test nested links |
| 192 | 192 | $this->assertEquals("https://checkout-new-sandbox.moip.com.br?id=$order_id&payment-method=credit-card", |
| 193 | - preg_replace('/token=[^&]*&/', '', $links->getLink('payCreditCard')->getHref())); |
|
| 193 | + preg_replace('/token=[^&]*&/', '', $links->getLink('payCreditCard')->getHref())); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * |
| 38 | 38 | * @param \Requests_Hooks $hooks Hook system |
| 39 | 39 | */ |
| 40 | - public function register(Requests_Hooks &$hooks) |
|
| 40 | + public function register(Requests_Hooks & $hooks) |
|
| 41 | 41 | { |
| 42 | 42 | $hooks->register('requests.before_request', [&$this, 'before_request']); |
| 43 | 43 | } |
@@ -154,15 +154,15 @@ discard block |
||
| 154 | 154 | return $refund; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * Get payment status. |
|
| 159 | - * |
|
| 160 | - * @return string Payment status. Possible values CREATED, WAITING, IN_ANALYSIS, PRE_AUTHORIZED, AUTHORIZED, CANCELLED, REFUNDED, REVERSED, SETTLED |
|
| 161 | - */ |
|
| 162 | - public function getStatus() |
|
| 163 | - { |
|
| 164 | - return $this->getIfSet('status'); |
|
| 165 | - } |
|
| 157 | + /** |
|
| 158 | + * Get payment status. |
|
| 159 | + * |
|
| 160 | + * @return string Payment status. Possible values CREATED, WAITING, IN_ANALYSIS, PRE_AUTHORIZED, AUTHORIZED, CANCELLED, REFUNDED, REVERSED, SETTLED |
|
| 161 | + */ |
|
| 162 | + public function getStatus() |
|
| 163 | + { |
|
| 164 | + return $this->getIfSet('status'); |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * get creation time. |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $this->data->fundingInstrument->creditCard->holder->phone->countryCode = $holder->getPhoneCountryCode(); |
| 262 | 262 | $this->data->fundingInstrument->creditCard->holder->phone->areaCode = $holder->getPhoneAreaCode(); |
| 263 | 263 | $this->data->fundingInstrument->creditCard->holder->phone->number = $holder->getPhoneNumber(); |
| 264 | - $this->data->fundingInstrument->creditCard->holder->billingAddress = $holder->getBillingAddress(); |
|
| 264 | + $this->data->fundingInstrument->creditCard->holder->billingAddress = $holder->getBillingAddress(); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |