NAXAM / braintree-ios-binding

Xamarin Binding Library - Braintree iOS SDK
Other
8 stars 7 forks source link

BTPaymentFlowDriver.StartPaymentFlow crashing #6

Closed SangI762 closed 1 year ago

SangI762 commented 5 years ago

I tried implement verify a credit card with 3DS.

public async Task<CreditCardTokenizationResultDto> TokenizeAsync(string cardNumber, DateTime expirationDate, string cvv, string clientToken, string amount)
        {
            Task<CreditCardTokenizationResultDto> tokenizeTask = new Task<CreditCardTokenizationResultDto>(() => _result);

            BTAPIClient apiClient = new BTAPIClient(clientToken);
            BTCardClient cardClient = new BTCardClient(apiClient);
            BTCard card = new BTCard(cardNumber, expirationDate.Month.ToString(), expirationDate.Year.ToString(), cvv);

            cardClient.TokenizeCard(card, (result, error) =>
            {
                _result = new CreditCardTokenizationResultDto(result.Description, expirationDate, cvv, result.Nonce);
                tokenizeTask.Start();
            });

            await tokenizeTask;

            Task secureCheckTask = new Task(() => { });

            BTThreeDSecureRequest request = new BTThreeDSecureRequest();
            request.Amount = 1;
            request.Nonce = _result.Nonce;

            BTPaymentFlowDriver bTPaymentFlowDriver = new BTPaymentFlowDriver(apiClient);
            bTPaymentFlowDriver.ViewControllerPresentingDelegate = this;

            Action<BTPaymentFlowResult, NSError> action = (nonce, error) =>
            {
                // TODO check 3DS result
                secureCheckTask.Start();
            };

            bTPaymentFlowDriver.StartPaymentFlow(request, action);

            await secureCheckTask;

            return tokenizeTask.Result;
        }

And line bTPaymentFlowDriver.StartPaymentFlow(request, action); crashes with this error:

Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
Native stack trace:
    0   CoreFoundation                      0x00000001e79e5294 <redacted> + 252
    1   libobjc.A.dylib                     0x00000001e6bbf9f8 objc_exception_throw + 56
    2   CoreFoundation                      0x00000001e795ece8 _CFArgv + 0
    3   CoreFoundation                      0x00000001e78e69a8 <redacted> + 352
    4   CoreFoundation                      0x00000001e78d7584 <redacted> + 64
    5   BraintreePaymentFlow                0x000000010c08a884 __93-[BTPaymentFlowDriver(ThreeDSecure) lookupThreeDSecureForNonce:transactionAmount:completion:]_block_invoke + 144
    6   libdispatch.dylib                   0x00000001e7424a38 <redacted> + 24
    7   libdispatch.dylib                   0x00000001e74257d4 <redacted> + 16
    8   libdispatch.dylib                   0x00000001e73d3004 <redacted> + 1068
    9   CoreFoundation                      0x00000001e7976c1c <redacted> + 12
    10  CoreFoundation                      0x00000001e7971b54 <redacted> + 1924
    11  CoreFoundation                      0x00000001e79710b0 CFRunLoopRunSpecific + 436
    12  GraphicsServices                    0x00000001e9b7179c GSEventRunModal + 104
    13  UIKitCore                           0x00000002141a7978 UIApplicationMain + 212
    14  citybee.iOS                         0x0000000103fd3fe0 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 400
    15  citybee.iOS                         0x0000000103f0a2c4 UIKit_UIApplication_Main_string___intptr_intptr + 68
    16  citybee.iOS                         0x0000000103f0a21c UIKit_UIApplication_Main_string___string_string + 92
    17  citybee.iOS                         0x0000000102ea01b8 CityBee_iOS_Application_Main_string__ + 152
    18  citybee.iOS                         0x00000001032a2a4c wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 284
    19  citybee.iOS                         0x00000001068f605c mono_jit_runtime_invoke + 1100
    20  citybee.iOS                         0x00000001069aea34 mono_runtime_invoke_checked + 148
    21  citybee.iOS                         0x00000001069b4f6c mono_runtime_exec_main_checked + 120

Can you help me?

tuyen-vuduc commented 4 years ago

Would you mind checking out latest package?

tuyen-vuduc commented 1 year ago

Closing due to no info