{"action":"created","comment":{"url":"https://api.github.com/repos/teamdigitale/italia-app/pulls/comments/199249103","pull_request_review_id":133333770,"id":199249103,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTI0OTEwMw==","diff_hunk":"@@ -2,49 +2,97 @@\n  * A saga that manages the Wallet.\n  */\n \n-import { call, Effect, put, takeLatest } from \"redux-saga/effects\";\n+import { call, Effect, fork, put, select, take } from \"redux-saga/effects\";\n \n+import { Option } from \"fp-ts/lib/Option\";\n+import { addCard, deleteCard } from \"../api/pagopa\";\n import { WalletAPI } from \"../api/wallet/wallet-api\";\n import {\n+  ADD_CARD_REQUEST,\n+  CARD_ERROR,\n+  DELETE_CARD_REQUEST,\n   FETCH_CARDS_REQUEST,\n   FETCH_TRANSACTIONS_REQUEST\n } from \"../store/actions/constants\";\n import { cardsFetched } from \"../store/actions/wallet/cards\";\n import { transactionsFetched } from \"../store/actions/wallet/transactions\";\n-import { CreditCard } from \"../types/CreditCard\";\n+import { getNewCardData } from \"../store/reducers/wallet/cards\";\n+import { CreditCard, CreditCardId } from \"../types/CreditCard\";\n import { WalletTransaction } from \"../types/wallet\";\n \n-function* fetchTransactions(\n-  loadTransactions: () => Promise<ReadonlyArray<WalletTransaction>>\n-): Iterator<Effect> {\n+function* fetchTransactions(_: string): Iterator<Effect> {\n   const transactions: ReadonlyArray<WalletTransaction> = yield call(\n-    loadTransactions\n+    WalletAPI.getTransactions\n   );\n   yield put(transactionsFetched(transactions));\n }\n \n-function* fetchCreditCards(\n-  loadCards: () => Promise<ReadonlyArray<CreditCard>>\n-): Iterator<Effect> {\n-  const cards: ReadonlyArray<CreditCard> = yield call(loadCards);\n+function* fetchCreditCards(_: string): Iterator<Effect> {\n+  const cards: ReadonlyArray<CreditCard> = yield call(WalletAPI.getCreditCards);\n   yield put(cardsFetched(cards));\n }\n \n+function* addCardSaga(token: string): Iterator<Effect> {","path":"ts/sagas/wallet.ts","position":44,"original_position":44,"commit_id":"158736b7ed2d7096246ee44d5512d3c354eed5d9","original_commit_id":"158736b7ed2d7096246ee44d5512d3c354eed5d9","user":{"login":"cloudify","id":48206,"node_id":"MDQ6VXNlcjQ4MjA2","avatar_url":"https://avatars2.githubusercontent.com/u/48206?v=4","gravatar_id":"","url":"https://api.github.com/users/cloudify","html_url":"https://github.com/cloudify","followers_url":"https://api.github.com/users/cloudify/followers","following_url":"https://api.github.com/users/cloudify/following{/other_user}","gists_url":"https://api.github.com/users/cloudify/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudify/subscriptions","organizations_url":"https://api.github.com/users/cloudify/orgs","repos_url":"https://api.github.com/users/cloudify/repos","events_url":"https://api.github.com/users/cloudify/events{/privacy}","received_events_url":"https://api.github.com/users/cloudify/received_events","type":"User","site_admin":false},"body":"since we used `CreditCard` everywhere, let's call this `addCreditCardSaga`","created_at":"2018-06-29T18:44:38Z","updated_at":"2018-06-29T18:58:44Z","html_url":"https://github.com/teamdigitale/italia-app/pull/265#discussion_r199249103","pull_request_url":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/teamdigitale/italia-app/pulls/comments/199249103"},"html":{"href":"https://github.com/teamdigitale/italia-app/pull/265#discussion_r199249103"},"pull_request":{"href":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265"}}},"pull_request":{"url":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265","id":198389149,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4Mzg5MTQ5","html_url":"https://github.com/teamdigitale/italia-app/pull/265","diff_url":"https://github.com/teamdigitale/italia-app/pull/265.diff","patch_url":"https://github.com/teamdigitale/italia-app/pull/265.patch","issue_url":"https://api.github.com/repos/teamdigitale/italia-app/issues/265","number":265,"state":"open","locked":false,"title":"[#156913707] add and delete payment methods via api","user":{"login":"fgiobergia","id":107715,"node_id":"MDQ6VXNlcjEwNzcxNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/107715?v=4","gravatar_id":"","url":"https://api.github.com/users/fgiobergia","html_url":"https://github.com/fgiobergia","followers_url":"https://api.github.com/users/fgiobergia/followers","following_url":"https://api.github.com/users/fgiobergia/following{/other_user}","gists_url":"https://api.github.com/users/fgiobergia/gists{/gist_id}","starred_url":"https://api.github.com/users/fgiobergia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgiobergia/subscriptions","organizations_url":"https://api.github.com/users/fgiobergia/orgs","repos_url":"https://api.github.com/users/fgiobergia/repos","events_url":"https://api.github.com/users/fgiobergia/events{/privacy}","received_events_url":"https://api.github.com/users/fgiobergia/received_events","type":"User","site_admin":false},"body":"This PR takes care of using the relevant PagoPA RESTful API to create and delete a payment method. \r\n\r\nThis PR still makes use of a mocked server, so the actions are currently not really being performed (e.g. if a card is deleted, it will still be left there). This is because the mock server is \"dumb\", and does nothing other than serving static data. This will be changed, if needed, in a future version of the mocked server (code available [here](http://github.com/fgiobergia/pagopa-mock-rest)). \r\n\r\nThe API used here are `POST /wallet` and `DELETE /wallet`. The fields required by these two have been interpreted based on their names -- no other documentation has been found on the matter (if anything else *is* available, please share because I missed it!). ","created_at":"2018-06-29T18:17:44Z","updated_at":"2018-06-29T18:58:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15aa32f4e7afb661dacdbf614c08c0822b2e1f65","assignee":null,"assignees":[],"requested_reviewers":[{"login":"gunzip","id":148224,"node_id":"MDQ6VXNlcjE0ODIyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/148224?v=4","gravatar_id":"","url":"https://api.github.com/users/gunzip","html_url":"https://github.com/gunzip","followers_url":"https://api.github.com/users/gunzip/followers","following_url":"https://api.github.com/users/gunzip/following{/other_user}","gists_url":"https://api.github.com/users/gunzip/gists{/gist_id}","starred_url":"https://api.github.com/users/gunzip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunzip/subscriptions","organizations_url":"https://api.github.com/users/gunzip/orgs","repos_url":"https://api.github.com/users/gunzip/repos","events_url":"https://api.github.com/users/gunzip/events{/privacy}","received_events_url":"https://api.github.com/users/gunzip/received_events","type":"User","site_admin":false},{"login":"fpersico","id":30595520,"node_id":"MDQ6VXNlcjMwNTk1NTIw","avatar_url":"https://avatars3.githubusercontent.com/u/30595520?v=4","gravatar_id":"","url":"https://api.github.com/users/fpersico","html_url":"https://github.com/fpersico","followers_url":"https://api.github.com/users/fpersico/followers","following_url":"https://api.github.com/users/fpersico/following{/other_user}","gists_url":"https://api.github.com/users/fpersico/gists{/gist_id}","starred_url":"https://api.github.com/users/fpersico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpersico/subscriptions","organizations_url":"https://api.github.com/users/fpersico/orgs","repos_url":"https://api.github.com/users/fpersico/repos","events_url":"https://api.github.com/users/fpersico/events{/privacy}","received_events_url":"https://api.github.com/users/fpersico/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265/commits","review_comments_url":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265/comments","review_comment_url":"https://api.github.com/repos/teamdigitale/italia-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/teamdigitale/italia-app/issues/265/comments","statuses_url":"https://api.github.com/repos/teamdigitale/italia-app/statuses/158736b7ed2d7096246ee44d5512d3c354eed5d9","head":{"label":"teamdigitale:156913707-add-and-delete-method-via-api","ref":"156913707-add-and-delete-method-via-api","sha":"158736b7ed2d7096246ee44d5512d3c354eed5d9","user":{"login":"teamdigitale","id":25081492,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MDgxNDky","avatar_url":"https://avatars0.githubusercontent.com/u/25081492?v=4","gravatar_id":"","url":"https://api.github.com/users/teamdigitale","html_url":"https://github.com/teamdigitale","followers_url":"https://api.github.com/users/teamdigitale/followers","following_url":"https://api.github.com/users/teamdigitale/following{/other_user}","gists_url":"https://api.github.com/users/teamdigitale/gists{/gist_id}","starred_url":"https://api.github.com/users/teamdigitale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamdigitale/subscriptions","organizations_url":"https://api.github.com/users/teamdigitale/orgs","repos_url":"https://api.github.com/users/teamdigitale/repos","events_url":"https://api.github.com/users/teamdigitale/events{/privacy}","received_events_url":"https://api.github.com/users/teamdigitale/received_events","type":"Organization","site_admin":false},"repo":{"id":87916228,"node_id":"MDEwOlJlcG9zaXRvcnk4NzkxNjIyOA==","name":"italia-app","full_name":"teamdigitale/italia-app","owner":{"login":"teamdigitale","id":25081492,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MDgxNDky","avatar_url":"https://avatars0.githubusercontent.com/u/25081492?v=4","gravatar_id":"","url":"https://api.github.com/users/teamdigitale","html_url":"https://github.com/teamdigitale","followers_url":"https://api.github.com/users/teamdigitale/followers","following_url":"https://api.github.com/users/teamdigitale/following{/other_user}","gists_url":"https://api.github.com/users/teamdigitale/gists{/gist_id}","starred_url":"https://api.github.com/users/teamdigitale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamdigitale/subscriptions","organizations_url":"https://api.github.com/users/teamdigitale/orgs","repos_url":"https://api.github.com/users/teamdigitale/repos","events_url":"https://api.github.com/users/teamdigitale/events{/privacy}","received_events_url":"https://api.github.com/users/teamdigitale/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/teamdigitale/italia-app","description":"App IO","fork":false,"url":"https://api.github.com/repos/teamdigitale/italia-app","forks_url":"https://api.github.com/repos/teamdigitale/italia-app/forks","keys_url":"https://api.github.com/repos/teamdigitale/italia-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teamdigitale/italia-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teamdigitale/italia-app/teams","hooks_url":"https://api.github.com/repos/teamdigitale/italia-app/hooks","issue_events_url":"https://api.github.com/repos/teamdigitale/italia-app/issues/events{/number}","events_url":"https://api.github.com/repos/teamdigitale/italia-app/events","assignees_url":"https://api.github.com/repos/teamdigitale/italia-app/assignees{/user}","branches_url":"https://api.github.com/repos/teamdigitale/italia-app/branches{/branch}","tags_url":"https://api.github.com/repos/teamdigitale/italia-app/tags","blobs_url":"https://api.github.com/repos/teamdigitale/italia-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teamdigitale/italia-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teamdigitale/italia-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/teamdigitale/italia-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teamdigitale/italia-app/statuses/{sha}","languages_url":"https://api.github.com/repos/teamdigitale/italia-app/languages","stargazers_url":"https://api.github.com/repos/teamdigitale/italia-app/stargazers","contributors_url":"https://api.github.com/repos/teamdigitale/italia-app/contributors","subscribers_url":"https://api.github.com/repos/teamdigitale/italia-app/subscribers","subscription_url":"https://api.github.com/repos/teamdigitale/italia-app/subscription","commits_url":"https://api.github.com/repos/teamdigitale/italia-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/teamdigitale/italia-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/teamdigitale/italia-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/teamdigitale/italia-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/teamdigitale/italia-app/contents/{+path}","compare_url":"https://api.github.com/repos/teamdigitale/italia-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teamdigitale/italia-app/merges","archive_url":"https://api.github.com/repos/teamdigitale/italia-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teamdigitale/italia-app/downloads","issues_url":"https://api.github.com/repos/teamdigitale/italia-app/issues{/number}","pulls_url":"https://api.github.com/repos/teamdigitale/italia-app/pulls{/number}","milestones_url":"https://api.github.com/repos/teamdigitale/italia-app/milestones{/number}","notifications_url":"https://api.github.com/repos/teamdigitale/italia-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teamdigitale/italia-app/labels{/name}","releases_url":"https://api.github.com/repos/teamdigitale/italia-app/releases{/id}","deployments_url":"https://api.github.com/repos/teamdigitale/italia-app/deployments","created_at":"2017-04-11T09:34:46Z","updated_at":"2018-06-29T16:37:03Z","pushed_at":"2018-06-29T18:26:04Z","git_url":"git://github.com/teamdigitale/italia-app.git","ssh_url":"git@github.com:teamdigitale/italia-app.git","clone_url":"https://github.com/teamdigitale/italia-app.git","svn_url":"https://github.com/teamdigitale/italia-app","homepage":"https://io.italia.it","size":19039,"stargazers_count":55,"watchers_count":55,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":7,"open_issues":19,"watchers":55,"default_branch":"master"}},"base":{"label":"teamdigitale:master","ref":"master","sha":"f0ad21c64a84d928ecbc12adde37630191099803","user":{"login":"teamdigitale","id":25081492,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MDgxNDky","avatar_url":"https://avatars0.githubusercontent.com/u/25081492?v=4","gravatar_id":"","url":"https://api.github.com/users/teamdigitale","html_url":"https://github.com/teamdigitale","followers_url":"https://api.github.com/users/teamdigitale/followers","following_url":"https://api.github.com/users/teamdigitale/following{/other_user}","gists_url":"https://api.github.com/users/teamdigitale/gists{/gist_id}","starred_url":"https://api.github.com/users/teamdigitale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamdigitale/subscriptions","organizations_url":"https://api.github.com/users/teamdigitale/orgs","repos_url":"https://api.github.com/users/teamdigitale/repos","events_url":"https://api.github.com/users/teamdigitale/events{/privacy}","received_events_url":"https://api.github.com/users/teamdigitale/received_events","type":"Organization","site_admin":false},"repo":{"id":87916228,"node_id":"MDEwOlJlcG9zaXRvcnk4NzkxNjIyOA==","name":"italia-app","full_name":"teamdigitale/italia-app","owner":{"login":"teamdigitale","id":25081492,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MDgxNDky","avatar_url":"https://avatars0.githubusercontent.com/u/25081492?v=4","gravatar_id":"","url":"https://api.github.com/users/teamdigitale","html_url":"https://github.com/teamdigitale","followers_url":"https://api.github.com/users/teamdigitale/followers","following_url":"https://api.github.com/users/teamdigitale/following{/other_user}","gists_url":"https://api.github.com/users/teamdigitale/gists{/gist_id}","starred_url":"https://api.github.com/users/teamdigitale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teamdigitale/subscriptions","organizations_url":"https://api.github.com/users/teamdigitale/orgs","repos_url":"https://api.github.com/users/teamdigitale/repos","events_url":"https://api.github.com/users/teamdigitale/events{/privacy}","received_events_url":"https://api.github.com/users/teamdigitale/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/teamdigitale/italia-app","description":"App IO","fork":false,"url":"https://api.github.com/repos/teamdigitale/italia-app","forks_url":"https://api.github.com/repos/teamdigitale/italia-app/forks","keys_url":"https://api.github.com/repos/teamdigitale/italia-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/teamdigitale/italia-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/teamdigitale/italia-app/teams","hooks_url":"https://api.github.com/repos/teamdigitale/italia-app/hooks","issue_events_url":"https://api.github.com/repos/teamdigitale/italia-app/issues/events{/number}","events_url":"https://api.github.com/repos/teamdigitale/italia-app/events","assignees_url":"https://api.github.com/repos/teamdigitale/italia-app/assignees{/user}","branches_url":"https://api.github.com/repos/teamdigitale/italia-app/branches{/branch}","tags_url":"https://api.github.com/repos/teamdigitale/italia-app/tags","blobs_url":"https://api.github.com/repos/teamdigitale/italia-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/teamdigitale/italia-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/teamdigitale/italia-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/teamdigitale/italia-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/teamdigitale/italia-app/statuses/{sha}","languages_url":"https://api.github.com/repos/teamdigitale/italia-app/languages","stargazers_url":"https://api.github.com/repos/teamdigitale/italia-app/stargazers","contributors_url":"https://api.github.com/repos/teamdigitale/italia-app/contributors","subscribers_url":"https://api.github.com/repos/teamdigitale/italia-app/subscribers","subscription_url":"https://api.github.com/repos/teamdigitale/italia-app/subscription","commits_url":"https://api.github.com/repos/teamdigitale/italia-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/teamdigitale/italia-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/teamdigitale/italia-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/teamdigitale/italia-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/teamdigitale/italia-app/contents/{+path}","compare_url":"https://api.github.com/repos/teamdigitale/italia-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/teamdigitale/italia-app/merges","archive_url":"https://api.github.com/repos/teamdigitale/italia-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/teamdigitale/italia-app/downloads","issues_url":"https://api.github.com/repos/teamdigitale/italia-app/issues{/number}","pulls_url":"https://api.github.com/repos/teamdigitale/italia-app/pulls{/number}","milestones_url":"https://api.github.com/repos/teamdigitale/italia-app/milestones{/number}","notifications_url":"https://api.github.com/repos/teamdigitale/italia-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/teamdigitale/italia-app/labels{/name}","releases_url":"https://api.github.com/repos/teamdigitale/italia-app/releases{/id}","deployments_url":"https://api.github.com/repos/teamdigitale/italia-app/deployments","created_at":"2017-04-11T09:34:46Z","updated_at":"2018-06-29T16:37:03Z","pushed_at":"2018-06-29T18:26:04Z","git_url":"git://github.com/teamdigitale/italia-app.git","ssh_url":"git@github.com:teamdigitale/italia-app.git","clone_url":"https://github.com/teamdigitale/italia-app.git","svn_url":"https://github.com/teamdigitale/italia-app","homepage":"https://io.italia.it","size":19039,"stargazers_count":55,"watchers_count":55,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":7,"open_issues":19,"watchers":55,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265"},"html":{"href":"https://github.com/teamdigitale/italia-app/pull/265"},"issue":{"href":"https://api.github.com/repos/teamdigitale/italia-app/issues/265"},"comments":{"href":"https://api.github.com/repos/teamdigitale/italia-app/issues/265/comments"},"review_comments":{"href":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265/comments"},"review_comment":{"href":"https://api.github.com/repos/teamdigitale/italia-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/teamdigitale/italia-app/pulls/265/commits"},"statuses":{"href":"https://api.github.com/repos/teamdigitale/italia-app/statuses/158736b7ed2d7096246ee44d5512d3c354eed5d9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"cloudify"}}