/**
  * @param PagSeguroCredentials $credentials
  * @param PagSeguroPreApprovalCharge $charge
  * @return null|PagSeguroParserData
  * @throws Exception
  * @throws PagSeguroServiceException
  */
 public static function paymentCharge(PagSeguroCredentials $credentials, PagSeguroPreApprovalCharge $charge)
 {
     LogPagSeguro::info("PagSeguroPreApprovalService.PreApprovalPaymentCharge(" . $charge->toString() . ") - begin");
     self::$connectionData = new PagSeguroConnectionData($credentials, self::SERVICE_NAME);
     $data = array_merge(self::$connectionData->getCredentials()->getAttributesMap(), PagSeguroPreApprovalParser::getCharge($charge));
     try {
         $connection = new PagSeguroHttpConnection();
         $connection->post(self::buildPreApprovalPaymentUrl(self::$connectionData), $data, self::$connectionData->getServiceTimeout(), self::$connectionData->getCharset());
         self::$service = "PreApprovalPaymentCharge";
         return self::getResult($connection);
     } catch (PagSeguroServiceException $err) {
         //Logging
         LogPagSeguro::error("PagSeguroServiceException: " . $err->getMessage());
         //Exception
         throw $err;
     } catch (Exception $err) {
         //Logging
         LogPagSeguro::error("Exception: " . $err->getMessage());
         //Exception
         throw $err;
     }
 }