{"action":"created","comment":{"url":"https://api.github.com/repos/killbill/killbill/pulls/comments/86328190","pull_request_review_id":6990277,"id":86328190,"diff_hunk":"@@ -91,28 +102,113 @@ private DefaultPlan loadOverriddenPlan(final String planName, final StaticCatalo\n \n         final List<CatalogOverridePhaseDefinitionModelDao> phaseDefs = overrideDao.getOverriddenPlanPhases(planDefRecordId, context);\n         final DefaultPlan defaultPlan = (DefaultPlan) catalog.findCurrentPlan(parentPlanName);\n-\n-        final PlanPhasePriceOverride[] overrides = createOverrides(defaultPlan, phaseDefs);\n+        final PlanPhasePriceOverride[] overrides = createOverrides(defaultPlan, phaseDefs, context);\n         return new DefaultPlan(planName, defaultPlan, overrides);\n     }\n \n-    private PlanPhasePriceOverride[] createOverrides(final Plan defaultPlan, final List<CatalogOverridePhaseDefinitionModelDao> phaseDefs) {\n+    private PlanPhasePriceOverride[] createOverrides(final Plan defaultPlan, final List<CatalogOverridePhaseDefinitionModelDao> phaseDefs, final InternalTenantContext context) {\n \n         final PlanPhasePriceOverride[] result = new PlanPhasePriceOverride[defaultPlan.getAllPhases().length];\n \n         for (int i = 0; i < defaultPlan.getAllPhases().length; i++) {\n-\n             final PlanPhase curPhase = defaultPlan.getAllPhases()[i];\n             final CatalogOverridePhaseDefinitionModelDao overriddenPhase = Iterables.tryFind(phaseDefs, new Predicate<CatalogOverridePhaseDefinitionModelDao>() {\n                 @Override\n                 public boolean apply(final CatalogOverridePhaseDefinitionModelDao input) {\n                     return input.getParentPhaseName().equals(curPhase.getName());\n                 }\n             }).orNull();\n-            result[i] = (overriddenPhase != null) ?\n-                        new DefaultPlanPhasePriceOverride(curPhase.getName(), Currency.valueOf(overriddenPhase.getCurrency()), overriddenPhase.getFixedPrice(), overriddenPhase.getRecurringPrice()) :\n-                        null;\n+\n+            if(overriddenPhase != null){\n+              List<UsagePriceOverride> usagePriceOverrides =  getUsagePriceOverrides(curPhase, overriddenPhase, context);\n+              result[i] = new DefaultPlanPhasePriceOverride(curPhase.getName(), Currency.valueOf(overriddenPhase.getCurrency()), overriddenPhase.getFixedPrice(), overriddenPhase.getRecurringPrice(), usagePriceOverrides);\n+            }\n+            else","path":"catalog/src/main/java/org/killbill/billing/catalog/caching/EhCacheOverriddenPlanCache.java","position":84,"original_position":84,"commit_id":"7f3ee569daa4d39156f52f28a43e3157c73853c3","original_commit_id":"7f3ee569daa4d39156f52f28a43e3157c73853c3","user":{"login":"pierre","id":51940,"avatar_url":"https://avatars.githubusercontent.com/u/51940?v=3","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":"Nit: we prefer to always explicitly add the curly braces (same remark below).","created_at":"2016-11-03T12:00:15Z","updated_at":"2016-11-03T12:08:41Z","html_url":"https://github.com/killbill/killbill/pull/638#discussion_r86328190","pull_request_url":"https://api.github.com/repos/killbill/killbill/pulls/638","_links":{"self":{"href":"https://api.github.com/repos/killbill/killbill/pulls/comments/86328190"},"html":{"href":"https://github.com/killbill/killbill/pull/638#discussion_r86328190"},"pull_request":{"href":"https://api.github.com/repos/killbill/killbill/pulls/638"}}},"pull_request":{"url":"https://api.github.com/repos/killbill/killbill/pulls/638","id":91691546,"html_url":"https://github.com/killbill/killbill/pull/638","diff_url":"https://github.com/killbill/killbill/pull/638.diff","patch_url":"https://github.com/killbill/killbill/pull/638.patch","issue_url":"https://api.github.com/repos/killbill/killbill/issues/638","number":638,"state":"open","locked":false,"title":"Usage price override","user":{"login":"sruthipendyala","id":11093387,"avatar_url":"https://avatars.githubusercontent.com/u/11093387?v=3","gravatar_id":"","url":"https://api.github.com/users/sruthipendyala","html_url":"https://github.com/sruthipendyala","followers_url":"https://api.github.com/users/sruthipendyala/followers","following_url":"https://api.github.com/users/sruthipendyala/following{/other_user}","gists_url":"https://api.github.com/users/sruthipendyala/gists{/gist_id}","starred_url":"https://api.github.com/users/sruthipendyala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sruthipendyala/subscriptions","organizations_url":"https://api.github.com/users/sruthipendyala/orgs","repos_url":"https://api.github.com/users/sruthipendyala/repos","events_url":"https://api.github.com/users/sruthipendyala/events{/privacy}","received_events_url":"https://api.github.com/users/sruthipendyala/received_events","type":"User","site_admin":false},"body":"Initial Implementation of usage price override. Started off with implementing only Tiered Block Price Override, for Usage CONSUMABLE IN ARREAR.\r\n\r\nUsage price override #614","created_at":"2016-10-31T21:12:04Z","updated_at":"2016-11-03T12:08:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b496e7e9a98c0f103edd26225ef44838867957b2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/killbill/killbill/pulls/638/commits","review_comments_url":"https://api.github.com/repos/killbill/killbill/pulls/638/comments","review_comment_url":"https://api.github.com/repos/killbill/killbill/pulls/comments{/number}","comments_url":"https://api.github.com/repos/killbill/killbill/issues/638/comments","statuses_url":"https://api.github.com/repos/killbill/killbill/statuses/7f3ee569daa4d39156f52f28a43e3157c73853c3","head":{"label":"sruthipendyala:unit-price-override","ref":"unit-price-override","sha":"7f3ee569daa4d39156f52f28a43e3157c73853c3","user":{"login":"sruthipendyala","id":11093387,"avatar_url":"https://avatars.githubusercontent.com/u/11093387?v=3","gravatar_id":"","url":"https://api.github.com/users/sruthipendyala","html_url":"https://github.com/sruthipendyala","followers_url":"https://api.github.com/users/sruthipendyala/followers","following_url":"https://api.github.com/users/sruthipendyala/following{/other_user}","gists_url":"https://api.github.com/users/sruthipendyala/gists{/gist_id}","starred_url":"https://api.github.com/users/sruthipendyala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sruthipendyala/subscriptions","organizations_url":"https://api.github.com/users/sruthipendyala/orgs","repos_url":"https://api.github.com/users/sruthipendyala/repos","events_url":"https://api.github.com/users/sruthipendyala/events{/privacy}","received_events_url":"https://api.github.com/users/sruthipendyala/received_events","type":"User","site_admin":false},"repo":{"id":58552697,"name":"killbill","full_name":"sruthipendyala/killbill","owner":{"login":"sruthipendyala","id":11093387,"avatar_url":"https://avatars.githubusercontent.com/u/11093387?v=3","gravatar_id":"","url":"https://api.github.com/users/sruthipendyala","html_url":"https://github.com/sruthipendyala","followers_url":"https://api.github.com/users/sruthipendyala/followers","following_url":"https://api.github.com/users/sruthipendyala/following{/other_user}","gists_url":"https://api.github.com/users/sruthipendyala/gists{/gist_id}","starred_url":"https://api.github.com/users/sruthipendyala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sruthipendyala/subscriptions","organizations_url":"https://api.github.com/users/sruthipendyala/orgs","repos_url":"https://api.github.com/users/sruthipendyala/repos","events_url":"https://api.github.com/users/sruthipendyala/events{/privacy}","received_events_url":"https://api.github.com/users/sruthipendyala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sruthipendyala/killbill","description":"Open-Source Subscription Billing & Payment Platform","fork":true,"url":"https://api.github.com/repos/sruthipendyala/killbill","forks_url":"https://api.github.com/repos/sruthipendyala/killbill/forks","keys_url":"https://api.github.com/repos/sruthipendyala/killbill/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sruthipendyala/killbill/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sruthipendyala/killbill/teams","hooks_url":"https://api.github.com/repos/sruthipendyala/killbill/hooks","issue_events_url":"https://api.github.com/repos/sruthipendyala/killbill/issues/events{/number}","events_url":"https://api.github.com/repos/sruthipendyala/killbill/events","assignees_url":"https://api.github.com/repos/sruthipendyala/killbill/assignees{/user}","branches_url":"https://api.github.com/repos/sruthipendyala/killbill/branches{/branch}","tags_url":"https://api.github.com/repos/sruthipendyala/killbill/tags","blobs_url":"https://api.github.com/repos/sruthipendyala/killbill/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sruthipendyala/killbill/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sruthipendyala/killbill/git/refs{/sha}","trees_url":"https://api.github.com/repos/sruthipendyala/killbill/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sruthipendyala/killbill/statuses/{sha}","languages_url":"https://api.github.com/repos/sruthipendyala/killbill/languages","stargazers_url":"https://api.github.com/repos/sruthipendyala/killbill/stargazers","contributors_url":"https://api.github.com/repos/sruthipendyala/killbill/contributors","subscribers_url":"https://api.github.com/repos/sruthipendyala/killbill/subscribers","subscription_url":"https://api.github.com/repos/sruthipendyala/killbill/subscription","commits_url":"https://api.github.com/repos/sruthipendyala/killbill/commits{/sha}","git_commits_url":"https://api.github.com/repos/sruthipendyala/killbill/git/commits{/sha}","comments_url":"https://api.github.com/repos/sruthipendyala/killbill/comments{/number}","issue_comment_url":"https://api.github.com/repos/sruthipendyala/killbill/issues/comments{/number}","contents_url":"https://api.github.com/repos/sruthipendyala/killbill/contents/{+path}","compare_url":"https://api.github.com/repos/sruthipendyala/killbill/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sruthipendyala/killbill/merges","archive_url":"https://api.github.com/repos/sruthipendyala/killbill/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sruthipendyala/killbill/downloads","issues_url":"https://api.github.com/repos/sruthipendyala/killbill/issues{/number}","pulls_url":"https://api.github.com/repos/sruthipendyala/killbill/pulls{/number}","milestones_url":"https://api.github.com/repos/sruthipendyala/killbill/milestones{/number}","notifications_url":"https://api.github.com/repos/sruthipendyala/killbill/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sruthipendyala/killbill/labels{/name}","releases_url":"https://api.github.com/repos/sruthipendyala/killbill/releases{/id}","deployments_url":"https://api.github.com/repos/sruthipendyala/killbill/deployments","created_at":"2016-05-11T14:34:19Z","updated_at":"2016-05-11T14:34:25Z","pushed_at":"2016-11-02T18:44:05Z","git_url":"git://github.com/sruthipendyala/killbill.git","ssh_url":"git@github.com:sruthipendyala/killbill.git","clone_url":"https://github.com/sruthipendyala/killbill.git","svn_url":"https://github.com/sruthipendyala/killbill","homepage":"http://killbill.io/","size":661768,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"killbill:work-for-release-0.17.x","ref":"work-for-release-0.17.x","sha":"55590fe8f2838fd413b4edc893bea63465635a6e","user":{"login":"killbill","id":2446739,"avatar_url":"https://avatars.githubusercontent.com/u/2446739?v=3","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":6325420,"name":"killbill","full_name":"killbill/killbill","owner":{"login":"killbill","id":2446739,"avatar_url":"https://avatars.githubusercontent.com/u/2446739?v=3","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","description":"Open-Source Subscription Billing & Payment Platform","fork":false,"url":"https://api.github.com/repos/killbill/killbill","forks_url":"https://api.github.com/repos/killbill/killbill/forks","keys_url":"https://api.github.com/repos/killbill/killbill/keys{/key_id}","collaborators_url":"https://api.github.com/repos/killbill/killbill/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/killbill/killbill/teams","hooks_url":"https://api.github.com/repos/killbill/killbill/hooks","issue_events_url":"https://api.github.com/repos/killbill/killbill/issues/events{/number}","events_url":"https://api.github.com/repos/killbill/killbill/events","assignees_url":"https://api.github.com/repos/killbill/killbill/assignees{/user}","branches_url":"https://api.github.com/repos/killbill/killbill/branches{/branch}","tags_url":"https://api.github.com/repos/killbill/killbill/tags","blobs_url":"https://api.github.com/repos/killbill/killbill/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/killbill/killbill/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/killbill/killbill/git/refs{/sha}","trees_url":"https://api.github.com/repos/killbill/killbill/git/trees{/sha}","statuses_url":"https://api.github.com/repos/killbill/killbill/statuses/{sha}","languages_url":"https://api.github.com/repos/killbill/killbill/languages","stargazers_url":"https://api.github.com/repos/killbill/killbill/stargazers","contributors_url":"https://api.github.com/repos/killbill/killbill/contributors","subscribers_url":"https://api.github.com/repos/killbill/killbill/subscribers","subscription_url":"https://api.github.com/repos/killbill/killbill/subscription","commits_url":"https://api.github.com/repos/killbill/killbill/commits{/sha}","git_commits_url":"https://api.github.com/repos/killbill/killbill/git/commits{/sha}","comments_url":"https://api.github.com/repos/killbill/killbill/comments{/number}","issue_comment_url":"https://api.github.com/repos/killbill/killbill/issues/comments{/number}","contents_url":"https://api.github.com/repos/killbill/killbill/contents/{+path}","compare_url":"https://api.github.com/repos/killbill/killbill/compare/{base}...{head}","merges_url":"https://api.github.com/repos/killbill/killbill/merges","archive_url":"https://api.github.com/repos/killbill/killbill/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/killbill/killbill/downloads","issues_url":"https://api.github.com/repos/killbill/killbill/issues{/number}","pulls_url":"https://api.github.com/repos/killbill/killbill/pulls{/number}","milestones_url":"https://api.github.com/repos/killbill/killbill/milestones{/number}","notifications_url":"https://api.github.com/repos/killbill/killbill/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/killbill/killbill/labels{/name}","releases_url":"https://api.github.com/repos/killbill/killbill/releases{/id}","deployments_url":"https://api.github.com/repos/killbill/killbill/deployments","created_at":"2012-10-21T20:55:05Z","updated_at":"2016-11-03T11:37:20Z","pushed_at":"2016-11-03T00:39:58Z","git_url":"git://github.com/killbill/killbill.git","ssh_url":"git@github.com:killbill/killbill.git","clone_url":"https://github.com/killbill/killbill.git","svn_url":"https://github.com/killbill/killbill","homepage":"http://killbill.io/","size":665275,"stargazers_count":1230,"watchers_count":1230,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":200,"mirror_url":null,"open_issues_count":74,"forks":200,"open_issues":74,"watchers":1230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/killbill/killbill/pulls/638"},"html":{"href":"https://github.com/killbill/killbill/pull/638"},"issue":{"href":"https://api.github.com/repos/killbill/killbill/issues/638"},"comments":{"href":"https://api.github.com/repos/killbill/killbill/issues/638/comments"},"review_comments":{"href":"https://api.github.com/repos/killbill/killbill/pulls/638/comments"},"review_comment":{"href":"https://api.github.com/repos/killbill/killbill/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/killbill/killbill/pulls/638/commits"},"statuses":{"href":"https://api.github.com/repos/killbill/killbill/statuses/7f3ee569daa4d39156f52f28a43e3157c73853c3"}}}}
{"actor":{"display_login":"pierre"}}