{"action":"created","issue":{"url":"https://api.github.com/repos/konduto/php-sdk/issues/4","repository_url":"https://api.github.com/repos/konduto/php-sdk","labels_url":"https://api.github.com/repos/konduto/php-sdk/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/konduto/php-sdk/issues/4/comments","events_url":"https://api.github.com/repos/konduto/php-sdk/issues/4/events","html_url":"https://github.com/konduto/php-sdk/issues/4","id":176785762,"number":4,"title":"Payment","user":{"login":"kassioribeiro","id":537942,"avatar_url":"https://avatars.githubusercontent.com/u/537942?v=3","gravatar_id":"","url":"https://api.github.com/users/kassioribeiro","html_url":"https://github.com/kassioribeiro","followers_url":"https://api.github.com/users/kassioribeiro/followers","following_url":"https://api.github.com/users/kassioribeiro/following{/other_user}","gists_url":"https://api.github.com/users/kassioribeiro/gists{/gist_id}","starred_url":"https://api.github.com/users/kassioribeiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kassioribeiro/subscriptions","organizations_url":"https://api.github.com/users/kassioribeiro/orgs","repos_url":"https://api.github.com/users/kassioribeiro/repos","events_url":"https://api.github.com/users/kassioribeiro/events{/privacy}","received_events_url":"https://api.github.com/users/kassioribeiro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-14T00:34:49Z","updated_at":"2016-09-15T13:58:31Z","closed_at":null,"body":"boa noite!\r\nEstou tentando setar o Payment para o objeto Order. No entanto, está sendo retornado para sempre a seguinte mensagem: \"send orderArray ( [status] => error [message] => stdClass Object ( [where] => /payment [why] => stdClass Object ( [expected] => Array ( [0] => array ) [found] => object ) ) ) \"\r\n\r\nEstou setando um array no método setPayment da Order. Segue o código:\r\n\r\n`$orderKonduto = new Models\\Order();`\r\n`$paymentKonduto = array(`\r\n`                \"type\" => Models\\Payment::TYPE_CREDIT,`\r\n `               \"bin\" => substr($payment[\"credit_card_number\"], 0, 6), // 6 primeiros digitos do cartao de credito`\r\n  `              \"last4\" => substr($payment[\"credit_card_number\"], strlen($payment[\"credit_card_number\"]) - 4, strlen($payment[\"credit_card_number\"])),`\r\n `               \"expiration_date\" => $ed_month.$ed_year`\r\n  `          );`\r\n`$orderKonduto->setPayment($paymentKonduto);`\r\n\r\nA mensagem diz que estou setando um objeto, mas estou setando um array mesmo.\r\n"},"comment":{"url":"https://api.github.com/repos/konduto/php-sdk/issues/comments/247335717","html_url":"https://github.com/konduto/php-sdk/issues/4#issuecomment-247335717","issue_url":"https://api.github.com/repos/konduto/php-sdk/issues/4","id":247335717,"user":{"login":"adri0","id":8104069,"avatar_url":"https://avatars.githubusercontent.com/u/8104069?v=3","gravatar_id":"","url":"https://api.github.com/users/adri0","html_url":"https://github.com/adri0","followers_url":"https://api.github.com/users/adri0/followers","following_url":"https://api.github.com/users/adri0/following{/other_user}","gists_url":"https://api.github.com/users/adri0/gists{/gist_id}","starred_url":"https://api.github.com/users/adri0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adri0/subscriptions","organizations_url":"https://api.github.com/users/adri0/orgs","repos_url":"https://api.github.com/users/adri0/repos","events_url":"https://api.github.com/users/adri0/events{/privacy}","received_events_url":"https://api.github.com/users/adri0/received_events","type":"User","site_admin":false},"created_at":"2016-09-15T13:58:31Z","updated_at":"2016-09-15T13:58:31Z","body":"Olá @kassioribeiro. Para consertar o erro você deve colocar a variável `$paymentKonduto` dentro de outro array. Assim:\r\n```php\r\n$payment = array($paymentKonduto);\r\n$orderKonduto->setPayment($payment);\r\n```\r\n O método `setPayment` aceita somente um array cujos elementos são meios de pagamentos. O array que você definiu representa 1 meio de pagamento (poderia ter mais de 1). \r\n\r\nNo php quando um _associative array_ é [convertido para json](http://php.net/manual/pt_BR/function.json-encode.php) ele vira um objeto, por isso a mensagem que você está vendo diz que o campo `payment` só aceita array."}}
{"actor":{"display_login":"adri0"}}