{"action":"opened","issue":{"url":"https://api.github.com/repos/killbill/killbill/issues/573","repository_url":"https://api.github.com/repos/killbill/killbill","labels_url":"https://api.github.com/repos/killbill/killbill/issues/573/labels{/name}","comments_url":"https://api.github.com/repos/killbill/killbill/issues/573/comments","events_url":"https://api.github.com/repos/killbill/killbill/issues/573/events","html_url":"https://github.com/killbill/killbill/issues/573","id":164650741,"number":573,"title":"\"Invalid payment transition\" Exception when calling notifyPendingTransactionOfStateChanged","user":{"login":"andrenpaes","id":306982,"avatar_url":"https://avatars.githubusercontent.com/u/306982?v=3","gravatar_id":"","url":"https://api.github.com/users/andrenpaes","html_url":"https://github.com/andrenpaes","followers_url":"https://api.github.com/users/andrenpaes/followers","following_url":"https://api.github.com/users/andrenpaes/following{/other_user}","gists_url":"https://api.github.com/users/andrenpaes/gists{/gist_id}","starred_url":"https://api.github.com/users/andrenpaes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrenpaes/subscriptions","organizations_url":"https://api.github.com/users/andrenpaes/orgs","repos_url":"https://api.github.com/users/andrenpaes/repos","events_url":"https://api.github.com/users/andrenpaes/events{/privacy}","received_events_url":"https://api.github.com/users/andrenpaes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-09T05:22:35Z","updated_at":"2016-07-09T05:22:35Z","closed_at":null,"body":"While handling a notification request from Adyen, the killbill-adyen-plugin first stores the received data in the `adyen_response` table, including the result of the transaction (e.g PROCESSED).\r\n\r\nAfterwards, the plugin calls the KillBill API to transition the payment into the expected status (`notifyPendingTransactionOfStateChanged` method). But that call fails with the following exception:\r\n```\r\norg.killbill.billing.payment.api.PaymentApiException: Invalid payment transition VOID from state VOID_SUCCESS\r\n\tat org.killbill.billing.payment.core.sm.PaymentAutomatonRunner.runStateMachineOperation(PaymentAutomatonRunner.java:239)\r\n\tat org.killbill.billing.payment.core.sm.PaymentAutomatonRunner.run(PaymentAutomatonRunner.java:208)\r\n\tat org.killbill.billing.payment.core.PaymentProcessor.performOperation(PaymentProcessor.java:418)\r\n\tat org.killbill.billing.payment.core.PaymentProcessor.notifyPendingPaymentOfStateChanged(PaymentProcessor.java:164)\r\n\tat org.killbill.billing.payment.api.DefaultPaymentApi.notifyPendingTransactionOfStateChanged(DefaultPaymentApi.java:586)\r\n\tat org.killbill.billing.util.glue.KillbillApiAopModule$ProfilingMethodInterceptor$1.execute(KillbillApiAopModule.java:52)\r\n\tat org.killbill.commons.profiling.Profiling.executeWithProfiling(Profiling.java:33)\r\n\tat org.killbill.billing.util.glue.KillbillApiAopModule$ProfilingMethodInterceptor.invoke(KillbillApiAopModule.java:49)\r\n\tat org.killbill.billing.plugin.adyen.core.KillbillAdyenNotificationHandler.transitionPendingTransaction(KillbillAdyenNotificationHandler.java:289)\r\n\tat org.killbill.billing.plugin.adyen.core.KillbillAdyenNotificationHandler.updateKillbill(KillbillAdyenNotificationHandler.java:227)\r\n\tat org.killbill.billing.plugin.adyen.core.KillbillAdyenNotificationHandler.updateKillbill(KillbillAdyenNotificationHandler.java:189)\r\n\tat org.killbill.billing.plugin.adyen.core.KillbillAdyenNotificationHandler.handleNotification(KillbillAdyenNotificationHandler.java:134)\r\n\tat org.killbill.billing.plugin.adyen.client.notification.AdyenNotificationService.handleNotification(AdyenNotificationService.java:121)\r\n\tat org.killbill.billing.plugin.adyen.client.notification.AdyenNotificationService.handleNotifications(AdyenNotificationService.java:83)\r\n\tat org.killbill.billing.plugin.adyen.client.notification.AdyenNotificationService.handleNotifications(AdyenNotificationService.java:62)\r\n\tat org.killbill.billing.plugin.adyen.api.AdyenPaymentPluginApi.processNotification(AdyenPaymentPluginApi.java:497)\r\n\tat sun.reflect.GeneratedMethodAccessor452.invoke(Unknown Source)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:497)\r\n\tat org.killbill.billing.osgi.ContextClassLoaderHelper$ClassLoaderInvocationHandler$1.execute(ContextClassLoaderHelper.java:142)\r\n\tat org.killbill.commons.profiling.Profiling.executeWithProfiling(Profiling.java:33)\r\n\tat org.killbill.billing.osgi.ContextClassLoaderHelper$ClassLoaderInvocationHandler.invoke(ContextClassLoaderHelper.java:139)\r\n\tat com.sun.proxy.$Proxy156.processNotification(Unknown Source)\r\n\tat org.killbill.billing.payment.core.PaymentGatewayProcessor.processNotification(PaymentGatewayProcessor.java:102)\r\n\tat org.killbill.billing.payment.api.DefaultPaymentGatewayApi$2.doPaymentGatewayApiOperation(DefaultPaymentGatewayApi.java:103)\r\n\tat org.killbill.billing.payment.api.DefaultPaymentGatewayApi$2.doPaymentGatewayApiOperation(DefaultPaymentGatewayApi.java:99)\r\n\tat org.killbill.billing.payment.api.DefaultPaymentGatewayApi.executeWithPaymentControl(DefaultPaymentGatewayApi.java:134)\r\n\tat org.killbill.billing.payment.api.DefaultPaymentGatewayApi.processNotificationWithPaymentControl(DefaultPaymentGatewayApi.java:99)\r\n\tat org.killbill.billing.util.glue.KillbillApiAopModule$ProfilingMethodInterceptor$1.execute(KillbillApiAopModule.java:52)\r\n\tat org.killbill.commons.profiling.Profiling.executeWithProfiling(Profiling.java:33)\r\n\tat org.killbill.billing.util.glue.KillbillApiAopModule$ProfilingMethodInterceptor.invoke(KillbillApiAopModule.java:49)\r\n\tat org.killbill.billing.jaxrs.resources.PaymentGatewayResource.processNotification(PaymentGatewayResource.java:187)\r\n\tat org.killbill.commons.skeleton.metrics.TimedResourceInterceptor.invoke(TimedResourceInterceptor.java:67)\r\n\t...\r\n```\r\n\r\nBefore doing anything KB tries to fix the payment status by calling the janitor before transitioning the payment. When the Janitor queries the plugin for getting the latest status of the transaction, it notices it's different from KB records, since the plugin just [finished updating it's internal records](https://github.com/killbill/killbill-adyen-plugin/blob/master/src/main/java/org/killbill/billing/plugin/adyen/core/KillbillAdyenNotificationHandler.java#L219).\r\n\r\nThe janitor then cleans up the payment, causing the original operation, the status transition, to \"fail\" with the above exception (not really a failure, since the payment does get transitioned, but the plugin can't know that).\r\n\r\nIt's worth noticing that, as a consequence of this, we loose information on the `payment_transaction_history` table, since the updated_by field is set to `IncompletePaymentTransactionTask` (instead of something like `Adyen Notification`?).\r\n"}}
{"actor":{"display_login":"andrenpaes"}}