{"action":"created","comment":{"url":"https://api.github.com/repos/google-pay/android-quickstart/pulls/comments/238082538","pull_request_review_id":180544765,"id":238082538,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODA4MjUzOA==","diff_hunk":"@@ -0,0 +1,272 @@\n+/*\n+ * Copyright 2017 Google Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.google.android.gms.samples.wallet\n+\n+import android.app.Activity\n+import com.google.android.gms.wallet.PaymentsClient\n+import com.google.android.gms.wallet.Wallet\n+import org.json.JSONArray\n+import org.json.JSONException\n+import org.json.JSONObject\n+import java.math.BigDecimal\n+import java.math.RoundingMode\n+import java.util.*\n+\n+/**\n+ * Contains helper static methods for dealing with the Payments API.\n+ *\n+ *\n+ * Many of the parameters used in the code are optional and are set here merely to call out their\n+ * existence. Please consult the documentation to learn more and feel free to remove ones not\n+ * relevant to your implementation.\n+ */\n+object PaymentsUtil {\n+    val MICROS = BigDecimal(1000000.0)\n+\n+    /**\n+     * Create a Google Pay API base request object with properties used in all requests.\n+     *\n+     * @return Google Pay API base request object.\n+     * @throws JSONException\n+     */\n+    private val baseRequest = JSONObject().put(\"apiVersion\", 2).put(\"apiVersionMinor\", 0)\n+\n+    /**\n+     * Gateway Integration: Identify your gateway and your app's gateway merchant identifier.\n+     *\n+     *\n+     * The Google Pay API response will return an encrypted payment method capable of being charged\n+     * by a supported gateway after payer authorization.\n+     *\n+     *\n+     * TODO: Check with your gateway on the parameters to pass and modify them in Constants.java.\n+     *\n+     * @return Payment data tokenization for the CARD payment method.\n+     * @throws JSONException\n+     * @see [PaymentMethodTokenizationSpecification](https://developers.google.com/pay/api/android/reference/object.PaymentMethodTokenizationSpecification)\n+     */\n+    private fun gatewayTokenizationSpecification(): JSONObject {\n+        if (Constants.PAYMENT_GATEWAY_TOKENIZATION_PARAMETERS.isEmpty()) {\n+            throw RuntimeException(\n+                    \"Please edit the Constants.java file to add gateway name and other parameters your \" + \"processor requires\")\n+        }\n+        val tokenizationSpecification = JSONObject()","path":"app/src/main/java/com/google/android/gms/samples/wallet/PaymentsUtil.kt","position":67,"original_position":67,"commit_id":"9ebbe43f5ba7fb95b11cdb1892549a49b219aaa7","original_commit_id":"9ebbe43f5ba7fb95b11cdb1892549a49b219aaa7","user":{"login":"nekdenis","id":2456891,"node_id":"MDQ6VXNlcjI0NTY4OTE=","avatar_url":"https://avatars3.githubusercontent.com/u/2456891?v=4","gravatar_id":"","url":"https://api.github.com/users/nekdenis","html_url":"https://github.com/nekdenis","followers_url":"https://api.github.com/users/nekdenis/followers","following_url":"https://api.github.com/users/nekdenis/following{/other_user}","gists_url":"https://api.github.com/users/nekdenis/gists{/gist_id}","starred_url":"https://api.github.com/users/nekdenis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nekdenis/subscriptions","organizations_url":"https://api.github.com/users/nekdenis/orgs","repos_url":"https://api.github.com/users/nekdenis/repos","events_url":"https://api.github.com/users/nekdenis/events{/privacy}","received_events_url":"https://api.github.com/users/nekdenis/received_events","type":"User","site_admin":false},"body":"val tokenizationSpecification = JSONObject().apply{\r\n put(...\r\n}","created_at":"2018-12-02T02:12:17Z","updated_at":"2018-12-02T02:18:59Z","html_url":"https://github.com/google-pay/android-quickstart/pull/10#discussion_r238082538","pull_request_url":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/google-pay/android-quickstart/pulls/comments/238082538"},"html":{"href":"https://github.com/google-pay/android-quickstart/pull/10#discussion_r238082538"},"pull_request":{"href":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10","id":226001342,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MDAxMzQy","html_url":"https://github.com/google-pay/android-quickstart/pull/10","diff_url":"https://github.com/google-pay/android-quickstart/pull/10.diff","patch_url":"https://github.com/google-pay/android-quickstart/pull/10.patch","issue_url":"https://api.github.com/repos/google-pay/android-quickstart/issues/10","number":10,"state":"open","locked":false,"title":"Conversion to Kotlin & update dependencies","user":{"login":"davidvavra","id":395884,"node_id":"MDQ6VXNlcjM5NTg4NA==","avatar_url":"https://avatars1.githubusercontent.com/u/395884?v=4","gravatar_id":"","url":"https://api.github.com/users/davidvavra","html_url":"https://github.com/davidvavra","followers_url":"https://api.github.com/users/davidvavra/followers","following_url":"https://api.github.com/users/davidvavra/following{/other_user}","gists_url":"https://api.github.com/users/davidvavra/gists{/gist_id}","starred_url":"https://api.github.com/users/davidvavra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidvavra/subscriptions","organizations_url":"https://api.github.com/users/davidvavra/orgs","repos_url":"https://api.github.com/users/davidvavra/repos","events_url":"https://api.github.com/users/davidvavra/events{/privacy}","received_events_url":"https://api.github.com/users/davidvavra/received_events","type":"User","site_admin":false},"body":"I have converted the code from Java to Kotlin, made it more Kotlin-friendly and updated dependencies to latest versions. I did this for purposes of Google Pay Launchathon in Prague (October 2018). Feel free to merge or put it to different branch/repo to preserve the current Java version.","created_at":"2018-10-26T07:28:56Z","updated_at":"2018-12-02T02:18:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3b4b4139df6e5406980a344aaa331e1925faf7f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10/commits","review_comments_url":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10/comments","review_comment_url":"https://api.github.com/repos/google-pay/android-quickstart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google-pay/android-quickstart/issues/10/comments","statuses_url":"https://api.github.com/repos/google-pay/android-quickstart/statuses/9ebbe43f5ba7fb95b11cdb1892549a49b219aaa7","head":{"label":"davidvavra:master","ref":"master","sha":"9ebbe43f5ba7fb95b11cdb1892549a49b219aaa7","user":{"login":"davidvavra","id":395884,"node_id":"MDQ6VXNlcjM5NTg4NA==","avatar_url":"https://avatars1.githubusercontent.com/u/395884?v=4","gravatar_id":"","url":"https://api.github.com/users/davidvavra","html_url":"https://github.com/davidvavra","followers_url":"https://api.github.com/users/davidvavra/followers","following_url":"https://api.github.com/users/davidvavra/following{/other_user}","gists_url":"https://api.github.com/users/davidvavra/gists{/gist_id}","starred_url":"https://api.github.com/users/davidvavra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidvavra/subscriptions","organizations_url":"https://api.github.com/users/davidvavra/orgs","repos_url":"https://api.github.com/users/davidvavra/repos","events_url":"https://api.github.com/users/davidvavra/events{/privacy}","received_events_url":"https://api.github.com/users/davidvavra/received_events","type":"User","site_admin":false},"repo":{"id":154787353,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ3ODczNTM=","name":"android-quickstart","full_name":"davidvavra/android-quickstart","private":false,"owner":{"login":"davidvavra","id":395884,"node_id":"MDQ6VXNlcjM5NTg4NA==","avatar_url":"https://avatars1.githubusercontent.com/u/395884?v=4","gravatar_id":"","url":"https://api.github.com/users/davidvavra","html_url":"https://github.com/davidvavra","followers_url":"https://api.github.com/users/davidvavra/followers","following_url":"https://api.github.com/users/davidvavra/following{/other_user}","gists_url":"https://api.github.com/users/davidvavra/gists{/gist_id}","starred_url":"https://api.github.com/users/davidvavra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidvavra/subscriptions","organizations_url":"https://api.github.com/users/davidvavra/orgs","repos_url":"https://api.github.com/users/davidvavra/repos","events_url":"https://api.github.com/users/davidvavra/events{/privacy}","received_events_url":"https://api.github.com/users/davidvavra/received_events","type":"User","site_admin":false},"html_url":"https://github.com/davidvavra/android-quickstart","description":"Google Pay API sample application for Android","fork":true,"url":"https://api.github.com/repos/davidvavra/android-quickstart","forks_url":"https://api.github.com/repos/davidvavra/android-quickstart/forks","keys_url":"https://api.github.com/repos/davidvavra/android-quickstart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davidvavra/android-quickstart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davidvavra/android-quickstart/teams","hooks_url":"https://api.github.com/repos/davidvavra/android-quickstart/hooks","issue_events_url":"https://api.github.com/repos/davidvavra/android-quickstart/issues/events{/number}","events_url":"https://api.github.com/repos/davidvavra/android-quickstart/events","assignees_url":"https://api.github.com/repos/davidvavra/android-quickstart/assignees{/user}","branches_url":"https://api.github.com/repos/davidvavra/android-quickstart/branches{/branch}","tags_url":"https://api.github.com/repos/davidvavra/android-quickstart/tags","blobs_url":"https://api.github.com/repos/davidvavra/android-quickstart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davidvavra/android-quickstart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davidvavra/android-quickstart/git/refs{/sha}","trees_url":"https://api.github.com/repos/davidvavra/android-quickstart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davidvavra/android-quickstart/statuses/{sha}","languages_url":"https://api.github.com/repos/davidvavra/android-quickstart/languages","stargazers_url":"https://api.github.com/repos/davidvavra/android-quickstart/stargazers","contributors_url":"https://api.github.com/repos/davidvavra/android-quickstart/contributors","subscribers_url":"https://api.github.com/repos/davidvavra/android-quickstart/subscribers","subscription_url":"https://api.github.com/repos/davidvavra/android-quickstart/subscription","commits_url":"https://api.github.com/repos/davidvavra/android-quickstart/commits{/sha}","git_commits_url":"https://api.github.com/repos/davidvavra/android-quickstart/git/commits{/sha}","comments_url":"https://api.github.com/repos/davidvavra/android-quickstart/comments{/number}","issue_comment_url":"https://api.github.com/repos/davidvavra/android-quickstart/issues/comments{/number}","contents_url":"https://api.github.com/repos/davidvavra/android-quickstart/contents/{+path}","compare_url":"https://api.github.com/repos/davidvavra/android-quickstart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davidvavra/android-quickstart/merges","archive_url":"https://api.github.com/repos/davidvavra/android-quickstart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davidvavra/android-quickstart/downloads","issues_url":"https://api.github.com/repos/davidvavra/android-quickstart/issues{/number}","pulls_url":"https://api.github.com/repos/davidvavra/android-quickstart/pulls{/number}","milestones_url":"https://api.github.com/repos/davidvavra/android-quickstart/milestones{/number}","notifications_url":"https://api.github.com/repos/davidvavra/android-quickstart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davidvavra/android-quickstart/labels{/name}","releases_url":"https://api.github.com/repos/davidvavra/android-quickstart/releases{/id}","deployments_url":"https://api.github.com/repos/davidvavra/android-quickstart/deployments","created_at":"2018-10-26T06:26:59Z","updated_at":"2018-10-26T07:25:34Z","pushed_at":"2018-10-26T07:25:32Z","git_url":"git://github.com/davidvavra/android-quickstart.git","ssh_url":"git@github.com:davidvavra/android-quickstart.git","clone_url":"https://github.com/davidvavra/android-quickstart.git","svn_url":"https://github.com/davidvavra/android-quickstart","homepage":"https://developers.google.com/pay/api/android/","size":525,"stargazers_count":0,"watchers_count":0,"language":"Kotlin","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google-pay:master","ref":"master","sha":"8ffbc0337c9a772cfad4bd5e36d79cbdf58b0c0a","user":{"login":"google-pay","id":5232468,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMzI0Njg=","avatar_url":"https://avatars3.githubusercontent.com/u/5232468?v=4","gravatar_id":"","url":"https://api.github.com/users/google-pay","html_url":"https://github.com/google-pay","followers_url":"https://api.github.com/users/google-pay/followers","following_url":"https://api.github.com/users/google-pay/following{/other_user}","gists_url":"https://api.github.com/users/google-pay/gists{/gist_id}","starred_url":"https://api.github.com/users/google-pay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google-pay/subscriptions","organizations_url":"https://api.github.com/users/google-pay/orgs","repos_url":"https://api.github.com/users/google-pay/repos","events_url":"https://api.github.com/users/google-pay/events{/privacy}","received_events_url":"https://api.github.com/users/google-pay/received_events","type":"Organization","site_admin":false},"repo":{"id":104265797,"node_id":"MDEwOlJlcG9zaXRvcnkxMDQyNjU3OTc=","name":"android-quickstart","full_name":"google-pay/android-quickstart","private":false,"owner":{"login":"google-pay","id":5232468,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMzI0Njg=","avatar_url":"https://avatars3.githubusercontent.com/u/5232468?v=4","gravatar_id":"","url":"https://api.github.com/users/google-pay","html_url":"https://github.com/google-pay","followers_url":"https://api.github.com/users/google-pay/followers","following_url":"https://api.github.com/users/google-pay/following{/other_user}","gists_url":"https://api.github.com/users/google-pay/gists{/gist_id}","starred_url":"https://api.github.com/users/google-pay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google-pay/subscriptions","organizations_url":"https://api.github.com/users/google-pay/orgs","repos_url":"https://api.github.com/users/google-pay/repos","events_url":"https://api.github.com/users/google-pay/events{/privacy}","received_events_url":"https://api.github.com/users/google-pay/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/google-pay/android-quickstart","description":"Google Pay API sample application for Android","fork":false,"url":"https://api.github.com/repos/google-pay/android-quickstart","forks_url":"https://api.github.com/repos/google-pay/android-quickstart/forks","keys_url":"https://api.github.com/repos/google-pay/android-quickstart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google-pay/android-quickstart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google-pay/android-quickstart/teams","hooks_url":"https://api.github.com/repos/google-pay/android-quickstart/hooks","issue_events_url":"https://api.github.com/repos/google-pay/android-quickstart/issues/events{/number}","events_url":"https://api.github.com/repos/google-pay/android-quickstart/events","assignees_url":"https://api.github.com/repos/google-pay/android-quickstart/assignees{/user}","branches_url":"https://api.github.com/repos/google-pay/android-quickstart/branches{/branch}","tags_url":"https://api.github.com/repos/google-pay/android-quickstart/tags","blobs_url":"https://api.github.com/repos/google-pay/android-quickstart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google-pay/android-quickstart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google-pay/android-quickstart/git/refs{/sha}","trees_url":"https://api.github.com/repos/google-pay/android-quickstart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google-pay/android-quickstart/statuses/{sha}","languages_url":"https://api.github.com/repos/google-pay/android-quickstart/languages","stargazers_url":"https://api.github.com/repos/google-pay/android-quickstart/stargazers","contributors_url":"https://api.github.com/repos/google-pay/android-quickstart/contributors","subscribers_url":"https://api.github.com/repos/google-pay/android-quickstart/subscribers","subscription_url":"https://api.github.com/repos/google-pay/android-quickstart/subscription","commits_url":"https://api.github.com/repos/google-pay/android-quickstart/commits{/sha}","git_commits_url":"https://api.github.com/repos/google-pay/android-quickstart/git/commits{/sha}","comments_url":"https://api.github.com/repos/google-pay/android-quickstart/comments{/number}","issue_comment_url":"https://api.github.com/repos/google-pay/android-quickstart/issues/comments{/number}","contents_url":"https://api.github.com/repos/google-pay/android-quickstart/contents/{+path}","compare_url":"https://api.github.com/repos/google-pay/android-quickstart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google-pay/android-quickstart/merges","archive_url":"https://api.github.com/repos/google-pay/android-quickstart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google-pay/android-quickstart/downloads","issues_url":"https://api.github.com/repos/google-pay/android-quickstart/issues{/number}","pulls_url":"https://api.github.com/repos/google-pay/android-quickstart/pulls{/number}","milestones_url":"https://api.github.com/repos/google-pay/android-quickstart/milestones{/number}","notifications_url":"https://api.github.com/repos/google-pay/android-quickstart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google-pay/android-quickstart/labels{/name}","releases_url":"https://api.github.com/repos/google-pay/android-quickstart/releases{/id}","deployments_url":"https://api.github.com/repos/google-pay/android-quickstart/deployments","created_at":"2017-09-20T20:43:48Z","updated_at":"2018-11-29T01:55:12Z","pushed_at":"2018-10-26T07:28:57Z","git_url":"git://github.com/google-pay/android-quickstart.git","ssh_url":"git@github.com:google-pay/android-quickstart.git","clone_url":"https://github.com/google-pay/android-quickstart.git","svn_url":"https://github.com/google-pay/android-quickstart","homepage":"https://developers.google.com/pay/api/android/","size":519,"stargazers_count":63,"watchers_count":63,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":36,"open_issues":4,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10"},"html":{"href":"https://github.com/google-pay/android-quickstart/pull/10"},"issue":{"href":"https://api.github.com/repos/google-pay/android-quickstart/issues/10"},"comments":{"href":"https://api.github.com/repos/google-pay/android-quickstart/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/google-pay/android-quickstart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google-pay/android-quickstart/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/google-pay/android-quickstart/statuses/9ebbe43f5ba7fb95b11cdb1892549a49b219aaa7"}},"author_association":"NONE"}}
{"actor":{"display_login":"nekdenis"}}