{"action":"created","comment":{"url":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/comments/174718242","pull_request_review_id":104121641,"id":174718242,"diff_hunk":"@@ -168,6 +167,40 @@ def test_get_account_invoice_payments\n       account_invoice_payments = @account.invoice_payments('NONE', false, false, @options)\n       assert_equal(7.0, account_invoice_payments[0].purchased_amount)\n       assert_equal(5.0, account_invoice_payments[1].purchased_amount)\n+    end\n+\n+    def test_create_chargeback_and_chargeback_reversal\n+\n+      # Create a charge to account\n+      create_charge(@account.account_id, '50.0', 'USD', 'My charge', @user, @options)\n+\n+      # Create a payment\n+      pay_all_unpaid_invoices(@account.account_id, true, '50.0', @user, @options)\n+\n+      account = get_account(@account.account_id, true, true, @options)\n+      payment_id = account.payments(@options).first.payment_id\n+\n+      # Verify if a new transaction is created and if their type is PURCHASE\n+      account_transactions = account.payments(@options).first.transactions\n+      assert_equal(1, account_transactions.size)\n+      assert_equal('PURCHASE', account_transactions[0].transaction_type)\n+\n+      # Trigger chargerback\n+      chargeback = KillBillClient::Model::InvoicePayment.create_chargeback(payment_id, '50.0', 'USD', nil, @user, nil, nil, @options)\n+\n+      # Verify if a new transaction is created and if their type is CHARGEBACK\n+      account_transactions = account.payments(@options).first.transactions\n+      assert_equal(2, account_transactions.size)\n+      assert_equal('CHARGEBACK', account_transactions[1].transaction_type)\n+\n+      # Trigger chargerback reversal\n+      transaction_external_key = chargeback.transactions[1].transaction_external_key\n+      KillBillClient::Model::InvoicePayment.chargeback_reversal(payment_id, transaction_external_key, nil, @user, nil, nil, @options)\n+\n+      # Verify if a new transaction is created and if their type is CHARGEBACK\n+      account_transactions = account.payments(@options).first.transactions\n+      assert_equal(3, account_transactions.size)\n+      assert_equal('CHARGEBACK', account_transactions[2].transaction_type)\n ","path":"killbill-integration-tests/core/test_invoice_payment.rb","position":46,"original_position":46,"commit_id":"9446c3a14618fc5bcf252633062a6450d5ed08ba","original_commit_id":"9446c3a14618fc5bcf252633062a6450d5ed08ba","user":{"login":"pierre","id":51940,"avatar_url":"https://avatars2.githubusercontent.com/u/51940?v=4","gravatar_id":"","url":"https://api.github.com/users/pierre","html_url":"https://github.com/pierre","followers_url":"https://api.github.com/users/pierre/followers","following_url":"https://api.github.com/users/pierre/following{/other_user}","gists_url":"https://api.github.com/users/pierre/gists{/gist_id}","starred_url":"https://api.github.com/users/pierre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierre/subscriptions","organizations_url":"https://api.github.com/users/pierre/orgs","repos_url":"https://api.github.com/users/pierre/repos","events_url":"https://api.github.com/users/pierre/events{/privacy}","received_events_url":"https://api.github.com/users/pierre/received_events","type":"User","site_admin":false},"body":"Can you check the account balance here?\r\n\r\n```\r\nassert_equal(0, get_account(@account.account_id, true, true, @options).account_balance)\r\n```","created_at":"2018-03-15T09:20:02Z","updated_at":"2018-03-15T09:21:10Z","html_url":"https://github.com/killbill/killbill-integration-tests/pull/19#discussion_r174718242","pull_request_url":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/comments/174718242"},"html":{"href":"https://github.com/killbill/killbill-integration-tests/pull/19#discussion_r174718242"},"pull_request":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19","id":174783973,"html_url":"https://github.com/killbill/killbill-integration-tests/pull/19","diff_url":"https://github.com/killbill/killbill-integration-tests/pull/19.diff","patch_url":"https://github.com/killbill/killbill-integration-tests/pull/19.patch","issue_url":"https://api.github.com/repos/killbill/killbill-integration-tests/issues/19","number":19,"state":"open","locked":false,"title":"Test invoice payment chargerback reservals","user":{"login":"wwjfrodriguez","id":36242659,"avatar_url":"https://avatars3.githubusercontent.com/u/36242659?v=4","gravatar_id":"","url":"https://api.github.com/users/wwjfrodriguez","html_url":"https://github.com/wwjfrodriguez","followers_url":"https://api.github.com/users/wwjfrodriguez/followers","following_url":"https://api.github.com/users/wwjfrodriguez/following{/other_user}","gists_url":"https://api.github.com/users/wwjfrodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/wwjfrodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwjfrodriguez/subscriptions","organizations_url":"https://api.github.com/users/wwjfrodriguez/orgs","repos_url":"https://api.github.com/users/wwjfrodriguez/repos","events_url":"https://api.github.com/users/wwjfrodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/wwjfrodriguez/received_events","type":"User","site_admin":false},"body":"I submit this PR for review in that specific endpoint because I need help to understand better how chargerback reservals works. I don't write assertions yet in the test because I'm always recieve a BadRequest:\r\n\r\n` KillBillClient::API::BadRequest: {\"className\":\"com.fasterxml.jackson.databind.JsonMappingException\",\"code\":null,\"message\":\"Can not instantiate value of type [simple type, class org.killbill.billing.jaxrs.json.InvoicePaymentTransactionJson] from String value ('KillBillClient::Model::InvoicePayment'); no single-String constructor/factory method\\n at [Source: org.apache.catalina.connector.CoyoteInputStream@7f233e5; line: 1, column: 1]\",\"causeClassName\":null,\"causeMessage\":null,\"stackTrace\":[]}\r\n`\r\n\r\nOr:\r\n\r\n\r\n`KillBillClient::API::BadRequest: {\"className\":\"java.lang.IllegalArgumentException\",\"code\":null,\"message\":\"transactionExternalKey amount needs to be set\",\"causeClassName\":null,\"causeMessage\":null,\"stackTrace\":[]}`\r\n","created_at":"2018-03-13T20:42:33Z","updated_at":"2018-03-15T09:21:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2decd05ba98eea897ca64762a2cf18b3077e5dd0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19/commits","review_comments_url":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19/comments","review_comment_url":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/killbill/killbill-integration-tests/issues/19/comments","statuses_url":"https://api.github.com/repos/killbill/killbill-integration-tests/statuses/9446c3a14618fc5bcf252633062a6450d5ed08ba","head":{"label":"wwjfrodriguez:test-invoice-payment-resource","ref":"test-invoice-payment-resource","sha":"9446c3a14618fc5bcf252633062a6450d5ed08ba","user":{"login":"wwjfrodriguez","id":36242659,"avatar_url":"https://avatars3.githubusercontent.com/u/36242659?v=4","gravatar_id":"","url":"https://api.github.com/users/wwjfrodriguez","html_url":"https://github.com/wwjfrodriguez","followers_url":"https://api.github.com/users/wwjfrodriguez/followers","following_url":"https://api.github.com/users/wwjfrodriguez/following{/other_user}","gists_url":"https://api.github.com/users/wwjfrodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/wwjfrodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwjfrodriguez/subscriptions","organizations_url":"https://api.github.com/users/wwjfrodriguez/orgs","repos_url":"https://api.github.com/users/wwjfrodriguez/repos","events_url":"https://api.github.com/users/wwjfrodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/wwjfrodriguez/received_events","type":"User","site_admin":false},"repo":{"id":124571639,"name":"killbill-integration-tests","full_name":"wwjfrodriguez/killbill-integration-tests","owner":{"login":"wwjfrodriguez","id":36242659,"avatar_url":"https://avatars3.githubusercontent.com/u/36242659?v=4","gravatar_id":"","url":"https://api.github.com/users/wwjfrodriguez","html_url":"https://github.com/wwjfrodriguez","followers_url":"https://api.github.com/users/wwjfrodriguez/followers","following_url":"https://api.github.com/users/wwjfrodriguez/following{/other_user}","gists_url":"https://api.github.com/users/wwjfrodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/wwjfrodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwjfrodriguez/subscriptions","organizations_url":"https://api.github.com/users/wwjfrodriguez/orgs","repos_url":"https://api.github.com/users/wwjfrodriguez/repos","events_url":"https://api.github.com/users/wwjfrodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/wwjfrodriguez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wwjfrodriguez/killbill-integration-tests","description":"Test suite written in Ruby against Kill Bill","fork":true,"url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests","forks_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/forks","keys_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/teams","hooks_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/hooks","issue_events_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/issues/events{/number}","events_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/events","assignees_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/assignees{/user}","branches_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/branches{/branch}","tags_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/tags","blobs_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/languages","stargazers_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/stargazers","contributors_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/contributors","subscribers_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/subscribers","subscription_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/subscription","commits_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/contents/{+path}","compare_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/merges","archive_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/downloads","issues_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/issues{/number}","pulls_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/labels{/name}","releases_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/releases{/id}","deployments_url":"https://api.github.com/repos/wwjfrodriguez/killbill-integration-tests/deployments","created_at":"2018-03-09T17:23:07Z","updated_at":"2018-03-09T17:23:10Z","pushed_at":"2018-03-14T20:19:20Z","git_url":"git://github.com/wwjfrodriguez/killbill-integration-tests.git","ssh_url":"git@github.com:wwjfrodriguez/killbill-integration-tests.git","clone_url":"https://github.com/wwjfrodriguez/killbill-integration-tests.git","svn_url":"https://github.com/wwjfrodriguez/killbill-integration-tests","homepage":"http://killbill.io/","size":462,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"killbill:work-for-release-0.19.x","ref":"work-for-release-0.19.x","sha":"ffa54cde9ebe1768f1f67db55bbd31b7d7e36421","user":{"login":"killbill","id":2446739,"avatar_url":"https://avatars2.githubusercontent.com/u/2446739?v=4","gravatar_id":"","url":"https://api.github.com/users/killbill","html_url":"https://github.com/killbill","followers_url":"https://api.github.com/users/killbill/followers","following_url":"https://api.github.com/users/killbill/following{/other_user}","gists_url":"https://api.github.com/users/killbill/gists{/gist_id}","starred_url":"https://api.github.com/users/killbill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killbill/subscriptions","organizations_url":"https://api.github.com/users/killbill/orgs","repos_url":"https://api.github.com/users/killbill/repos","events_url":"https://api.github.com/users/killbill/events{/privacy}","received_events_url":"https://api.github.com/users/killbill/received_events","type":"Organization","site_admin":false},"repo":{"id":12414820,"name":"killbill-integration-tests","full_name":"killbill/killbill-integration-tests","owner":{"login":"killbill","id":2446739,"avatar_url":"https://avatars2.githubusercontent.com/u/2446739?v=4","gravatar_id":"","url":"https://api.github.com/users/killbill","html_url":"https://github.com/killbill","followers_url":"https://api.github.com/users/killbill/followers","following_url":"https://api.github.com/users/killbill/following{/other_user}","gists_url":"https://api.github.com/users/killbill/gists{/gist_id}","starred_url":"https://api.github.com/users/killbill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killbill/subscriptions","organizations_url":"https://api.github.com/users/killbill/orgs","repos_url":"https://api.github.com/users/killbill/repos","events_url":"https://api.github.com/users/killbill/events{/privacy}","received_events_url":"https://api.github.com/users/killbill/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/killbill/killbill-integration-tests","description":"Test suite written in Ruby against Kill Bill","fork":false,"url":"https://api.github.com/repos/killbill/killbill-integration-tests","forks_url":"https://api.github.com/repos/killbill/killbill-integration-tests/forks","keys_url":"https://api.github.com/repos/killbill/killbill-integration-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/killbill/killbill-integration-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/killbill/killbill-integration-tests/teams","hooks_url":"https://api.github.com/repos/killbill/killbill-integration-tests/hooks","issue_events_url":"https://api.github.com/repos/killbill/killbill-integration-tests/issues/events{/number}","events_url":"https://api.github.com/repos/killbill/killbill-integration-tests/events","assignees_url":"https://api.github.com/repos/killbill/killbill-integration-tests/assignees{/user}","branches_url":"https://api.github.com/repos/killbill/killbill-integration-tests/branches{/branch}","tags_url":"https://api.github.com/repos/killbill/killbill-integration-tests/tags","blobs_url":"https://api.github.com/repos/killbill/killbill-integration-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/killbill/killbill-integration-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/killbill/killbill-integration-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/killbill/killbill-integration-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/killbill/killbill-integration-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/killbill/killbill-integration-tests/languages","stargazers_url":"https://api.github.com/repos/killbill/killbill-integration-tests/stargazers","contributors_url":"https://api.github.com/repos/killbill/killbill-integration-tests/contributors","subscribers_url":"https://api.github.com/repos/killbill/killbill-integration-tests/subscribers","subscription_url":"https://api.github.com/repos/killbill/killbill-integration-tests/subscription","commits_url":"https://api.github.com/repos/killbill/killbill-integration-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/killbill/killbill-integration-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/killbill/killbill-integration-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/killbill/killbill-integration-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/killbill/killbill-integration-tests/contents/{+path}","compare_url":"https://api.github.com/repos/killbill/killbill-integration-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/killbill/killbill-integration-tests/merges","archive_url":"https://api.github.com/repos/killbill/killbill-integration-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/killbill/killbill-integration-tests/downloads","issues_url":"https://api.github.com/repos/killbill/killbill-integration-tests/issues{/number}","pulls_url":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/killbill/killbill-integration-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/killbill/killbill-integration-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/killbill/killbill-integration-tests/labels{/name}","releases_url":"https://api.github.com/repos/killbill/killbill-integration-tests/releases{/id}","deployments_url":"https://api.github.com/repos/killbill/killbill-integration-tests/deployments","created_at":"2013-08-27T18:57:35Z","updated_at":"2018-03-13T13:01:00Z","pushed_at":"2018-03-14T20:19:21Z","git_url":"git://github.com/killbill/killbill-integration-tests.git","ssh_url":"git@github.com:killbill/killbill-integration-tests.git","clone_url":"https://github.com/killbill/killbill-integration-tests.git","svn_url":"https://github.com/killbill/killbill-integration-tests","homepage":"http://killbill.io/","size":437,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":10,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19"},"html":{"href":"https://github.com/killbill/killbill-integration-tests/pull/19"},"issue":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/issues/19"},"comments":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/killbill/killbill-integration-tests/statuses/9446c3a14618fc5bcf252633062a6450d5ed08ba"}},"author_association":"NONE"}}
{"actor":{"display_login":"pierre"}}