/**
  * @param array $configData
  * @param mixed $vault
  * @param mixed $registry
  * @param bool $existingCustomer
  * @param array $paymentInfo
  * @param array $expectedRequestAttributes
  * @param array $braintreeResponse
  * @param array $expectedPaymentFields
  * @param string $appState
  * @dataProvider authorizeDataProvider
  */
 public function testAuthorizeSuccess(array $configData, $vault, $registry, $existingCustomer, array $paymentInfo, array $expectedRequestAttributes, array $braintreeResponse, array $expectedPaymentFields, $appState = null)
 {
     $storeId = 3;
     $amount = self::AUTH_AMOUNT;
     $paymentObject = $this->objectManagerHelper->getObject('Magento\\Sales\\Model\\Order\\Payment');
     $expectedRequestAttribs = $this->setupAuthorizeRequest($configData, $vault, $registry, $existingCustomer, $paymentInfo, $expectedRequestAttributes, $paymentObject, $storeId, $amount);
     //setup braintree response
     $result = $this->setupSuccessResponse($braintreeResponse);
     $this->braintreeTransactionMock->expects($this->once())->method('sale')->with($this->callback(function ($actual) use($expectedRequestAttribs) {
         return $this->compareArray($actual, $expectedRequestAttribs);
     }))->willReturn($result);
     $this->psrLoggerMock->expects($this->never())->method('critical');
     if ($appState) {
         $this->appStateMock->expects($this->any())->method('getAreaCode')->willReturn($appState);
     }
     $paymentObject->setParentId('1');
     $order = $this->getMockBuilder('Magento\\Sales\\Api\\Data\\OrderInterface')->getMockForAbstractClass();
     $order->expects($this->once())->method('getTotalDue')->willReturn(10.02);
     $this->orderRepository->expects($this->once())->method('get')->willReturn($order);
     $this->assertEquals($this->model, $this->model->authorize($paymentObject, $amount));
     foreach ($expectedPaymentFields as $key => $value) {
         if ($key == 'getTransactionAdditionalInfo') {
             $this->assertEquals($value, $paymentObject->getTransactionAdditionalInfo());
         } else {
             $this->assertEquals($value, $paymentObject->getData($key), 'Incorrect field in paymentobject: ' . $key);
         }
     }
     $this->assertEquals($storeId, $this->model->getStore());
     $this->assertEquals(PaymentMethod::STATUS_APPROVED, $paymentObject->getStatus());
 }