Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #247 from moip/release/v3.0.0
Browse files Browse the repository at this point in the history
[RELEASE] v3.0.0
  • Loading branch information
mbnakaya authored Jan 5, 2018
2 parents 4e06972 + 95600d1 commit bb9f995
Show file tree
Hide file tree
Showing 18 changed files with 510 additions and 58 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: php

php:
- 7.0
- 7.1
- 7.2

before_script:
- travis_retry composer self-update
Expand Down
55 changes: 41 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,59 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<a name="v3.0.0"></a>
## v3.0.0 (2018-01-04)


#### Bug Fixes

* Fixed errors treatment ([3862cc69](https://github.com/moip/moip-sdk-php/commit/3862cc69))

#### Features

* **Holder** Add Holder resource and resolves Holder params. ([9f84f793](https://github.com/moip/moip-sdk-php/commit/9f84f793))
* **Order**
* map attributes on order creation ([8f9755ef](https://github.com/moip/moip-sdk-php/commit/8f9755ef))
* add attribute paid to order creation mock ([2f01ad91](https://github.com/moip/moip-sdk-php/commit/2f01ad91))
* remove shipping address attributes from populate ([7eda9b6f](https://github.com/moip/moip-sdk-php/commit/7eda9b6f))

#### Tests

* Support PHPUnit 5 and 6 ([5a316192](https://github.com/moip/moip-sdk-php/commit/5a316192))
* Test against PHP 7.1 and 7.2 ([c6983f63](https://github.com/moip/moip-sdk-php/commit/c6983f63))
* **Order**
* add tests for the new mapped attributes ([9c99d832](https://github.com/moip/moip-sdk-php/commit/9c99d832))
* add attribute paid to order creation mock ([2f01ad91](https://github.com/moip/moip-sdk-php/commit/2f01ad91))

#### BREAKING CHANGES
The type `Holder` was added to be used on payment creation and on some other features linked on funding instrument.

<a name="v2.2.0"></a>
## v2.2.0 (2017-11-01)
# [](https://github.com/moip/moip-sdk-php/compare/v2.1.0...v2.2.0) (2017-11-01)


#### Bug Fixes

* Prevent notice when tax document or receivers are not returned ((6f6c10bd))
* Prevent notice when tax document or receivers are not returned ([6f6c10bd](https://github.com/moip/moip-sdk-php/commit/6f6c10bd))
* **Transfers**
* Improved fix to issue #184 ((a6e992f2))
* Fix setHolder warning when called before setTransfers (#184). ((33f9126d))
* Improved fix to issue #184 ([a6e992f2](https://github.com/moip/moip-sdk-php/commit/a6e992f2))
* Fix setHolder warning when called before setTransfers (#184). ([33f9126d](https://github.com/moip/moip-sdk-php/commit/33f9126d))

#### Features

* **BankAccount** Created bank account get id, get list, delete, update (#185) ((a4ac12d8))
* **Keys** adds method to get public key from moip account ((fc2143a2))
* **BankAccount** Created bank account get id, get list, delete, update (#185) ([a4ac12d8](https://github.com/moip/moip-sdk-php/commit/a4ac12d8))
* **Keys** adds method to get public key from moip account ([fc2143a2](https://github.com/moip/moip-sdk-php/commit/fc2143a2))
* **NotificationPreferences**
* added method to get a notification preference ((d9f40623))
* Added method to get a list of notifications ((9be2ae45))
* added method to get a notification preference ([d9f40623](https://github.com/moip/moip-sdk-php/commit/d9f40623))
* Added method to get a list of notifications ([9be2ae45](https://github.com/moip/moip-sdk-php/commit/9be2ae45))
* **Payment**
* changed 'get' method to allow get a payment without get an order first ((7874a7ed))
* add method 'cancel' to cancel pre-authorized payments ((858cece3))
* changed 'capture' method to allow multipayments ((32d70e76))
* **Transfers** Added get list, get id, revert and getters ((8c03c932))
* changed 'get' method to allow get a payment without get an order first ([7874a7ed](https://github.com/moip/moip-sdk-php/commit/7874a7ed))
* add method 'cancel' to cancel pre-authorized payments ([858cece3](https://github.com/moip/moip-sdk-php/commit/858cece3))
* changed 'capture' method to allow multipayments ([32d70e76](https://github.com/moip/moip-sdk-php/commit/32d70e76))
* **Transfers** Added get list, get id, revert and getters ([8c03c932](https://github.com/moip/moip-sdk-php/commit/8c03c932))
* **account**
* added getCreatedAt function ((98b1ff3b))
* added missing properties to account ((14256c08))
* added getCreatedAt function ([98b1ff3b](https://github.com/moip/moip-sdk-php/commit/98b1ff3b))
* added missing properties to account ([14256c08](https://github.com/moip/moip-sdk-php/commit/14256c08))

<a name="v2.1.0"></a>
# [](https://github.com/moip/moip-sdk-php/compare/v2.0.0...v2.1.0) (2017-10-09)
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- [Pagamentos](#pagamentos)
- [Criação](#criação)
- [Cartão de Crédito](#cartão-de-crédito)
- [Inserir dados do portador](#inserir-dados-do-portador)
- [Com Hash](#com-hash)
- [Com Dados do Cartão](#com-dados-do-cartão)
- [Com Boleto](#criando-um-pagamento-com-boleto)
Expand Down Expand Up @@ -255,13 +256,23 @@ $orders = $this->moip->orders()->getList(new Pagination(10,0), $filters, 'josé
#### Cartão de crédito
Após criar o pedido basta criar um pagamento nesse pedido.

##### Inserir dados do portador
Para realizar o pagamento, via cartão de crédito, utilizando o cartão de um terceiro (quando o cliente não é o portador do cartão que será utilizado), é necessário que estes dados sejam diferenciados e informados corretamente, para cada etapa do fluxo.

```php
$holder = $this->moip->holders()->setFullname('Jose Silva')
->setBirthDate(\DateTime::createFromFormat($this->date_format, $this->date_string))
->setTaxDocument('22222222222', 'CPF')
->setPhone(11, 66778899, 55)
->setAddress(Holder::ADDRESS_BILLING, 'Avenida Faria Lima', '2927', 'Itaim', 'Sao Paulo', 'SP', '01234000', 'Apt 101');
```
##### Com hash
> Para mais detalhes sobre a geração de hash com os dados do cartão [consulte a documentação.](https://dev.moip.com.br/docs/criptografia-de-cartao)
```php
$hash = 'i1naupwpTLrCSXDnigLLTlOgtm+xBWo6iX54V/hSyfBeFv3rvqa1VyQ8/pqWB2JRQX2GhzfGppXFPCmd/zcmMyDSpdnf1GxHQHmVemxu4AZeNxs+TUAbFWsqEWBa6s95N+O4CsErzemYZHDhsjEgJDe17EX9MqgbN3RFzRmZpJqRvqKXw9abze8hZfEuUJjC6ysnKOYkzDBEyQibvGJjCv3T/0Lz9zFruSrWBw+NxWXNZjXSY0KF8MKmW2Gx1XX1znt7K9bYNfhA/QO+oD+v42hxIeyzneeRcOJ/EXLEmWUsHDokevOkBeyeN4nfnET/BatcDmv8dpGXrTPEoxmmGQ==';
$payment = $order->payments()
->setCreditCardHash($hash, $customer)
->setCreditCardHash($hash, $holder)
->setInstallmentCount(3)
->setStatementDescriptor('teste de pag')
->execute();
Expand All @@ -271,7 +282,7 @@ print_r($payment);
##### Com dados do cartão
> Esse método requer certificação PCI. [Consulte a documentação.](https://documentao-moip.readme.io/v2.0/reference#criar-pagamento)
```php
$payment = $order->payments()->setCreditCard(12, 21, '4073020000000002', '123', $customer)
$payment = $order->payments()->setCreditCard(12, 21, '4073020000000002', '123', $holder)
->execute();
print_r($payment);
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"rmccue/requests": ">=1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpunit/phpunit": "~4.8.35 || ^5.7 || ^6.4",
"codacy/coverage": "dev-master"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion examples/marketplace/multiorder_and_multipayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$moip = new Moip(new OAuth($token), Moip::ENDPOINT_SANDBOX);

try {

// Creating an object customer to orders
$customer = $moipMerchant->customers()->setOwnId(uniqid())
->setFullname('Fulano de Tal')
Expand Down
2 changes: 2 additions & 0 deletions src/Exceptions/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public static function parseErrors($json_string)
foreach ($error_obj->errors as $error) {
$errors[] = new self($error->code, $error->path, $error->description);
}
} elseif (!empty($error_obj->error)) {
$errors[] = new self('', '', $error_obj->error);
}

return $errors;
Expand Down
13 changes: 12 additions & 1 deletion src/Moip.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Moip\Resource\BankAccount;
use Moip\Resource\Customer;
use Moip\Resource\Entry;
use Moip\Resource\Holder;
use Moip\Resource\Keys;
use Moip\Resource\Multiorders;
use Moip\Resource\NotificationPreferences;
Expand Down Expand Up @@ -48,7 +49,7 @@ class Moip
*
* @const string
*/
const CLIENT_VERSION = '2.2.0';
const CLIENT_VERSION = '3.0.0';

/**
* Authentication that will be added to the header of request.
Expand Down Expand Up @@ -130,6 +131,16 @@ public function customers()
return new Customer($this);
}

/**
* Create a new Holder instance.
*
* @return \Moip\Resource\Holder
*/
public function holders()
{
return new Holder($this);
}

/**
* Create a new Account instance.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Resource/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function setEmail($email)
*
* @return $this
*/
public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, Customer $holder = null)
public function setCreditCard($expirationMonth, $expirationYear, $number, $cvc, Holder $holder = null)
{
if ($holder === null) {
$holder = $this;
Expand Down
Loading

0 comments on commit bb9f995

Please sign in to comment.