{"action":"created","comment":{"url":"https://api.github.com/repos/mercadopago/px-android/pulls/comments/208717441","pull_request_review_id":144586361,"id":208717441,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODcxNzQ0MQ==","diff_hunk":"@@ -0,0 +1,70 @@\n+package com.mercadopago.android.px.internal.navigation;\n+\n+import android.support.annotation.NonNull;\n+import android.support.annotation.Nullable;\n+import com.mercadopago.android.px.internal.di.Session;\n+import com.mercadopago.android.px.model.Card;\n+import com.mercadopago.android.px.model.PaymentMethod;\n+import com.mercadopago.android.px.model.PaymentMethodSearch;\n+import com.mercadopago.android.px.model.PaymentTypes;\n+import com.mercadopago.android.px.model.Setting;\n+import com.mercadopago.android.px.preferences.PaymentPreference;\n+import com.mercadopago.android.px.services.util.TextUtil;\n+\n+public class DefaultPaymentMethodDriver {\n+\n+    @NonNull private final PaymentMethodSearch paymentMethods;\n+    @Nullable private final PaymentPreference preference;\n+    private boolean newCard;\n+\n+    public DefaultPaymentMethodDriver(@NonNull final PaymentMethodSearch paymentMethods,\n+        @Nullable final PaymentPreference preference) {\n+        this.paymentMethods = paymentMethods;\n+        this.preference = preference;\n+    }\n+\n+    private boolean isCard() {\n+        final PaymentMethod paymentMethod = paymentMethods.getPaymentMethodById(preference.getDefaultPaymentMethodId());\n+        return paymentMethod != null && PaymentTypes.isCardPaymentType(paymentMethod.getPaymentTypeId());\n+    }\n+\n+    public void drive(final PaymentMethodDriverCallback paymentMethodDriverCallback) {\n+        if (preference != null) {\n+            if (isCard() && isValid(preference.getDefaultCardId())) {\n+                final Card card = paymentMethods.getCardById(preference.getDefaultCardId());\n+                final PaymentMethod paymentMethod =\n+                    paymentMethods.getPaymentMethodById(preference.getDefaultPaymentMethodId());\n+                if(card.getSecurityCode() == null && paymentMethod.getSettings() != null && paymentMethod.getSettings().get(0) != null) {\n+                    card.setSecurityCode((paymentMethod.getSettings().get(0)).getSecurityCode());\n+                }\n+                card.setPaymentMethod(paymentMethod);\n+                paymentMethodDriverCallback.driveToCardVault(card);\n+            } else if (isNewCard()) {\n+                paymentMethodDriverCallback.driveToNewCardFlow();\n+            } else {\n+                paymentMethodDriverCallback.doNothing();\n+            }\n+        } else {\n+            paymentMethodDriverCallback.doNothing();\n+        }\n+    }\n+\n+    private boolean isValid(@Nullable final String cardId) {\n+        return !TextUtil.isEmpty(cardId) && paymentMethods.getCardById(cardId) != null;\n+    }\n+\n+    public boolean isNewCard() {","path":"px-checkout/src/main/java/com/mercadopago/android/px/internal/navigation/DefaultPaymentMethodDriver.java","position":56,"original_position":56,"commit_id":"ec3f9c2e1853f5ddd1bd8b84fc1c8669a6c62726","original_commit_id":"ec3f9c2e1853f5ddd1bd8b84fc1c8669a6c62726","user":{"login":"zehemz","id":7827612,"node_id":"MDQ6VXNlcjc4Mjc2MTI=","avatar_url":"https://avatars0.githubusercontent.com/u/7827612?v=4","gravatar_id":"","url":"https://api.github.com/users/zehemz","html_url":"https://github.com/zehemz","followers_url":"https://api.github.com/users/zehemz/followers","following_url":"https://api.github.com/users/zehemz/following{/other_user}","gists_url":"https://api.github.com/users/zehemz/gists{/gist_id}","starred_url":"https://api.github.com/users/zehemz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zehemz/subscriptions","organizations_url":"https://api.github.com/users/zehemz/orgs","repos_url":"https://api.github.com/users/zehemz/repos","events_url":"https://api.github.com/users/zehemz/events{/privacy}","received_events_url":"https://api.github.com/users/zehemz/received_events","type":"User","site_admin":false},"body":"Por que es public?","created_at":"2018-08-08T20:07:01Z","updated_at":"2018-08-08T20:07:01Z","html_url":"https://github.com/mercadopago/px-android/pull/1169#discussion_r208717441","pull_request_url":"https://api.github.com/repos/mercadopago/px-android/pulls/1169","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/mercadopago/px-android/pulls/comments/208717441"},"html":{"href":"https://github.com/mercadopago/px-android/pull/1169#discussion_r208717441"},"pull_request":{"href":"https://api.github.com/repos/mercadopago/px-android/pulls/1169"}}},"pull_request":{"url":"https://api.github.com/repos/mercadopago/px-android/pulls/1169","id":206717527,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NzE3NTI3","html_url":"https://github.com/mercadopago/px-android/pull/1169","diff_url":"https://github.com/mercadopago/px-android/pull/1169.diff","patch_url":"https://github.com/mercadopago/px-android/pull/1169.patch","issue_url":"https://api.github.com/repos/mercadopago/px-android/issues/1169","number":1169,"state":"open","locked":false,"title":"Feature moneyin add autoselect card","user":{"login":"nicolasfrugoni","id":37304177,"node_id":"MDQ6VXNlcjM3MzA0MTc3","avatar_url":"https://avatars2.githubusercontent.com/u/37304177?v=4","gravatar_id":"","url":"https://api.github.com/users/nicolasfrugoni","html_url":"https://github.com/nicolasfrugoni","followers_url":"https://api.github.com/users/nicolasfrugoni/followers","following_url":"https://api.github.com/users/nicolasfrugoni/following{/other_user}","gists_url":"https://api.github.com/users/nicolasfrugoni/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasfrugoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasfrugoni/subscriptions","organizations_url":"https://api.github.com/users/nicolasfrugoni/orgs","repos_url":"https://api.github.com/users/nicolasfrugoni/repos","events_url":"https://api.github.com/users/nicolasfrugoni/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasfrugoni/received_events","type":"User","site_admin":false},"body":"<!--- Escribir un resumen de los cambios en el Título de arriba -->\r\n\r\n## Motivación y Contexto\r\n<!--- ¿Por qué este cambio es requerido? ¿Qué problema resuelve? -->\r\n\r\n## Descripción\r\n<!--- Describir los cambios en detalle -->\r\n\r\n## Cómo probarlo\r\n<!--- Para bug fixes: Describir cómo reproducir el comportamiento que generaba el bug -->\r\n<!--- Para nuevos features: Se debe agregar el caso de uso a la app de ejemplos, y aquí se debe describir qué función de la app de ejemplos probar -->\r\n\r\n## Screenshots\r\n<!--- Para bug fixes: Incluir screenshots o videos del antes y después -->\r\n<!--- Para nuevos features: Incluir screenshots o videos de la nueva UI -->\r\n\r\n## Tipo de cambio (para el release manager)\r\n- [ ] Breaking change (Fix o feature que cambia una funcionalidad existente o rompe firmas)\r\n<!-- Describir qué cambia y como se hace la migración -->\r\n- [ ] Mi cambio afecta a los integradores internos\r\n<!-- Describir a qué equipos afecta para poder comunicarlo -->\r\n\r\n## Compartir conocimiento\r\n<!--- Compartir links a blog posts, patrones o librerías que se usaron para resolver este problema -->\r\n","created_at":"2018-08-07T14:27:49Z","updated_at":"2018-08-08T20:07:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9b7263b3fb48fda22741d82f068f21440b27720","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":942660359,"node_id":"MDU6TGFiZWw5NDI2NjAzNTk=","url":"https://api.github.com/repos/mercadopago/px-android/labels/WIP","name":"WIP","color":"e1f274","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mercadopago/px-android/pulls/1169/commits","review_comments_url":"https://api.github.com/repos/mercadopago/px-android/pulls/1169/comments","review_comment_url":"https://api.github.com/repos/mercadopago/px-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mercadopago/px-android/issues/1169/comments","statuses_url":"https://api.github.com/repos/mercadopago/px-android/statuses/ec3f9c2e1853f5ddd1bd8b84fc1c8669a6c62726","head":{"label":"nicolasfrugoni:feature_moneyin_add_autoselect_card","ref":"feature_moneyin_add_autoselect_card","sha":"ec3f9c2e1853f5ddd1bd8b84fc1c8669a6c62726","user":{"login":"nicolasfrugoni","id":37304177,"node_id":"MDQ6VXNlcjM3MzA0MTc3","avatar_url":"https://avatars2.githubusercontent.com/u/37304177?v=4","gravatar_id":"","url":"https://api.github.com/users/nicolasfrugoni","html_url":"https://github.com/nicolasfrugoni","followers_url":"https://api.github.com/users/nicolasfrugoni/followers","following_url":"https://api.github.com/users/nicolasfrugoni/following{/other_user}","gists_url":"https://api.github.com/users/nicolasfrugoni/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasfrugoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasfrugoni/subscriptions","organizations_url":"https://api.github.com/users/nicolasfrugoni/orgs","repos_url":"https://api.github.com/users/nicolasfrugoni/repos","events_url":"https://api.github.com/users/nicolasfrugoni/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasfrugoni/received_events","type":"User","site_admin":false},"repo":{"id":143062388,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNjIzODg=","name":"px-android","full_name":"nicolasfrugoni/px-android","owner":{"login":"nicolasfrugoni","id":37304177,"node_id":"MDQ6VXNlcjM3MzA0MTc3","avatar_url":"https://avatars2.githubusercontent.com/u/37304177?v=4","gravatar_id":"","url":"https://api.github.com/users/nicolasfrugoni","html_url":"https://github.com/nicolasfrugoni","followers_url":"https://api.github.com/users/nicolasfrugoni/followers","following_url":"https://api.github.com/users/nicolasfrugoni/following{/other_user}","gists_url":"https://api.github.com/users/nicolasfrugoni/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasfrugoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasfrugoni/subscriptions","organizations_url":"https://api.github.com/users/nicolasfrugoni/orgs","repos_url":"https://api.github.com/users/nicolasfrugoni/repos","events_url":"https://api.github.com/users/nicolasfrugoni/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasfrugoni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicolasfrugoni/px-android","description":"MercadoPago SDK Android","fork":true,"url":"https://api.github.com/repos/nicolasfrugoni/px-android","forks_url":"https://api.github.com/repos/nicolasfrugoni/px-android/forks","keys_url":"https://api.github.com/repos/nicolasfrugoni/px-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicolasfrugoni/px-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicolasfrugoni/px-android/teams","hooks_url":"https://api.github.com/repos/nicolasfrugoni/px-android/hooks","issue_events_url":"https://api.github.com/repos/nicolasfrugoni/px-android/issues/events{/number}","events_url":"https://api.github.com/repos/nicolasfrugoni/px-android/events","assignees_url":"https://api.github.com/repos/nicolasfrugoni/px-android/assignees{/user}","branches_url":"https://api.github.com/repos/nicolasfrugoni/px-android/branches{/branch}","tags_url":"https://api.github.com/repos/nicolasfrugoni/px-android/tags","blobs_url":"https://api.github.com/repos/nicolasfrugoni/px-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicolasfrugoni/px-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicolasfrugoni/px-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicolasfrugoni/px-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicolasfrugoni/px-android/statuses/{sha}","languages_url":"https://api.github.com/repos/nicolasfrugoni/px-android/languages","stargazers_url":"https://api.github.com/repos/nicolasfrugoni/px-android/stargazers","contributors_url":"https://api.github.com/repos/nicolasfrugoni/px-android/contributors","subscribers_url":"https://api.github.com/repos/nicolasfrugoni/px-android/subscribers","subscription_url":"https://api.github.com/repos/nicolasfrugoni/px-android/subscription","commits_url":"https://api.github.com/repos/nicolasfrugoni/px-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicolasfrugoni/px-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicolasfrugoni/px-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicolasfrugoni/px-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicolasfrugoni/px-android/contents/{+path}","compare_url":"https://api.github.com/repos/nicolasfrugoni/px-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicolasfrugoni/px-android/merges","archive_url":"https://api.github.com/repos/nicolasfrugoni/px-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicolasfrugoni/px-android/downloads","issues_url":"https://api.github.com/repos/nicolasfrugoni/px-android/issues{/number}","pulls_url":"https://api.github.com/repos/nicolasfrugoni/px-android/pulls{/number}","milestones_url":"https://api.github.com/repos/nicolasfrugoni/px-android/milestones{/number}","notifications_url":"https://api.github.com/repos/nicolasfrugoni/px-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicolasfrugoni/px-android/labels{/name}","releases_url":"https://api.github.com/repos/nicolasfrugoni/px-android/releases{/id}","deployments_url":"https://api.github.com/repos/nicolasfrugoni/px-android/deployments","created_at":"2018-07-31T20:14:01Z","updated_at":"2018-07-31T20:14:05Z","pushed_at":"2018-08-08T19:56:57Z","git_url":"git://github.com/nicolasfrugoni/px-android.git","ssh_url":"git@github.com:nicolasfrugoni/px-android.git","clone_url":"https://github.com/nicolasfrugoni/px-android.git","svn_url":"https://github.com/nicolasfrugoni/px-android","homepage":"http://mercadopago.github.io/px-android","size":80098,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mercadopago:release/4.0.0-beta-40.0.0","ref":"release/4.0.0-beta-40.0.0","sha":"082d7a7e752df0ad7ee9e427f119464242e485a7","user":{"login":"mercadopago","id":900583,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkwMDU4Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/900583?v=4","gravatar_id":"","url":"https://api.github.com/users/mercadopago","html_url":"https://github.com/mercadopago","followers_url":"https://api.github.com/users/mercadopago/followers","following_url":"https://api.github.com/users/mercadopago/following{/other_user}","gists_url":"https://api.github.com/users/mercadopago/gists{/gist_id}","starred_url":"https://api.github.com/users/mercadopago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercadopago/subscriptions","organizations_url":"https://api.github.com/users/mercadopago/orgs","repos_url":"https://api.github.com/users/mercadopago/repos","events_url":"https://api.github.com/users/mercadopago/events{/privacy}","received_events_url":"https://api.github.com/users/mercadopago/received_events","type":"Organization","site_admin":false},"repo":{"id":49529486,"node_id":"MDEwOlJlcG9zaXRvcnk0OTUyOTQ4Ng==","name":"px-android","full_name":"mercadopago/px-android","owner":{"login":"mercadopago","id":900583,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkwMDU4Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/900583?v=4","gravatar_id":"","url":"https://api.github.com/users/mercadopago","html_url":"https://github.com/mercadopago","followers_url":"https://api.github.com/users/mercadopago/followers","following_url":"https://api.github.com/users/mercadopago/following{/other_user}","gists_url":"https://api.github.com/users/mercadopago/gists{/gist_id}","starred_url":"https://api.github.com/users/mercadopago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercadopago/subscriptions","organizations_url":"https://api.github.com/users/mercadopago/orgs","repos_url":"https://api.github.com/users/mercadopago/repos","events_url":"https://api.github.com/users/mercadopago/events{/privacy}","received_events_url":"https://api.github.com/users/mercadopago/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mercadopago/px-android","description":"MercadoPago SDK Android","fork":false,"url":"https://api.github.com/repos/mercadopago/px-android","forks_url":"https://api.github.com/repos/mercadopago/px-android/forks","keys_url":"https://api.github.com/repos/mercadopago/px-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mercadopago/px-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mercadopago/px-android/teams","hooks_url":"https://api.github.com/repos/mercadopago/px-android/hooks","issue_events_url":"https://api.github.com/repos/mercadopago/px-android/issues/events{/number}","events_url":"https://api.github.com/repos/mercadopago/px-android/events","assignees_url":"https://api.github.com/repos/mercadopago/px-android/assignees{/user}","branches_url":"https://api.github.com/repos/mercadopago/px-android/branches{/branch}","tags_url":"https://api.github.com/repos/mercadopago/px-android/tags","blobs_url":"https://api.github.com/repos/mercadopago/px-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mercadopago/px-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mercadopago/px-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/mercadopago/px-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mercadopago/px-android/statuses/{sha}","languages_url":"https://api.github.com/repos/mercadopago/px-android/languages","stargazers_url":"https://api.github.com/repos/mercadopago/px-android/stargazers","contributors_url":"https://api.github.com/repos/mercadopago/px-android/contributors","subscribers_url":"https://api.github.com/repos/mercadopago/px-android/subscribers","subscription_url":"https://api.github.com/repos/mercadopago/px-android/subscription","commits_url":"https://api.github.com/repos/mercadopago/px-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/mercadopago/px-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/mercadopago/px-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/mercadopago/px-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/mercadopago/px-android/contents/{+path}","compare_url":"https://api.github.com/repos/mercadopago/px-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mercadopago/px-android/merges","archive_url":"https://api.github.com/repos/mercadopago/px-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mercadopago/px-android/downloads","issues_url":"https://api.github.com/repos/mercadopago/px-android/issues{/number}","pulls_url":"https://api.github.com/repos/mercadopago/px-android/pulls{/number}","milestones_url":"https://api.github.com/repos/mercadopago/px-android/milestones{/number}","notifications_url":"https://api.github.com/repos/mercadopago/px-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mercadopago/px-android/labels{/name}","releases_url":"https://api.github.com/repos/mercadopago/px-android/releases{/id}","deployments_url":"https://api.github.com/repos/mercadopago/px-android/deployments","created_at":"2016-01-12T21:18:39Z","updated_at":"2018-08-08T14:41:50Z","pushed_at":"2018-08-08T19:56:59Z","git_url":"git://github.com/mercadopago/px-android.git","ssh_url":"git@github.com:mercadopago/px-android.git","clone_url":"https://github.com/mercadopago/px-android.git","svn_url":"https://github.com/mercadopago/px-android","homepage":"http://mercadopago.github.io/px-android","size":80209,"stargazers_count":26,"watchers_count":26,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":22,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":22,"open_issues":30,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mercadopago/px-android/pulls/1169"},"html":{"href":"https://github.com/mercadopago/px-android/pull/1169"},"issue":{"href":"https://api.github.com/repos/mercadopago/px-android/issues/1169"},"comments":{"href":"https://api.github.com/repos/mercadopago/px-android/issues/1169/comments"},"review_comments":{"href":"https://api.github.com/repos/mercadopago/px-android/pulls/1169/comments"},"review_comment":{"href":"https://api.github.com/repos/mercadopago/px-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mercadopago/px-android/pulls/1169/commits"},"statuses":{"href":"https://api.github.com/repos/mercadopago/px-android/statuses/ec3f9c2e1853f5ddd1bd8b84fc1c8669a6c62726"}},"author_association":"NONE"}}
{"actor":{"display_login":"zehemz"}}