{"action":"created","comment":{"url":"https://api.github.com/repos/transcom/mymove/pulls/comments/237336579","pull_request_review_id":179607592,"id":237336579,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzMzNjU3OQ==","diff_hunk":"@@ -515,12 +522,41 @@ func (h ShipmentInvoiceHandler) Handle(params shipmentop.SendHHGInvoiceParams) m\n \t\treturn handlers.ResponseForError(h.Logger(), err)\n \t}\n \n+\t// Reload shipment to get the invoices that were associated with it\n+\tvar invoices models.Invoices\n+\terr = h.DB().Eager(\"ShipmentLineItems.Invoices\").Reload(&shipment)\n+\tif err != nil {\n+\t\treturn handlers.ResponseForError(h.Logger(), err)\n+\t}\n+\tfor _, lineItem := range shipment.ShipmentLineItems {\n+\t\tinvoices = append(invoices, lineItem.Invoice)\n+\t}\n+\n \t// get response from gex --> use status as status for this invoice call\n-\tswitch responseStatus {\n-\tcase 200:\n-\t\treturn shipmentop.NewSendHHGInvoiceOK()\n-\tdefault:\n+\tif responseStatus != 200 {\n \t\th.Logger().Error(\"Invoice POST request to GEX failed\", zap.Int(\"status\", responseStatus))\n+\t\tfor index := range invoices {\n+\t\t\tinvoices[index].Status = models.InvoiceStatusSUBMISSIONFAILURE\n+\t\t}\n+\t\t// Update invoice records as failed\n+\t\tverrs, err := h.DB().ValidateAndSave(&invoices)\n+\t\tif verrs.HasAny() {","path":"pkg/handlers/internalapi/shipments.go","position":47,"original_position":47,"commit_id":"c902a774d3093c82590780d3b1b0075e328ff1fc","original_commit_id":"257013bd30f809cf2a275ab920fdbc89bc182298","user":{"login":"mikena-truss","id":44583912,"node_id":"MDQ6VXNlcjQ0NTgzOTEy","avatar_url":"https://avatars0.githubusercontent.com/u/44583912?v=4","gravatar_id":"","url":"https://api.github.com/users/mikena-truss","html_url":"https://github.com/mikena-truss","followers_url":"https://api.github.com/users/mikena-truss/followers","following_url":"https://api.github.com/users/mikena-truss/following{/other_user}","gists_url":"https://api.github.com/users/mikena-truss/gists{/gist_id}","starred_url":"https://api.github.com/users/mikena-truss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikena-truss/subscriptions","organizations_url":"https://api.github.com/users/mikena-truss/orgs","repos_url":"https://api.github.com/users/mikena-truss/repos","events_url":"https://api.github.com/users/mikena-truss/events{/privacy}","received_events_url":"https://api.github.com/users/mikena-truss/received_events","type":"User","site_admin":false},"body":"This is a weird scenario, but I don't know if there's anything we can do other than log :shrug:","created_at":"2018-11-29T02:42:07Z","updated_at":"2018-11-29T02:56:30Z","html_url":"https://github.com/transcom/mymove/pull/1393#discussion_r237336579","pull_request_url":"https://api.github.com/repos/transcom/mymove/pulls/1393","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/transcom/mymove/pulls/comments/237336579"},"html":{"href":"https://github.com/transcom/mymove/pull/1393#discussion_r237336579"},"pull_request":{"href":"https://api.github.com/repos/transcom/mymove/pulls/1393"}}},"pull_request":{"url":"https://api.github.com/repos/transcom/mymove/pulls/1393","id":234489139,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0NDg5MTM5","html_url":"https://github.com/transcom/mymove/pull/1393","diff_url":"https://github.com/transcom/mymove/pull/1393.diff","patch_url":"https://github.com/transcom/mymove/pull/1393.patch","issue_url":"https://api.github.com/repos/transcom/mymove/issues/1393","number":1393,"state":"open","locked":false,"title":"Save invoices in shipment invoice handler","user":{"login":"mikena-truss","id":44583912,"node_id":"MDQ6VXNlcjQ0NTgzOTEy","avatar_url":"https://avatars0.githubusercontent.com/u/44583912?v=4","gravatar_id":"","url":"https://api.github.com/users/mikena-truss","html_url":"https://github.com/mikena-truss","followers_url":"https://api.github.com/users/mikena-truss/followers","following_url":"https://api.github.com/users/mikena-truss/following{/other_user}","gists_url":"https://api.github.com/users/mikena-truss/gists{/gist_id}","starred_url":"https://api.github.com/users/mikena-truss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikena-truss/subscriptions","organizations_url":"https://api.github.com/users/mikena-truss/orgs","repos_url":"https://api.github.com/users/mikena-truss/repos","events_url":"https://api.github.com/users/mikena-truss/events{/privacy}","received_events_url":"https://api.github.com/users/mikena-truss/received_events","type":"User","site_admin":false},"body":"## Description\r\n\r\nThis adds the functionality to save invoices in the `ShipmentInvoiceHandler`\r\nIt works in two steps:\r\n- Create invoices for the shipment in the handler, mark it as in process, and update the shipment line item associations\r\n- After the invoice is sent to GEX, mark it as submitted\r\n\r\n## Reviewer Notes\r\n\r\nNotes in line.\r\n\r\n## Setup\r\nRight now, there's no setup for this. The testing happens in the service unit test. If someone has some suggestions, please let me know!\r\nThe reasoning is:\r\n- a lot has to be mocked to test manually and https://www.pivotaltracker.com/story/show/160691992 is open to fix the handler test. These testing method will likely be similar, so we should follow up with that work right after.\r\n- https://www.pivotaltracker.com/story/show/161698054 is open to add the invoice submission button in the UI \r\n\r\n## Code Review Verification Steps\r\n\r\n* [ ] Code follows the guidelines for [Logging](./docs/backend.md#logging)\r\n* [ ] The requirements listed in\r\n [Querying the Database Safely](./docs/backend.md#querying-the-database-safely)\r\n have been satisfied.\r\n* [ ] Request review from a member of a different team.\r\n* [ ] Have the Pivotal acceptance criteria been met for this change?\r\n\r\n## References\r\n\r\n* [Pivotal story](https://www.pivotaltracker.com/story/show/160691992) for this change\r\n\r\n","created_at":"2018-11-29T02:33:15Z","updated_at":"2018-11-29T02:56:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/transcom/mymove/pulls/1393/commits","review_comments_url":"https://api.github.com/repos/transcom/mymove/pulls/1393/comments","review_comment_url":"https://api.github.com/repos/transcom/mymove/pulls/comments{/number}","comments_url":"https://api.github.com/repos/transcom/mymove/issues/1393/comments","statuses_url":"https://api.github.com/repos/transcom/mymove/statuses/c902a774d3093c82590780d3b1b0075e328ff1fc","head":{"label":"transcom:mw-162065167-save-invoice-submission","ref":"mw-162065167-save-invoice-submission","sha":"c902a774d3093c82590780d3b1b0075e328ff1fc","user":{"login":"transcom","id":34352343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzUyMzQz","avatar_url":"https://avatars0.githubusercontent.com/u/34352343?v=4","gravatar_id":"","url":"https://api.github.com/users/transcom","html_url":"https://github.com/transcom","followers_url":"https://api.github.com/users/transcom/followers","following_url":"https://api.github.com/users/transcom/following{/other_user}","gists_url":"https://api.github.com/users/transcom/gists{/gist_id}","starred_url":"https://api.github.com/users/transcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transcom/subscriptions","organizations_url":"https://api.github.com/users/transcom/orgs","repos_url":"https://api.github.com/users/transcom/repos","events_url":"https://api.github.com/users/transcom/events{/privacy}","received_events_url":"https://api.github.com/users/transcom/received_events","type":"Organization","site_admin":false},"repo":{"id":114694829,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQ2OTQ4Mjk=","name":"mymove","full_name":"transcom/mymove","private":false,"owner":{"login":"transcom","id":34352343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzUyMzQz","avatar_url":"https://avatars0.githubusercontent.com/u/34352343?v=4","gravatar_id":"","url":"https://api.github.com/users/transcom","html_url":"https://github.com/transcom","followers_url":"https://api.github.com/users/transcom/followers","following_url":"https://api.github.com/users/transcom/following{/other_user}","gists_url":"https://api.github.com/users/transcom/gists{/gist_id}","starred_url":"https://api.github.com/users/transcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transcom/subscriptions","organizations_url":"https://api.github.com/users/transcom/orgs","repos_url":"https://api.github.com/users/transcom/repos","events_url":"https://api.github.com/users/transcom/events{/privacy}","received_events_url":"https://api.github.com/users/transcom/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/transcom/mymove","description":"MyMove Personal Property Prototype","fork":false,"url":"https://api.github.com/repos/transcom/mymove","forks_url":"https://api.github.com/repos/transcom/mymove/forks","keys_url":"https://api.github.com/repos/transcom/mymove/keys{/key_id}","collaborators_url":"https://api.github.com/repos/transcom/mymove/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/transcom/mymove/teams","hooks_url":"https://api.github.com/repos/transcom/mymove/hooks","issue_events_url":"https://api.github.com/repos/transcom/mymove/issues/events{/number}","events_url":"https://api.github.com/repos/transcom/mymove/events","assignees_url":"https://api.github.com/repos/transcom/mymove/assignees{/user}","branches_url":"https://api.github.com/repos/transcom/mymove/branches{/branch}","tags_url":"https://api.github.com/repos/transcom/mymove/tags","blobs_url":"https://api.github.com/repos/transcom/mymove/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/transcom/mymove/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/transcom/mymove/git/refs{/sha}","trees_url":"https://api.github.com/repos/transcom/mymove/git/trees{/sha}","statuses_url":"https://api.github.com/repos/transcom/mymove/statuses/{sha}","languages_url":"https://api.github.com/repos/transcom/mymove/languages","stargazers_url":"https://api.github.com/repos/transcom/mymove/stargazers","contributors_url":"https://api.github.com/repos/transcom/mymove/contributors","subscribers_url":"https://api.github.com/repos/transcom/mymove/subscribers","subscription_url":"https://api.github.com/repos/transcom/mymove/subscription","commits_url":"https://api.github.com/repos/transcom/mymove/commits{/sha}","git_commits_url":"https://api.github.com/repos/transcom/mymove/git/commits{/sha}","comments_url":"https://api.github.com/repos/transcom/mymove/comments{/number}","issue_comment_url":"https://api.github.com/repos/transcom/mymove/issues/comments{/number}","contents_url":"https://api.github.com/repos/transcom/mymove/contents/{+path}","compare_url":"https://api.github.com/repos/transcom/mymove/compare/{base}...{head}","merges_url":"https://api.github.com/repos/transcom/mymove/merges","archive_url":"https://api.github.com/repos/transcom/mymove/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/transcom/mymove/downloads","issues_url":"https://api.github.com/repos/transcom/mymove/issues{/number}","pulls_url":"https://api.github.com/repos/transcom/mymove/pulls{/number}","milestones_url":"https://api.github.com/repos/transcom/mymove/milestones{/number}","notifications_url":"https://api.github.com/repos/transcom/mymove/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/transcom/mymove/labels{/name}","releases_url":"https://api.github.com/repos/transcom/mymove/releases{/id}","deployments_url":"https://api.github.com/repos/transcom/mymove/deployments","created_at":"2017-12-18T22:41:12Z","updated_at":"2018-11-29T02:36:11Z","pushed_at":"2018-11-29T02:52:45Z","git_url":"git://github.com/transcom/mymove.git","ssh_url":"git@github.com:transcom/mymove.git","clone_url":"https://github.com/transcom/mymove.git","svn_url":"https://github.com/transcom/mymove","homepage":"https://move.mil","size":31264,"stargazers_count":16,"watchers_count":16,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":13,"open_issues":15,"watchers":16,"default_branch":"master"}},"base":{"label":"transcom:master","ref":"master","sha":"49e755d6c0b38aade2bc18834f233ca8aa37988d","user":{"login":"transcom","id":34352343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzUyMzQz","avatar_url":"https://avatars0.githubusercontent.com/u/34352343?v=4","gravatar_id":"","url":"https://api.github.com/users/transcom","html_url":"https://github.com/transcom","followers_url":"https://api.github.com/users/transcom/followers","following_url":"https://api.github.com/users/transcom/following{/other_user}","gists_url":"https://api.github.com/users/transcom/gists{/gist_id}","starred_url":"https://api.github.com/users/transcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transcom/subscriptions","organizations_url":"https://api.github.com/users/transcom/orgs","repos_url":"https://api.github.com/users/transcom/repos","events_url":"https://api.github.com/users/transcom/events{/privacy}","received_events_url":"https://api.github.com/users/transcom/received_events","type":"Organization","site_admin":false},"repo":{"id":114694829,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQ2OTQ4Mjk=","name":"mymove","full_name":"transcom/mymove","private":false,"owner":{"login":"transcom","id":34352343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzUyMzQz","avatar_url":"https://avatars0.githubusercontent.com/u/34352343?v=4","gravatar_id":"","url":"https://api.github.com/users/transcom","html_url":"https://github.com/transcom","followers_url":"https://api.github.com/users/transcom/followers","following_url":"https://api.github.com/users/transcom/following{/other_user}","gists_url":"https://api.github.com/users/transcom/gists{/gist_id}","starred_url":"https://api.github.com/users/transcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transcom/subscriptions","organizations_url":"https://api.github.com/users/transcom/orgs","repos_url":"https://api.github.com/users/transcom/repos","events_url":"https://api.github.com/users/transcom/events{/privacy}","received_events_url":"https://api.github.com/users/transcom/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/transcom/mymove","description":"MyMove Personal Property Prototype","fork":false,"url":"https://api.github.com/repos/transcom/mymove","forks_url":"https://api.github.com/repos/transcom/mymove/forks","keys_url":"https://api.github.com/repos/transcom/mymove/keys{/key_id}","collaborators_url":"https://api.github.com/repos/transcom/mymove/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/transcom/mymove/teams","hooks_url":"https://api.github.com/repos/transcom/mymove/hooks","issue_events_url":"https://api.github.com/repos/transcom/mymove/issues/events{/number}","events_url":"https://api.github.com/repos/transcom/mymove/events","assignees_url":"https://api.github.com/repos/transcom/mymove/assignees{/user}","branches_url":"https://api.github.com/repos/transcom/mymove/branches{/branch}","tags_url":"https://api.github.com/repos/transcom/mymove/tags","blobs_url":"https://api.github.com/repos/transcom/mymove/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/transcom/mymove/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/transcom/mymove/git/refs{/sha}","trees_url":"https://api.github.com/repos/transcom/mymove/git/trees{/sha}","statuses_url":"https://api.github.com/repos/transcom/mymove/statuses/{sha}","languages_url":"https://api.github.com/repos/transcom/mymove/languages","stargazers_url":"https://api.github.com/repos/transcom/mymove/stargazers","contributors_url":"https://api.github.com/repos/transcom/mymove/contributors","subscribers_url":"https://api.github.com/repos/transcom/mymove/subscribers","subscription_url":"https://api.github.com/repos/transcom/mymove/subscription","commits_url":"https://api.github.com/repos/transcom/mymove/commits{/sha}","git_commits_url":"https://api.github.com/repos/transcom/mymove/git/commits{/sha}","comments_url":"https://api.github.com/repos/transcom/mymove/comments{/number}","issue_comment_url":"https://api.github.com/repos/transcom/mymove/issues/comments{/number}","contents_url":"https://api.github.com/repos/transcom/mymove/contents/{+path}","compare_url":"https://api.github.com/repos/transcom/mymove/compare/{base}...{head}","merges_url":"https://api.github.com/repos/transcom/mymove/merges","archive_url":"https://api.github.com/repos/transcom/mymove/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/transcom/mymove/downloads","issues_url":"https://api.github.com/repos/transcom/mymove/issues{/number}","pulls_url":"https://api.github.com/repos/transcom/mymove/pulls{/number}","milestones_url":"https://api.github.com/repos/transcom/mymove/milestones{/number}","notifications_url":"https://api.github.com/repos/transcom/mymove/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/transcom/mymove/labels{/name}","releases_url":"https://api.github.com/repos/transcom/mymove/releases{/id}","deployments_url":"https://api.github.com/repos/transcom/mymove/deployments","created_at":"2017-12-18T22:41:12Z","updated_at":"2018-11-29T02:36:11Z","pushed_at":"2018-11-29T02:52:45Z","git_url":"git://github.com/transcom/mymove.git","ssh_url":"git@github.com:transcom/mymove.git","clone_url":"https://github.com/transcom/mymove.git","svn_url":"https://github.com/transcom/mymove","homepage":"https://move.mil","size":31264,"stargazers_count":16,"watchers_count":16,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":15,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":13,"open_issues":15,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/transcom/mymove/pulls/1393"},"html":{"href":"https://github.com/transcom/mymove/pull/1393"},"issue":{"href":"https://api.github.com/repos/transcom/mymove/issues/1393"},"comments":{"href":"https://api.github.com/repos/transcom/mymove/issues/1393/comments"},"review_comments":{"href":"https://api.github.com/repos/transcom/mymove/pulls/1393/comments"},"review_comment":{"href":"https://api.github.com/repos/transcom/mymove/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/transcom/mymove/pulls/1393/commits"},"statuses":{"href":"https://api.github.com/repos/transcom/mymove/statuses/c902a774d3093c82590780d3b1b0075e328ff1fc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mikena-truss"}}