{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments/46541542","id":46541542,"diff_hunk":"@@ -82,17 +86,54 @@ trait Joiner extends Controller with ActivityTracking with LazyLogging {\n     }\n   }\n \n-  def enterDetails(tier: Tier) = (AuthenticatedAction andThen onlyNonMemberFilter(onMember = redirectMemberAttemptingToSignUp(tier))).async { implicit request =>\n+  def NonMemberAction(tier: Tier) = AuthenticatedAction andThen onlyNonMemberFilter(onMember = redirectMemberAttemptingToSignUp(tier))\n+\n+  def enterPaidDetails(tier: PaidTier) = NonMemberAction(tier).async { implicit request =>\n     for {\n       (privateFields, marketingChoices, passwordExists) <- identityDetails(request.user, request)\n       catalog <- request.catalog\n     } yield {\n-      catalog.publicTierDetails(tier) match {\n-        case freeDetails: FreeTierDetails => Ok(views.html.joiner.form.friendSignup(freeDetails, getOrBlank(privateFields), marketingChoices, passwordExists))\n-        case paidDetails: PaidTierDetails =>\n-          val pageInfo = PageInfo.default.copy(stripePublicKey = Some(request.touchpointBackend.stripeService.publicKey))\n-          Ok(views.html.joiner.form.payment(paidDetails, getOrBlank(privateFields), marketingChoices, passwordExists, pageInfo))\n-      }\n+      val cg = countryGroup\n+      val paidDetails = catalog.paidTierDetails(tier)\n+      val currency = if (paidDetails.currencies.contains(cg.currency)) cg.currency else GBP\n+      val pageInfo = PageInfo(\n+        stripePublicKey = Some(request.touchpointBackend.stripeService.publicKey),\n+        formI18n = FormI18n(cg.defaultCountry, currency, Year)\n+      )\n+\n+      Ok(views.html.joiner.form.payment(\n+         countriesWithCurrencies = CountryWithCurrency.whitelisted(paidDetails.currencies, GBP),\n+         details = paidDetails,\n+         userFields = setCountry(privateFields, cg),\n+         marketingChoices = marketingChoices,\n+         passwordExists = passwordExists,\n+         pageInfo = pageInfo))\n+    }\n+  }\n+\n+  private def countryGroup(implicit req: RequestHeader): CountryGroup = (for {","path":"frontend/app/controllers/Joiner.scala","position":96,"original_position":96,"commit_id":"1605ec9ff8554481fd91121a00ee86097ceb6443","original_commit_id":"1605ec9ff8554481fd91121a00ee86097ceb6443","user":{"login":"rtyley","id":52038,"avatar_url":"https://avatars.githubusercontent.com/u/52038?v=3","gravatar_id":"","url":"https://api.github.com/users/rtyley","html_url":"https://github.com/rtyley","followers_url":"https://api.github.com/users/rtyley/followers","following_url":"https://api.github.com/users/rtyley/following{/other_user}","gists_url":"https://api.github.com/users/rtyley/gists{/gist_id}","starred_url":"https://api.github.com/users/rtyley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtyley/subscriptions","organizations_url":"https://api.github.com/users/rtyley/orgs","repos_url":"https://api.github.com/users/rtyley/repos","events_url":"https://api.github.com/users/rtyley/events{/privacy}","received_events_url":"https://api.github.com/users/rtyley/received_events","type":"User","site_admin":false},"body":"https://www.playframework.com/documentation/2.2.x/ScalaRouting#Optional-parameters","created_at":"2015-12-03T11:40:46Z","updated_at":"2015-12-03T11:40:46Z","html_url":"https://github.com/guardian/membership-frontend/pull/867#discussion_r46541542","pull_request_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/867","_links":{"self":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments/46541542"},"html":{"href":"https://github.com/guardian/membership-frontend/pull/867#discussion_r46541542"},"pull_request":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/867"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/membership-frontend/pulls/867","id":52006366,"html_url":"https://github.com/guardian/membership-frontend/pull/867","diff_url":"https://github.com/guardian/membership-frontend/pull/867.diff","patch_url":"https://github.com/guardian/membership-frontend/pull/867.patch","issue_url":"https://api.github.com/repos/guardian/membership-frontend/issues/867","number":867,"state":"open","locked":false,"title":"NOT BE MERGED YET - Multi currency","user":{"login":"ostapneko","id":1781471,"avatar_url":"https://avatars.githubusercontent.com/u/1781471?v=3","gravatar_id":"","url":"https://api.github.com/users/ostapneko","html_url":"https://github.com/ostapneko","followers_url":"https://api.github.com/users/ostapneko/followers","following_url":"https://api.github.com/users/ostapneko/following{/other_user}","gists_url":"https://api.github.com/users/ostapneko/gists{/gist_id}","starred_url":"https://api.github.com/users/ostapneko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ostapneko/subscriptions","organizations_url":"https://api.github.com/users/ostapneko/orgs","repos_url":"https://api.github.com/users/ostapneko/repos","events_url":"https://api.github.com/users/ostapneko/events{/privacy}","received_events_url":"https://api.github.com/users/ostapneko/received_events","type":"User","site_admin":false},"body":"This is only changing the checkout and upgrade form, not the international supporter pages.\r\n\r\nThe form behaves differently upon joining and upgrading.\r\n  - When you join, the default, preselected country is based on a `country-group` query string. The currency is derived from the selected country for the billing address if it is set, otherwise the delivery address. Whenever the selected country is changed, the currency is changed accordingly\r\n  - When you upgrade, we default to the country set in identity; you are still free to change it. However, we respect only your Zuora account currency (which cannot be change in any way)\r\n  - We constraint the possible upgrade path only to those which make sense for your currencies\r\n\r\nAlso:\r\n- Remove CAS support\r\n- Remove /user/me/details endpoint (replaced by members-data-api)\r\n- Add model.Subscription as a replacement for SubscriptionDetails & other models\r\n- Use the billing address instead of the delivery address to populate the `BillToContact` model in Zuora\r\n\r\nStill to do:\r\n\r\n- Fix the tests\r\n- Make price take floats\r\n- change country group codes so it matches the guardian.co.uk's website: uk, us, au, eu, int, ca, nz","created_at":"2015-11-27T15:39:01Z","updated_at":"2015-12-03T11:40:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4bdfc539dc42109a26cad628373999c956a0e8f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/867/commits","review_comments_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/867/comments","review_comment_url":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/membership-frontend/issues/867/comments","statuses_url":"https://api.github.com/repos/guardian/membership-frontend/statuses/1605ec9ff8554481fd91121a00ee86097ceb6443","head":{"label":"guardian:multi-currency","ref":"multi-currency","sha":"1605ec9ff8554481fd91121a00ee86097ceb6443","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":28401521,"name":"membership-frontend","full_name":"guardian/membership-frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/membership-frontend","description":"Bringing the Guardian to life through live events and meet-ups","fork":false,"url":"https://api.github.com/repos/guardian/membership-frontend","forks_url":"https://api.github.com/repos/guardian/membership-frontend/forks","keys_url":"https://api.github.com/repos/guardian/membership-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/membership-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/membership-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/membership-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/membership-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/membership-frontend/events","assignees_url":"https://api.github.com/repos/guardian/membership-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/membership-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/membership-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/membership-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/membership-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/membership-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/membership-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/membership-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/membership-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/membership-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/membership-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/membership-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/membership-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/membership-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/membership-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/membership-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/membership-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/membership-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/membership-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/membership-frontend/merges","archive_url":"https://api.github.com/repos/guardian/membership-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/membership-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/membership-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/membership-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/membership-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/membership-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/membership-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/membership-frontend/releases{/id}","created_at":"2014-12-23T14:14:38Z","updated_at":"2015-11-12T11:35:55Z","pushed_at":"2015-12-03T11:11:33Z","git_url":"git://github.com/guardian/membership-frontend.git","ssh_url":"git@github.com:guardian/membership-frontend.git","clone_url":"https://github.com/guardian/membership-frontend.git","svn_url":"https://github.com/guardian/membership-frontend","homepage":"https://membership.theguardian.com/","size":38920,"stargazers_count":17,"watchers_count":17,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":6,"forks":10,"open_issues":6,"watchers":17,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"d81f23ddec7ffba5a8141b3dba2753d784fe4227","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":28401521,"name":"membership-frontend","full_name":"guardian/membership-frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/membership-frontend","description":"Bringing the Guardian to life through live events and meet-ups","fork":false,"url":"https://api.github.com/repos/guardian/membership-frontend","forks_url":"https://api.github.com/repos/guardian/membership-frontend/forks","keys_url":"https://api.github.com/repos/guardian/membership-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/membership-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/membership-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/membership-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/membership-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/membership-frontend/events","assignees_url":"https://api.github.com/repos/guardian/membership-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/membership-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/membership-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/membership-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/membership-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/membership-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/membership-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/membership-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/membership-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/membership-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/membership-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/membership-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/membership-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/membership-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/membership-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/membership-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/membership-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/membership-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/membership-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/membership-frontend/merges","archive_url":"https://api.github.com/repos/guardian/membership-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/membership-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/membership-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/membership-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/membership-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/membership-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/membership-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/membership-frontend/releases{/id}","created_at":"2014-12-23T14:14:38Z","updated_at":"2015-11-12T11:35:55Z","pushed_at":"2015-12-03T11:11:33Z","git_url":"git://github.com/guardian/membership-frontend.git","ssh_url":"git@github.com:guardian/membership-frontend.git","clone_url":"https://github.com/guardian/membership-frontend.git","svn_url":"https://github.com/guardian/membership-frontend","homepage":"https://membership.theguardian.com/","size":38920,"stargazers_count":17,"watchers_count":17,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":6,"forks":10,"open_issues":6,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/867"},"html":{"href":"https://github.com/guardian/membership-frontend/pull/867"},"issue":{"href":"https://api.github.com/repos/guardian/membership-frontend/issues/867"},"comments":{"href":"https://api.github.com/repos/guardian/membership-frontend/issues/867/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/867/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/membership-frontend/pulls/867/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/membership-frontend/statuses/1605ec9ff8554481fd91121a00ee86097ceb6443"}}}}