paypal / paypal-here-sdk-android-distribution

Add credit card (swipe & key-in) capabilities to your Android app
Other
84 stars 95 forks source link

NullPointerException when performing transaction in SampleApp using PayPalHere CardReader #71

Closed mastahnish closed 8 years ago

mastahnish commented 8 years ago

Hello,

i'm using Sample app (version 1.6.2.6) and tried to perform test transaction (using Live environment)

However, when I was asked to insert a card into CardReader it started transaction and crashed. This is what I found in logs:

06-08 19:13:08.675 11356-1221/com.paypal.heresdk.sampleapp D/PPHSDK: com.paypal.merchant.sdk.internal.service.cal.CalLogHereRequest-
                                                                     Request URL: https://www.paypal.com/webapps/hereapi/merchant/v1/cal
                                                                     Type: POST
                                                                     Payload:
                                                                     Payload: 
                                                                     {
                                                                         "events": [
                                                                             {
                                                                                 "type": "BIZ",
                                                                                 "data": "sessionId=3800bb06-3796-43ee-9a18-1937718d2f86&timestamp=2016-06-08 18:12:38:686 +0000&actionId=Message&level=ERROR&result=-1&details=: Google Play Location Service Unavailable. ErrorCode : 9",
                                                                                 "status": "-1",
                                                                                 "name": "Message.CLIENT"
                                                                             },
                                                                             {
                                                                                 "type": "BIZ",
                                                                                 "data": "sessionId=3800bb06-3796-43ee-9a18-1937718d2f86&timestamp=2016-06-08 18:12:38:700 +0000&actionId=Message&level=ERROR&result=-1&details=: getLastKnownLocation we don't have any location. returning null",
                                                                                 "status": "-1",
                                                                                 "name": "Message.CLIENT"
                                                                             },
                                                                             {
                                                                                 "type": "BIZ",
                                                                                 "data": "sessionId=3800bb06-3796-43ee-9a18-1937718d2f86&timestamp=2016-06-08 18:12:38:818 +0000&actionId=Message&level=ERROR&result=-1&details=: error: in == null",
                                                                                 "status": "-1",
                                                                                 "name": "Message.CLIENT"
                                                                             },
                                                                             {
                                                                                 "type": "BIZ",
                                                                                 "data": "sessionId=3800bb06-3796-43ee-9a18-1937718d2f86&timestamp=2016-06-08 18:12:40:568 +0000&actionId=MerchantStatusRequest&level=TRACE&result=0&duration=1613",
                                                                                 "status": "0",
                                                                                 "name": "MerchantStatusRequest.CLIENT"
                                                                             },
                                                                             {
                                                                                 "type": "BIZ",
                                                                                 "data": "sessionId=3800bb06-3796-43ee-9a18-1937718d2f86&timestamp=2016-06-08 18:12:41:669 +0000&actionId=MerchantUserInfoRequest&level=TRACE&result=0&duration=1090",
                                                                                 "status": "0",
                                                                                 "name": "MerchantUserInfoRequest.CLIENT"
                                                                             }
                                                                         ]
                                                                     }
                                                                     Headers:
                                                                     {
                                                                       X-PAYPAL-REQUEST-SOURCE = MPA-DEVICE_Android_Zebra Technologies-MC40N0_19_SDK_1.6.2.6_com.paypal.heresdk.sampleapp_1.0-L0
                                                                       Authorization = [-REDACTED-]

                                                                     }
06-08 19:13:08.705 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message From Terminal: 014008E10448020300900075
06-08 19:13:08.705 11356-3345/com.paypal.heresdk.sampleapp V/TerminalMessageTemplate Class: TerminalMessageTemplate len: 4
06-08 19:13:08.705 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message From Terminal: TAG: E1
06-08 19:13:08.705 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Handling Response Data Template
06-08 19:13:08.705 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-TAG48: 0300
06-08 19:13:08.705 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-[EMV] Card inserted
06-08 19:13:08.705 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: MiuraReader-cardInserted - Trying to start a xaction!
06-08 19:13:08.705 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CardReaderEventSession-onCardReaderEvent Event: CardInserted
06-08 19:13:08.705 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CardReaderEventSession-onCardReaderEvent Event: CardInserted
06-08 19:13:08.705 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:08.705 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CalLoggingService-NEW MESSAGE: {"data":{"timestamp":"2016-06-08 18:13:08:717 +0000","result":"0","level":"TRACE","actionId":"Message","details":"PPHSDK:PaymentFlow:  :  UniqueTraceID: a97107cb-888e-44c2-815a-279ba5e34021 InvoiceID: null setCardInsertHandler: card insert event from terminal","sessionId":"3800bb06-3796-43ee-9a18-1937718d2f86"},"type":"BIZ","status":"0","name":"Message.CLIENT"}
06-08 19:13:08.735 11356-11356/com.paypal.heresdk.sampleapp E/PPHSDK: PPHSDK:PaymentFlow:  : setCardInsertHandler: card insert event from terminal
06-08 19:13:08.735 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: EMVUITransactionController-beginTransaction
06-08 19:13:08.735 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKDialogManager-Showing the payment initiation dialog
06-08 19:13:08.735 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKUIDialogView-Showing the payment initiation dialog
06-08 19:13:08.735 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKUIAlertDialogPresenter-showAlertDialogWithProgressbar IN
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKReaderDialogView-Showing the payment initiation dialog
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-isCardInserted IN
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-isCardInserted
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: MiuraReader-isCardInserted IN
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-String to format : $1.00
                                                                      Do Not Remove Card
                                                                      Processing... 
                                                                       with alignment : CENTER
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-Formatted String :         $1.00       
                                                                       Do Not Remove Card 
                                                                          Processing...   
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-Applying padding to string :         $1.00       
                                                                       Do Not Remove Card 
                                                                          Processing...   
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-Formatted String : 
                                                                              $1.00       
                                                                       Do Not Remove Card 
                                                                          Processing...   
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-isReaderConnected IN
06-08 19:13:08.805 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-getActiveReaderType
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-displayTextOnTerminal Text: 
                                                                              $1.00       
                                                                       Do Not Remove Card 
                                                                          Processing...    displaySystemIcons: false
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-displayTextOnTerminalScreen.....
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message To Terminal: 010044D20100003F0A202020202020202024312E3030202020202020200A20446F204E6F742052656D6F76652043617264200A2020202050726F63657373696E672E2E2E202020D1
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: SDKUITransactionController-setCardReaderEventHandler handler: com.paypal.merchant.sdk.internal.ui.emv.EMVUITransactionController$18@41a1e8c8
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKUITransactionController-setCardReaderEventHandler registering the listener handler: com.paypal.merchant.sdk.internal.ui.emv.EMVUITransactionController$18@41a1e8c8
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-initiateEMVTransaction amount: 1.00
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:08.815 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-initiateEmvSaleTransaction Amount: 100 Currency: USD isContactlessTransaction: false
06-08 19:13:08.825 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message To Terminal: 010046DED1000041E0840000003B9F418400000004000000009A84000000031606089F2184000000031913089C8400000001009F0284000000060000000001005F2A840000000208408A
06-08 19:13:09.226 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message From Terminal: 010002900093
06-08 19:13:09.976 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: com.paypal.merchant.sdk.internal.service.cal.CalLogHereRequest- Response Body: 
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message From Terminal: 0101FEE482013F5F2A0208408202390050104D4153544552434152442020202020209F1C0831303433333034379F0607A00000000410105F201A4A4143454B2052595320202020202020202020202020202020205F280206165F300202265F3401005F24031812318407A0000000041010950500000080009A031606089B02E8009C01009F02060000000001009F03060000000000009F090200029F10120110A040002C0800000000000000000000FF9F1A0208409F1E0831303433333034379F26081ED91DE9BF74EA059F2701809F3303E028C89F34031E03009F3501229F360200259F3704BDB5774C9F410400000001DFAE02206C6448F07E8905A49A5F6C40
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Handling chained message! - First packet
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message From Terminal: 0100477503ED13E6062432A55F1E2768630FAD0932A33297DFAE030AFFFF98027CC85FC00005DFAE5712547839FFFFFF6469D1812226000000604000DFAE5A08547839FFFFFF6469900050
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Handling chained message! - Last packet.
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/TerminalMessageTemplate Class: Multiple Len Bytes
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/TerminalMessageTemplate Class: Total Len Bytes: 2
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/TerminalMessageTemplate Class: TerminalMessageTemplate len: 319
06-08 19:13:11.798 11356-3345/com.paypal.heresdk.sampleapp V/TLV Class: Multiple Len Bytes
06-08 19:13:11.808 11356-3345/com.paypal.heresdk.sampleapp V/TLV Class: Multiple Len Bytes
06-08 19:13:11.808 11356-3345/com.paypal.heresdk.sampleapp V/TLV Class: Multiple Len Bytes
06-08 19:13:11.808 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message From Terminal: TAG: E4
06-08 19:13:11.808 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Handling Online Authorisation Required Template
06-08 19:13:11.808 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: SoundNotification-playSound sampleID: 2131099653
06-08 19:13:11.828 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: MiuraReader-onlineAuthorisationRequiredemvData is [[B@41cca758]; Signature Required; Terminal ID: [10433047]
06-08 19:13:11.838 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: MiuraReader-Sending the following JSON tags: emv [5f2a0208408202390050104d4153544552434152442020202020209f1c0831303433333034379f0607a00000000410105f201a4a4143454b2052595320202020202020202020202020202020205f280206165f300202265f3401005f24031812318407a0000000041010950500000080009a031606089b02e8009c01009f02060000000001009f03060000000000009f090200029f10120110a040002c0800000000000000000000ff9f1a0208409f1e0831303433333034379f26081ed91de9bf74ea059f2701809f3303e028c89f34031e03009f3501229f360200259f3704bdb5774c9f410400000001dfae02206c6448f07e8905a49a5f6c7503ed13e6062432a55f1e2768630fad0932a33297dfae030affff98027cc85fc00005dfae5712547839ffffff6469d1812226000000604000dfae5a08547839ffffff6469]; serial [10433047]; batch [O.7.6.M.1.39]; type [MIURA]; pinPresentfalsesignaturePresent [true]; datetime [2016-06-08T19:13:11.837+01:00]
06-08 19:13:11.838 11356-3345/com.paypal.heresdk.sampleapp D/PPHSDK: CardReaderManagerImpl-Successful swipe: last four = 6469 Name: null null
06-08 19:13:11.838 11356-3345/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-Hey look...we have a card swipe
06-08 19:13:11.898 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:11.898 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CalLoggingService-NEW MESSAGE: {"data":{"timestamp":"2016-06-08 18:13:11:902 +0000","result":"0","level":"TRACE","actionId":"Message","details":"PPHSDK:PaymentFlow:  :  UniqueTraceID: a97107cb-888e-44c2-815a-279ba5e34021 InvoiceID: null setPostCardInsertionHandler: successful card read event from terminal","sessionId":"3800bb06-3796-43ee-9a18-1937718d2f86"},"type":"BIZ","status":"0","name":"Message.CLIENT"}
06-08 19:13:11.998 11356-11356/com.paypal.heresdk.sampleapp D/dalvikvm: GC_FOR_ALLOC freed 832K, 13% free 6477K/7392K, paused 60ms, total 62ms
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp E/PPHSDK: PPHSDK:PaymentFlow:  : setPostCardInsertionHandler: successful card read event from terminal
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: EMVUITransactionController-onSuccessfulCardRead
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKDialogManager-showProcessPaymentDialog
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKUIDialogView-showProcessPaymentDialog
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-isCardInserted IN
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-isCardInserted
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: MiuraReader-isCardInserted IN
06-08 19:13:12.008 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKUIAlertDialogPresenter-showAlertDialogWithProgressbar IN
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: SDKReaderDialogView-showProcessPaymentDialog
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-isCardInserted IN
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-isCardInserted
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: MiuraReader-isCardInserted IN
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-String to format : Do Not Remove Card
                                                                      Processing... 
                                                                       with alignment : CENTER
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-Formatted String :  Do Not Remove Card 
                                                                          Processing...   
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-Applying padding to string :  Do Not Remove Card 
                                                                          Processing...   
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK+MiuraM10DisplayFormatter-Formatted String : 
                                                                       Do Not Remove Card 
                                                                          Processing...   
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-isReaderConnected IN
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-getActiveReaderType
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: CardReaderManagerImpl-displayTextOnTerminal Text: 
                                                                       Do Not Remove Card 
                                                                          Processing...    displaySystemIcons: false
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-displayTextOnTerminalScreen.....
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message To Terminal: 01002FD20100002A0A20446F204E6F742052656D6F76652043617264200A2020202050726F63657373696E672E2E2E202020BE
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-processPayment with out paymentType
06-08 19:13:12.098 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-endProcessPaymentEarlyIfStateIsIncorrect paymentType: CardReader
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-getActiveReaderType
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-getAvaliableCardReaders
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-getAvaliableCardReaders
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-registerForTransactionProgressEvents
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-moveStateToProcessingPayment entry
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-SetState: AuthorizingPayment
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CardReaderManagerImpl-getActiveReaderType
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CreditCardReaders-getActiveReaderType
06-08 19:13:12.108 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-processPaymentWithBackend entry
06-08 19:13:12.118 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-SetState: ProceedWithAuthorizingPayment
06-08 19:13:12.118 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl- : emitPaymentEvent : ProcessingPayment
06-08 19:13:12.118 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: TransactionManagerImpl-processPaymentWithBackend: invoiceId: null
06-08 19:13:12.118 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-Active merchant is present.
06-08 19:13:12.118 11356-11356/com.paypal.heresdk.sampleapp D/PPHSDK: CalLoggingService-NEW MESSAGE: {"data":{"timestamp":"2016-06-08 18:13:12:125 +0000","result":"0","level":"TRACE","actionId":"Message","details":"PPHSDK:PaymentFlow:  :  UniqueTraceID: a97107cb-888e-44c2-815a-279ba5e34021 InvoiceID: null calling updateInvoice API","sessionId":"3800bb06-3796-43ee-9a18-1937718d2f86"},"type":"BIZ","status":"0","name":"Message.CLIENT"}
06-08 19:13:12.128 11356-3345/com.paypal.heresdk.sampleapp V/PPHSDK: BOND LIB-Message From Terminal: 010002900093
06-08 19:13:12.158 11356-11356/com.paypal.heresdk.sampleapp E/PPHSDK: PPHSDK:PaymentFlow:  : calling updateInvoice API
06-08 19:13:12.158 11356-11356/com.paypal.heresdk.sampleapp D/AndroidRuntime: Shutting down VM
06-08 19:13:12.158 11356-11356/com.paypal.heresdk.sampleapp W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x415e6bb0)
06-08 19:13:12.609 11356-496/com.paypal.heresdk.sampleapp D/dalvikvm: GC_FOR_ALLOC freed 1166K, 17% free 6528K/7776K, paused 63ms, total 63ms
06-08 19:13:12.629 11356-11356/com.paypal.heresdk.sampleapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              Process: com.paypal.heresdk.sampleapp, PID: 11356
                                                                              java.lang.NullPointerException
                                                                                  at com.paypal.merchant.sdk.internal.service.impl.hereapi.HereInvoiceCreateRequest.getPayloadAsString(HereInvoiceCreateRequest.java:84)
                                                                                  at com.paypal.merchant.sdk.internal.service.impl.hereapi.HereInvoiceUpdateRequest.getPayloadAsString(HereInvoiceUpdateRequest.java:62)
                                                                                  at com.paypal.merchant.sdk.internal.service.ServiceInterfaceVolleyImpl.submit(ServiceInterfaceVolleyImpl.java:209)
                                                                                  at com.paypal.merchant.sdk.internal.service.InvoiceServiceImpl.updateInvoice(InvoiceServiceImpl.java:205)
                                                                                  at com.paypal.merchant.sdk.internal.TransactionManagerImpl.processPaymentWithBackend(TransactionManagerImpl.java:950)
                                                                                  at com.paypal.merchant.sdk.internal.TransactionManagerImpl.moveStateToProcessingPayment(TransactionManagerImpl.java:725)
                                                                                  at com.paypal.merchant.sdk.internal.TransactionManagerImpl.processPayment(TransactionManagerImpl.java:690)
                                                                                  at com.paypal.merchant.sdk.internal.ui.SDKUITransactionController.processPaymentInternal(SDKUITransactionController.java:223)
                                                                                  at com.paypal.merchant.sdk.internal.ui.SDKUITransactionController.processPayment(SDKUITransactionController.java:217)
                                                                                  at com.paypal.merchant.sdk.internal.ui.emv.EMVUITransactionController.processPayment(EMVUITransactionController.java:291)
                                                                                  at com.paypal.merchant.sdk.internal.ui.emv.EMVUITransactionController.onSuccessfulCardRead(EMVUITransactionController.java:965)
                                                                                  at com.paypal.merchant.sdk.internal.ui.emv.EMVUITransactionController$18.onSuccessfulCardRead(EMVUITransactionController.java:838)
                                                                                  at com.paypal.merchant.sdk.internal.CardReaderEventSession.onCardReadSuccess(CardReaderEventSession.java:35)
                                                                                  at com.paypal.merchant.sdk.internal.CardReaderManagerImpl$CardReadSuccessMessage.run(CardReaderManagerImpl.java:1111)
                                                                                  at android.os.Handler.handleCallback(Handler.java:733)
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                  at android.os.Looper.loop(Looper.java:136)
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:5002)
                                                                                  at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                  at java.lang.reflect.Method.invoke(Method.java:515)
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
                                                                                  at dalvik.system.NativeStart.main(Native Method)
06-08 19:13:14.731 11356-496/com.paypal.heresdk.sampleapp I/CrashlyticsCore: Crashlytics report upload complete: 5758601401E9-0001-2C5C-014AC6A583F4.cls
ppmtscory commented 8 years ago

There's quite a bit going on in those logs.. :) Are you trying to swipe the card first and then you insert it? Also, did you modify the code to do an Authorization instead of a Sale transaction? I just successfully used the sample app yesterday so I'd need the exact steps you are going through, as well as modifications, to understand better what's happening. The error itself is due to a null invoice ID, but why that's happening is what we need to figure out.

mastahnish commented 8 years ago

@ppmtscory I tried both scenarios

You have to know that I want to utilize accessToken provide from my customer's API. So on the customer's server side there's a curl command done and I will be provided with accessToken that I will use in authentications. Regarding the code - yes, I slightly modified it. Here's what I changed:|

String token = LocalPreferences.getLiveMidtierToken(LoginActivity.this);

to assign the token that I get from customer's API

String token = "A015******************************************c"; (47 characters)

from

 public void setAccessTokenToSDK(String compositeAccessToken, final PayPalHereSDKWrapperCallbacks listener){
        PayPalHereSDK.setCredentialsFromCompositeStrFromMidTierServer(compositeAccessToken, new DefaultResponseHandler<Merchant, PPError<MerchantManager.MerchantErrors>>() {
            @Override
            public void onSuccess(Merchant merchant) {
                Log.d(LOG_TAG, "initializeSDK setCredentialsFromCompositeStr onSuccess");
                if (null != listener) {
                    listener.onSuccessfulCompletionOfSettingAccessTokenToSDK();
                }
            }

            @Override
            public void onError(PPError<MerchantManager.MerchantErrors> merchantErrorsPPError) {
                Log.d(LOG_TAG, "initializeSDK setCredentialsFromCompositeStr onError error: " + merchantErrorsPPError);
                if (null != listener) {
                    listener.onErrorWhileSettingAccessTokenToSDK();
                }
            }
        });
    }

to

public void setAccessTokenToSDK(String accessToken, final PayPalHereSDKWrapperCallbacks listener){

        Credentials credentials = new OAuthCredentials(accessToken);        

        PayPalHereSDK.setCredentials(credentials, new DefaultResponseHandler<Merchant, PPError<MerchantManager.MerchantErrors>>() {
            @Override
            public void onSuccess(Merchant merchant) {
                Log.d(LOG_TAG, "initializeSDK setCredentialsFromCompositeStr onSuccess");
                if (null != listener) {
                    listener.onSuccessfulCompletionOfSettingAccessTokenToSDK();
                }
            }

            @Override
            public void onError(PPError<MerchantManager.MerchantErrors> merchantErrorsPPError) {
                Log.d(LOG_TAG, "initializeSDK setCredentialsFromCompositeStr onError error: " + merchantErrorsPPError);
                if (null != listener) {
                    listener.onErrorWhileSettingAccessTokenToSDK();
                }
            }
        });
    }

And then I proceeded with CardReader connection and payment.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! One more unexpected thing: New error happens today when initializing SDK in that way (yesterday it was initializing SDK correctly) ! I'm getting error like this:

06-10 09:58:49.839 21817-21817/com.paypal.heresdk.sampleapp E/RiskComponent: LoadConfigurationRequest failed.
06-10 09:58:49.839 21817-21817/com.paypal.heresdk.sampleapp E/RiskComponent: BeaconRequest failed.
06-10 09:58:50.349 21817-21817/com.paypal.heresdk.sampleapp E/PPHSDK: MerchantStatusRequest- RESPONSE BODY ON ERROR: java.net.UnknownHostException: Unable to resolve host "www.paypal.com": No address associated with hostname
06-10 09:58:50.349 21817-21817/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-No active merchant. Returning null.
06-10 09:58:50.349 21817-21817/com.paypal.heresdk.sampleapp D/PPHSDK: CalLoggingService-NEW MESSAGE: {"data":{"timestamp":"2016-06-10 08:58:50:357 +0000","result":"-1","level":"ERROR","actionId":"Message","details":":  RESPONSE BODY ON ERROR: java.net.UnknownHostException: Unable to resolve host \"www.paypal.com\": No address associated with hostname","sessionId":"570d1a66-7c4b-4f3a-acd0-0cc2ad0ede29"},"type":"BIZ","status":"-1","name":"Message.CLIENT"}
06-10 09:58:50.359 21817-21817/com.paypal.heresdk.sampleapp E/PPHSDK: MerchantStatusRequest-Failure response from backend and contains errors. Error detailscode=01031;type=null;message=We were unable to process the Http Request;details=null
06-10 09:58:50.359 21817-21817/com.paypal.heresdk.sampleapp D/PPHSDK: PPHSDK.MerchantManagerImpl-No active merchant. Returning null.
06-10 09:58:50.369 21817-21817/com.paypal.heresdk.sampleapp D/PPHSDK: CalLoggingService-NEW MESSAGE: {"data":{"timestamp":"2016-06-10 08:58:50:377 +0000","result":"-1","level":"ERROR","actionId":"Message","details":": Failure response from backend and contains errors. Error detailscode=01031;type=null;message=We were unable to process the Http Request;details=null\n","sessionId":"570d1a66-7c4b-4f3a-acd0-0cc2ad0ede29"},"type":"BIZ","status":"-1","name":"Message.CLIENT"}
06-10 09:58:50.379 21817-21817/com.paypal.heresdk.sampleapp D/PPHSDK: CalLoggingService-NEW MESSAGE: {"data":{"data":"https:\/\/www.paypal.com\/webapps\/hereapi\/merchant\/v1\/status","timestamp":"2016-06-10 08:58:50:395 +0000","result":"-1","level":"INFO","actionId":"MerchantStatusRequest","sessionId":"570d1a66-7c4b-4f3a-acd0-0cc2ad0ede29"},"type":"BIZ","status":"-1","name":"MerchantStatusRequest.CLIENT"}
06-10 09:58:50.420 21817-21817/com.paypal.heresdk.sampleapp D/dalvikvm: GC_FOR_ALLOC freed 398K, 11% free 4259K/4772K, paused 29ms, total 29ms
06-10 09:58:50.430 21817-21817/com.paypal.heresdk.sampleapp D/PPHSDK: CalLoggingService-NEW MESSAGE: {"data":{"data":"null","timestamp":"2016-06-10 08:58:50:443 +0000","result":"-1","duration":40444,"level":"ERROR","actionId":"MerchantStatusRequest","sessionId":"570d1a66-7c4b-4f3a-acd0-0cc2ad0ede29"},"type":"BIZ","status":"-1.1031","name":"MerchantStatusRequest.CLIENT"}
06-10 09:58:50.450 21817-21817/com.paypal.heresdk.sampleapp D/PayPalHereSDKWrapper: initializeSDK setCredentialsFromDoddlesAPIAccessToken onError error: com.paypal.merchant.sdk.domain.PPError@41fb6130
06-10 09:58:50.450 21817-21817/com.paypal.heresdk.sampleapp D/LoginActivity: PayPalHere SDK initialize onErrorWhileSettingAccessTokenToSDK. Token: A015db356l3s-xIC4iLQP3jqzpn9wpDvYPeoB4VYgCh5YII
06-10 09:58:50.550 21817-21817/com.paypal.heresdk.sampleapp D/Volley: [1] Request.finish: 40592 ms: [ ] https://www.paypal.com/webapps/hereapi/merchant/v1/status 0x2972d4bd NORMAL 2

UPDATE: New error is not showing anymore.

UPDATE: We tried to run Sample App and initialize SDK using mid-tier server (by entering credentials in WebView) and it worked. So knowing that I suppose that using PayPalHereSDK.setCredentials(..) method instead of PayPalHereSDK.setCredentialsFromCompositeStrFromMidTierServer(...) method is the root cause.

Please take a look and let me know how to use PayPalHereSDK.setCredentials(..) method in a proper way.

ppmtscory commented 8 years ago

Ah, thank you for the clarification. Yes, the sample app is indeed set up to utilize the composite token that's provided from the retail node mid-tier server. Since it's set up that way, and is used just as a demo, you should be able to modify it to use just the credentials, however it's possible that there's someplace that's not getting changed. Therefore, it tries to read the information from a token that doesn't exist. Either way, the sample app should just be used as a reference of how the flow of operations should be handled. In your own integration, you can definitely use just setCredentials() with the access token directly. An example of that is in the readme of the repo.

ppmtscory commented 8 years ago

Also, if you wanted to utilize the same mid-tier server and composite token setup for your own integration, that server is found here and can be deployed directly to Heroku if you're using that for a cloud server.

mastahnish commented 8 years ago

@ppmtscory the problem is that I modified sample app to use setCredentials() and I'm getting this NPE error when making transactions. Do you have any idea how to solve it?

ppmtscory commented 8 years ago

It's happening because there's no active merchant set which is due to somewhere expecting the composite token but receiving just the access token directly. Since the sample app isn't set up that way by default, in order to see what needs to be changed, I will need to try to modify it myself to get it going via setCredentials. This will take some time, but I will update you here once I'm able to do so.

mastahnish commented 8 years ago

@ppmtscory This will be much appreciated. Please test it in that way and let me know about the possible solutions. Thank you!

ppmtscory commented 8 years ago

Alright, that didn't take as long as I anticipated.. :)

public void setAccessTokenToSDK(String accessToken, final PayPalHereSDKWrapperCallbacks listener){
        Credentials credentials = new OAuthCredentials(accessToken);

        PayPalHereSDK.setCredentials(credentials, new DefaultResponseHandler<Merchant, PPError<MerchantManager.MerchantErrors>>() {
            @Override
            public void onSuccess(Merchant merchant) {
                Log.d(LOG_TAG, "initializeSDK setCredentialsFromCompositeStr onSuccess");
                if (null != listener) {
                    listener.onSuccessfulCompletionOfSettingAccessTokenToSDK();
                }
            }

            @Override
            public void onError(PPError<MerchantManager.MerchantErrors> merchantErrorsPPError) {
                Log.d(LOG_TAG, "initializeSDK setCredentialsFromCompositeStr onError error: " + merchantErrorsPPError);
                if (null != listener) {
                    listener.onErrorWhileSettingAccessTokenToSDK();
                }
            }
        });
    }

With these changes, i was able to successfully initialize the merchant and subsequently process a successful payment.

mastahnish commented 8 years ago

Thank you @ppmtscory for that for your effort, but please note that this is exactly what I did already (I described it in my previous comments). Despite I did it in that way I got that NPE error. I feel a little confused now what can bee the reason of this NPE on my side...

ppmtscory commented 8 years ago

I understand that, however, with me doing the same and it working, there's likely either something else that was modified in your code or maybe there's an issue with the merchant account you are using.

ppmtscory commented 8 years ago

Can you email with subject 'Attn: Cory' so that we can communicate about account specific things outside of this public forum?

mastahnish commented 8 years ago

@ppmtscory Sure, just sent you an email.